/* === Reset & Base === */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: #fdf8f2;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='2.5' numOctaves='5' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.65'/%3E%3C/svg%3E");
  background-blend-mode: lighten;
  color: #5c3d2e;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  display: flex;
  justify-content: center;
  transition: background-color 0.6s ease, color 0.6s ease;
}

/* === Layout === */
.page {
  width: 100%;
  max-width: 640px;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 2rem 1.5rem;
}

/* === Header / Logo === */
.header {
  width: 100%;
  display: flex;
  justify-content: center;
}

.logo-img {
  height: 50px;
  margin-top: 20px;
  width: auto;
  object-fit: contain;
}

.logo-fallback {
  display: none;
  font-family: 'Heebo', sans-serif;
  font-weight: 500;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: #5c3d2e;
  text-transform: uppercase;
}

/* === Banner / E-Ink Frame === */
.banner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.illustration {
  width: 100%;
  max-width: 400px;
  height: auto;
  margin-bottom: 2rem;
  border-radius: 10px;
}

.eink-frame {
  width: 100%;
  background-image: url('./assets/day.webp');
  background-size: cover;
  background-position: center 80%;
  border: none;
  border-radius: 14px;
  padding: 3rem 2rem;
  box-shadow:
    inset 0 0 0 6px rgba(235, 220, 195, 0.8),
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    inset 0 -1px 2px rgba(0, 0, 0, 0.05),
    0 2px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  position: relative;
}

/* Subtle e-ink paper texture feel */
.eink-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.004) 2px,
    rgba(0, 0, 0, 0.004) 4px
  );
  pointer-events: none;
}
.wrap-text {
  position: absolute;
  top:15%;
  left: 25%;
  width:50%;
  height:50%;
  display: flex;
  justify-content: center;
  align-items: center;

}
.hebrew-time {
  font-family: 'David Libre', 'Times New Roman', serif;
  padding: 5px;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.8;
  color: #2a2a2a;
  direction: rtl;
  letter-spacing: 0.01em;
  transform: perspective(800px) rotateX(8deg);
  transform-origin: center bottom;
  max-width: 80%;
  max-height: 90%;
  rotate: 1deg;
}
/* breakpoints for text inside screen daymode */
/* Small phones */


.tagline {
  font-family: 'Heebo', sans-serif;
  font-size: clamp(0.9rem, 4.5vw, 2rem);
  font-weight: 500;
  color: #5c3d2e;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
}

/* === Signup Section === */
.signup {
  width: 100%;
  text-align: center;
}

.signup-form {
  width: 100%;
}

/* Honeypot — invisible to users */
.hp-field {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.input-group {
  display: flex;
  flex-direction: row-reverse;
  gap: 0;
  width: 100%;
  border: 1px solid #e8e8e8;
  border-radius: 50px;
  overflow: hidden;
  background: #ffffff;
}

.input-group:focus-within {
  border-color: #d0d0d0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.input-group input[type="email"] {
  flex: 1;
  padding: 0.875rem 1.25rem;
  border: none;
  outline: none;
  font-family: 'Heebo', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  color: #5c3d2e;
  background: transparent;
  direction: rtl;
  text-align: right;
}

.input-group input[type="email"]::placeholder {
  color: #a08577;
  transition: opacity 0.3s ease;
}

.input-group input[type="email"]:focus::placeholder {
  opacity: 0;
}

.input-group button {
  padding: 0.75rem 1.5rem;
  border: none;
  background: #8a7568;
  color: #ffffff;
  font-family: 'Heebo', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  border-radius: 50px;
  margin: 4px;
}

.input-group button:hover {
  background: #6d5548;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(90, 60, 45, 0.3);
}

.input-group button:active {
  background: #7a6558;
}

.input-group button:disabled {
  background: #a08577;
  cursor: not-allowed;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Page Load Animations === */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  animation: fadeUp 1.4s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.eink-frame {
  animation: fadeUp 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.tagline {
  opacity: 0;
  animation: fadeUp 1.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.6s forwards;
}

.signup {
  opacity: 0;
  animation: fadeUp 1.4s cubic-bezier(0.25, 0.1, 0.25, 1) 0.9s forwards;
}

/* Form message */
.form-message {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  transition: opacity 0.3s ease;
}

.form-message:empty {
  display: none;
}

.form-message.success {
  color: #5a9a3d;
}

.form-message.error {
  color: #d05545;
}

.focus-hint {
  margin-top: 0.4rem;
  font-family: 'Heebo', sans-serif;
  font-size: 1.25rem;
  font-weight: 300;
  color: #5c3d2e;
}

.signup-subtext {
  margin-top: 1rem;
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 0.95rem;
  font-weight: 400;
  color: #a0a0a0;
  letter-spacing: 0.01em;
}

/* === Footer === */
.footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
}

.footer p {
  font-size: 0.75rem;
  color: #c0c0c0;
  letter-spacing: 0.04em;
}

/* === Success Overlay === */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(239, 232, 222, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  animation: overlayFadeIn 0.6s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.success-overlay[hidden] {
  display: none;
}

.success-content {
  text-align: center;
  animation: contentSlideUp 0.7s cubic-bezier(0.25, 0.1, 0.25, 1) 0.2s both;
}

.success-check {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
}

.checkmark-svg {
  width: 80px;
  height: 80px;
}

.checkmark-circle {
  stroke: #8a7568;
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: circleStroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}

.checkmark-path {
  stroke: #8a7568;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkStroke 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.9s forwards;
}

.success-title {
  font-family: 'Heebo', sans-serif;
  font-size: 2rem;
  font-weight: 500;
  color: #5c3d2e;
  margin-bottom: 0.5rem;
}

.success-message {
  font-family: 'Heebo', sans-serif;
  font-size: 1.2rem;
  font-weight: 300;
  color: #8a7568;
  opacity: 0;
  animation: textFadeIn 0.5s ease 1.2s forwards;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes contentSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes circleStroke {
  to { stroke-dashoffset: 0; }
}

@keyframes checkStroke {
  to { stroke-dashoffset: 0; }
}

@keyframes textFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === Night Mode === */
body[data-mode="night"] .eink-frame {
  background-image: url('./assets/night.webp');
}

body[data-mode="night"] .wrap-text {
  position: absolute;
  top: 37%;
  left: 25%;
  width: 35%;
  height: 35%;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: perspective(800px) rotateX(8deg);
  transform-origin: center bottom;
}

body[data-mode="night"] .hebrew-time {
  max-width: 80%;
  max-height: 90%;
  padding:5px;
  line-height: 1.6;
  white-space: normal;
  text-align: center;
  font-size: 1.5rem;
}
/* === Responsive === */

/* Small phones */
@media (max-width: 380px) {
  .page {
    padding: 1rem 0.75rem;
  }

  .logo-img {
    height: 50px;
  }

  .eink-frame {
    height: clamp(280px, 55dvh, 400px);
    padding: 1.25rem 0.75rem;
    border-radius: 10px;
    margin-bottom: 15px;
    background-position: center 75%;
    box-shadow:
      inset 0 0 0 4px rgba(235, 220, 195, 0.8),
      inset 0 1px 2px rgba(255, 255, 255, 0.3),
      inset 0 -1px 2px rgba(0, 0, 0, 0.05),
      0 2px 6px rgba(0, 0, 0, 0.1);
  }

  .eink-frame::before {
    border-radius: 10px;
  }
  .wrap-text {
    width:70%;
    height: 35%;
    top: 35%;
    left: 15%;
  }
  .hebrew-time {
    font-size: 1.5rem;
  }
  body[data-mode="night"] .wrap-text {
    height:30%;
    width:50%;
    top:47%;
    left:10%;
  }
  .tagline {
    font-size: 1.4rem;
  }

  .focus-hint {
    font-size: 0.9rem;
  }

  .input-group {
    margin-top: 10px;
  }

  .input-group input[type="email"] {
    text-align: center;
    direction: ltr;
    padding: 0.75rem 0.75rem;
    font-size: 0.9rem;
  }

  .input-group button {
    padding: 0.625rem 1rem;
    font-size: 0.85rem;
    min-width: 60px;
  }
}

/* Mobile */
@media (min-width: 381px) and (max-width: 480px) {
  .page {
    padding: 1.5rem 1rem;
  }

  .illustration {
    display: none;
  }

  .eink-frame {
    height: clamp(350px, 58dvh, 500px);
    padding: 1.5rem 1rem;
    border-radius: 12px;
    margin-bottom: 20px;
    background-position: center 75%;
  }
  .wrap-text {
    width: 70%;
    height: 40%;
    top:30%;
    left:15%;
  }
  .hebrew-time {
    font-size: 1.6rem;
  }
  body[data-mode="night"] .wrap-text {
    height:30%;
    width:50%;
    top:47%;
    left:10%;
  }
  .eink-frame::before {
    border-radius: 12px;
  }


  .tagline {
    font-size: 1.6rem;
  }

  .focus-hint {
    font-size: 1rem;
  }

  .input-group {
    margin-top: 15px;
  }

  .input-group input[type="email"] {
    text-align: center;
    direction: ltr;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
  }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
  .page {
    padding: 1.5rem;
  }

  .illustration {
    display: none;
  }

  .eink-frame {
    height: clamp(280px, 40dvh, 350px);
    background-position: center 70%;
  }
  .wrap-text {
    top: 30%;
    height: 35%;
  }
  .hebrew-time {
    font-size: 1.5rem;
  }

  body[data-mode="night"] .wrap-text {
    top:43%;
  }
  body[data-mode="night"] .hebrew-time {
    font-size: 1.1rem;
  }

  .tagline {
    font-size: 1.6rem;
  }

  .signup {
    max-width: 380px;
  }
}

/* Laptop */
@media (min-width: 769px) and (max-width: 991px) {
  .page {
    max-width: 100%;
    padding: 2rem;
  }

  .illustration {
    max-width: 70%;
    height: 350px;
    object-fit: cover;
    border-radius: 10px;
  }

  .eink-frame {
    width: 70%;
    height: 350px;
  }
  .wrap-text {
    height:35%;
    top: 30%;
  }
  .hebrew-time {
    font-size: 1.5rem;
  }
  body[data-mode="night"] .wrap-text {
    width: 30%;
    height: 30%;
    top: 45%;
    left: 27%;
  }

  body[data-mode="night"] .hebrew-time {
    font-size: 1.3rem;
  }
  .tagline {
    font-size: 1.8rem;
    margin-bottom: 2rem;
  }

  .signup {
    max-width: 380px;
    margin-top: auto;
  }

  .input-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }
}

/* Desktop */
@media (min-width: 992px) {
  .page {
    max-width: 100%;
  }

  .illustration {
    max-width: 60%;
    height: 400px;
    object-fit: cover;
    border-radius: 10px;
  }

  .eink-frame {
    width: 800px;
    height: 400px;
  }



  .signup {
    max-width: 400px;
    margin-top: auto;
    margin-bottom: 20px;
  }

  .input-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .input-group input[type="email"] {
    padding: 0.875rem 1.5rem;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .page {
    padding: 0.75rem 1.5rem;
    justify-content: center;
    gap: 0.75rem;
  }

  .logo-img {
    height: 50px;
  }

  .eink-frame {
    height: 45dvh;
    padding: 1rem;
  }

  .tagline {
    font-size: 1.2rem;
  }

  .focus-hint {
    display: none;
  }
}