/* Marea Spanish School — hand-finished touches Tailwind utilities don't cover */

:root {
  --ocean: #0f3d3e;
  --ocean-2: #145258;
  --ocean-rgb: 15 61 62;
  --ocean-2-rgb: 20 82 88;
  --sand: #f2e8d2;
  --coral: #f2613f;
  --mango: #f2a63c;
  --palm: #3f6d53;
  --palm-rgb: 63 109 83;
  --ink: #1b2420;
  --ink-rgb: 27 36 32;
  --onbg-rgb: 27 36 32;
  --surface-rgb: 251 246 236;
  --cream: #fbf6ec;
}

/* Dark theme (toggled from the header, saved per visitor). It re-colors the
   whole page, not just the background: teal sections go deeper, cards become
   dark surfaces, and text, hairlines and the green accent flip to light values.
   --cream stays fixed on purpose — it is the light text on the teal sections
   and the light pill buttons, which must stay light in both themes. */
:root[data-theme="dark"] {
  --ocean-rgb: 14 44 46;
  --ocean-2-rgb: 21 62 66;
  --sand: #0b1918;
  --palm-rgb: 116 178 144;
  --ink-rgb: 236 231 218;
  --onbg-rgb: 236 231 218;
  --surface-rgb: 19 41 40;
}

html {
  scroll-behavior: smooth;
}

/* "Virtual school" doodle pattern (assets/pattern-virtual.svg). It lives on a ::before
   layer so its strength can be tuned without touching the content above it. */
.pattern-virtual,
.pattern-adapt {
  position: relative;
  isolation: isolate;
}

.pattern-virtual::before,
.pattern-adapt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-size: 400px 400px;
  background-repeat: repeat;
  opacity: 0.6;
}

.pattern-virtual::before {
  background-image: url("../assets/pattern-virtual.svg");
}

/* Light sections get dark line-art; in the dark theme the same sections get the light version. */
.pattern-adapt::before {
  background-image: url("../assets/pattern-virtual-ink.svg");
}

:root[data-theme="dark"] .pattern-adapt::before {
  background-image: url("../assets/pattern-virtual.svg");
}

@media (max-width: 640px) {
  .pattern-virtual::before,
  .pattern-adapt::before {
    background-size: 320px 320px;
  }
}

/* Mobile menu open: freeze the page behind the full-screen overlay. */
html.menu-open,
html.menu-open body,
html.modal-open,
html.modal-open body {
  overflow: hidden;
}

html.menu-open #whatsapp-float {
  display: none;
}

.nav-overlay-open {
  animation: nav-overlay-in 0.2s ease-out;
}

@keyframes nav-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  background-color: var(--sand);
  color: rgb(var(--ink-rgb));
}

.font-display {
  font-family: "Fraunces", ui-serif, Georgia, serif;
}

.font-mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

/* Eyebrow labels — small caps ticket-stub style */
.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

/* --- Wave dividers between sections --------------------------------- */
.wave-divider {
  display: block;
  width: 100%;
  height: auto;
  line-height: 0;
}

/* --- Phrase ticker between hero and method section ------------------- */
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 32s linear infinite;
}

.ticker-track:hover {
  animation-play-state: paused;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* --- Postcard teacher cards -------------------------------------------- */
.postcard {
  position: relative;
  background: rgb(var(--surface-rgb));
  border: 1px solid rgb(var(--ink-rgb) / 0.12);
  box-shadow: 0 18px 40px -22px rgba(15, 61, 62, 0.45);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

/* Lift on hover. Never applied to the two faces of a flip card: forcing a transform on the
   back face (which needs rotateY(180deg)) turned it face-up over the front after flipping back. */
.postcard:not(.flip-card-front):not(.flip-card-back):hover {
  transform: translateY(-6px) rotate(0deg) !important;
  box-shadow: 0 26px 48px -20px rgba(15, 61, 62, 0.5);
}

.flip-card {
  transition: transform 0.35s ease;
}

.flip-card:hover {
  transform: translateY(-6px);
}

.flip-card:hover .flip-card-front {
  transform: rotate(0deg);
  box-shadow: 0 26px 48px -20px rgba(15, 61, 62, 0.5);
}

.flip-card:hover .flip-card-back {
  box-shadow: 0 26px 48px -20px rgba(15, 61, 62, 0.5);
}

.postcard::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgb(var(--ink-rgb) / 0.14) 1px, transparent 0);
  background-size: 10px 10px;
  opacity: 0.5;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 14%, transparent 86%, black);
  mask-image: linear-gradient(to bottom, black, transparent 14%, transparent 86%, black);
}

.postcard-tape {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%) rotate(-3deg);
  width: 88px;
  height: 28px;
  background: rgba(242, 166, 60, 0.55);
  border: 1px solid rgb(var(--ink-rgb) / 0.08);
}

.postcard-stamp {
  border: 2px dashed rgb(var(--ink-rgb) / 0.35);
}

/* --- Flip a postcard over to reveal a teacher's availability ------------- */
.flip-card {
  perspective: 1600px;
}

.flip-card-inner {
  display: grid;
  grid-template-areas: "stack";
  transition: transform 0.7s cubic-bezier(0.4, 0.1, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  grid-area: stack;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  min-width: 0;
}

.flip-card-back {
  transform: rotateY(180deg);
  cursor: pointer;
}

/* Always visible (not hover-gated) so touch devices see the affordance too. */
.flip-hint {
  opacity: 0.8;
  transition: opacity 0.25s ease;
}

.flip-card:hover .flip-hint {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .flip-card-inner {
    transition: none;
  }
}

/* --- Ticket-stub pricing cards ------------------------------------------ */
.ticket {
  position: relative;
  background: rgb(var(--surface-rgb));
}

.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--sand);
  border-radius: 999px;
  left: 50%;
  transform: translateX(-50%);
}

.ticket::before {
  top: -12px;
}

.ticket::after {
  bottom: -12px;
}

.ticket-perforation {
  border-top: 2px dashed rgb(var(--ink-rgb) / 0.25);
}

/* --- Admin / teacher sidebar nav ----------------------------------------- */
.admin-nav-link.active,
.teacher-nav-link.active {
  background-color: rgba(251, 246, 236, 0.12);
  color: var(--cream);
}

.admin-nav-link.active svg,
.teacher-nav-link.active svg {
  color: var(--mango);
}

/* --- Scroll reveal ------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --- Legal pages (privacy / terms / cancellation) ------------------------ */
.legal h2 {
  margin-top: 2.25rem;
  font-family: "Fraunces", ui-serif, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
}
.legal p,
.legal ul {
  margin-top: 0.85rem;
  line-height: 1.75;
  color: rgba(27, 36, 32, 0.82);
}
.legal ul {
  list-style: disc;
  padding-left: 1.4rem;
}
.legal li + li {
  margin-top: 0.5rem;
}
.legal a {
  color: var(--coral);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-meta {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  color: rgba(27, 36, 32, 0.5) !important;
}
.legal-draft {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: rgba(242, 166, 60, 0.22);
  border: 1px solid rgba(242, 166, 60, 0.6);
  font-size: 0.875rem;
}
.legal-review {
  background: rgba(242, 166, 60, 0.35);
  color: inherit;
  padding: 0 0.3rem;
  border-radius: 0.25rem;
  font-size: 0.85em;
}


/* --- Design pass: focus, cards, hero ------------------------------------ */
:focus-visible {
  outline: 3px solid #f2a63c;
  outline-offset: 3px;
  border-radius: 6px;
}

.card-lift {
  transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.reveal.is-visible.card-lift:hover {
  transform: translateY(-4px);
  border-color: rgba(242, 97, 63, 0.45);
  box-shadow: 0 22px 40px -26px rgba(15, 61, 62, 0.55);
}

.hero-avatars img {
  height: 4.25rem;
  width: 4.25rem;
  border-radius: 9999px;
  object-fit: cover;
  border: 3px solid rgb(var(--surface-rgb));
  margin-left: -1rem;
  background: rgb(var(--surface-rgb));
}

.hero-avatars img:first-child {
  margin-left: 0;
}

.live-dot {
  position: relative;
  display: inline-block;
  height: 0.5rem;
  width: 0.5rem;
  border-radius: 9999px;
  background: rgb(var(--palm-rgb));
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: live-ping 1.8s ease-out infinite;
}

@keyframes live-ping {
  from {
    transform: scale(1);
    opacity: 0.7;
  }
  to {
    transform: scale(2.6);
    opacity: 0;
  }
}

.hero-bubble {
  position: absolute;
  top: -1.4rem;
  right: 0.5rem;
  z-index: 2;
  transform: rotate(4deg);
  border-radius: 1rem 1rem 1rem 0.25rem;
  background: #f2613f;
  color: #fbf6ec;
  padding: 0.55rem 0.95rem;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 14px 28px -14px rgba(15, 61, 62, 0.6);
}

/* Pricing: equal-height price blocks and a lifted featured ticket on wide screens. */
@media (min-width: 1280px) {
  .ticket [data-i18n$=".sub"] {
    min-height: 2.6em;
  }

  .ticket.border-coral {
    translate: 0 -10px;
    box-shadow: 0 26px 46px -28px rgba(242, 97, 63, 0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot::after {
    animation: none;
    opacity: 0;
  }

  .card-lift,
  .reveal.is-visible.card-lift:hover {
    transform: none;
  }
}


/* --- Working state (js/ui-feedback.js): the button that started a request ---------- */
.is-busy {
  pointer-events: none;
  cursor: progress;
  opacity: 0.65;
}

button.is-busy::after,
input.is-busy::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.55em;
  vertical-align: -0.12em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  animation: busy-spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  button.is-busy::after {
    animation-duration: 2.4s;
  }
}
