/* ==========================================================
   CRYSTAL HOMESCHOOL: style.css
   CSS = the paint and furniture. It decides colours, sizes, spacing and layout.
   Change the colours in :root below and the whole site updates.
   ========================================================== */

/* ---------- 1. Brand colours and shared settings ---------- */
:root {
  --bg: #F7F9FA;        /* Porcelain White: page background */
  --surface: #EAEFF2;   /* Cool Mist: cards and soft sections */
  --brand: #233D4D;     /* Deep Cobalt Slate: text, headings, footer */
  --cta: #D95D39;       /* Vermilion Clay: buttons that ask for action */
  --accent: #618985;    /* Sage Slate: badges, ticks, subtle borders */

  --cta-dark: #BF4D2C;       /* a darker shade of the button colour for hover */
  --surface-deep: #D9E3E8;   /* a deeper shade of Cool Mist for decoration */
  --card-bg: #FFFFFF;
  --line: rgba(35, 61, 77, 0.16);   /* soft border colour (the brand colour, see-through) */
  --error: #9B2C1F;
  --whatsapp: #25D366;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(35, 61, 77, 0.08), 0 8px 20px rgba(35, 61, 77, 0.08);

  --font-head: "Lora", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

/* ---------- 2. Reset and base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--brand);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1em; }
a { color: inherit; }

/* The "container" keeps content from stretching too wide on big screens */
.container {
  width: min(1040px, 100% - 2rem);
  margin-inline: auto;
}

.center { text-align: center; }

/* Clear, visible outline when someone navigates with the keyboard */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 3px;
}

/* ---------- 3. Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 1.17rem;     /* large bold text keeps white-on-vermilion easy to read */
  font-weight: 700;
  color: #fff;
  background: var(--cta);
  border: 2px solid var(--cta);
  border-radius: 999px;
  padding: 0.65em 1.5em;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover { background: var(--cta-dark); border-color: var(--cta-dark); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: wait; }

.btn-small { font-size: 1rem; padding: 0.45em 1.1em; }

.btn-ghost { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-ghost:hover { background: var(--brand); border-color: var(--brand); color: #fff; }

.btn-whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: var(--brand); }
.btn-whatsapp:hover { background: #1fb858; border-color: #1fb858; color: var(--brand); }

/* ---------- 4. Header ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.3rem;
  text-decoration: none;
}

/* height sets the size; width:auto keeps the logo's real proportions (never stretched) */
.brand-logo { height: 46px; width: auto; display: block; }

.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a { text-decoration: none; font-weight: 600; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Language switch (English / Soomaali) */
.nav a.lang-switch {
  font-size: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2em 0.8em;
}

/* The highlighted version: a filled button so the Somali option is easy to spot */
.nav a.lang-switch.is-highlight {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 700;
}

.nav a.lang-switch.is-highlight:hover { background: #1a2f3b; text-decoration: none; }

/* ---------- 5. Hero ---------- */
.hero { padding: 3.5rem 0 4rem; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.25em 1em;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* A soft sage "highlighter" behind the key word */
.highlight { background: linear-gradient(transparent 62%, rgba(97, 137, 133, 0.35) 62%); }

.lead { font-size: 1.15rem; max-width: 34em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 1.5rem; }

/* Hero picture: the full logo on a card, with two soft shapes behind it */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.art-blob { position: absolute; }

.art-cool {
  width: 200px; height: 200px;
  background: var(--surface-deep);
  border-radius: 58% 42% 55% 45% / 50% 55% 45% 50%;
  top: 0; left: 0;
}

.art-sage {
  width: 150px; height: 150px;
  background: var(--accent);
  opacity: 0.55;
  border-radius: 45% 55% 40% 60% / 55% 45% 55% 45%;
  bottom: 0; right: 0;
}

.logo-card {
  position: relative;
  z-index: 1;
  width: min(320px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 1.4rem 1.2rem;
}

/* height:auto keeps the logo's proportions so it never looks squashed */
.logo-card img { display: block; width: 100%; height: auto; }

/* ---------- 6. Sections and cards ---------- */
.section { padding: 3.5rem 0; }
.section-tint { background: var(--surface); }

.section-title { text-align: center; margin-bottom: 0.4rem; }
.section-intro { text-align: center; max-width: 36em; margin: 0 auto 2rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.4rem;
}

.card p { margin-bottom: 0; }

/* On a tinted section the cards turn white so they still stand out */
.section-tint .card { background: var(--card-bg); box-shadow: var(--shadow); }

/* Programs */
.programs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.program {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
}

.program .tag {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.1em 0.8em;
  margin-bottom: 0.8rem;
}

.ticks { list-style: none; margin: 0; padding: 0; }

.ticks li { position: relative; padding-left: 1.6rem; margin-bottom: 0.5rem; }

.ticks li::before {
  content: "\2713";           /* a tick mark */
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--accent);
}

/* Areas we serve */
.areas {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.area {
  display: block;
  text-decoration: none;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.area:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.area h3 { margin-bottom: 0.2rem; }
.area p { margin: 0; font-size: 0.95rem; }
.area .go { display: inline-block; margin-top: 0.5rem; font-weight: 700; color: var(--accent); }

/* How it works */
.steps-list {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.steps-list li { display: flex; gap: 0.9rem; align-items: flex-start; }
.steps-list p { margin: 0; }

.step-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4rem; height: 2.4rem;
  font-family: var(--font-head);
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border-radius: 50%;
}

/* FAQ: built from <details>, which opens and closes with no JavaScript */
.faq { max-width: 760px; margin: 0 auto; }

.faq details {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.8rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 1rem 3rem 1rem 1.2rem;
  list-style: none;
  position: relative;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--accent);
}

.faq details[open] summary::after { content: "\2212"; }   /* a minus sign */

.faq details p { padding: 0 1.2rem 1rem; margin: 0; }

/* ---------- 7. Footer ---------- */
.site-footer {
  background: var(--brand);
  color: var(--bg);
  padding: 1.8rem 0 5.5rem;   /* extra bottom space so the floating button never covers text */
}

.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; }
.footer-inner p { margin: 0; }
.footer-link { font-weight: 700; }

/* ---------- 8. Floating WhatsApp button ---------- */
.whatsapp-float {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--whatsapp);
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.6rem 1.1rem 0.6rem 0.8rem;
  box-shadow: 0 4px 14px rgba(35, 61, 77, 0.3);
}

.whatsapp-float svg { width: 26px; height: 26px; fill: var(--brand); }
.whatsapp-float:hover { transform: translateY(-1px); }

/* ---------- 9. Consult window (the <dialog>) ---------- */
dialog {
  width: min(460px, 100% - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  background: var(--bg);
  color: var(--brand);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(35, 61, 77, 0.35);
  overflow: auto;
}

/* The dimmed area behind the popup */
dialog::backdrop { background: rgba(35, 61, 77, 0.55); }

.consult-card { position: relative; padding: 2rem 1.6rem 1.6rem; }

.close {
  position: absolute;
  top: 0.6rem; right: 0.8rem;
  width: 2.2rem; height: 2.2rem;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--brand);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.close:hover { background: var(--surface); }

/* Progress dots */
.dots { display: flex; gap: 0.4rem; margin-bottom: 1rem; }

.dot {
  width: 2rem; height: 0.5rem;
  border-radius: 999px;
  background: var(--surface-deep);
}

.dot.is-done { background: var(--accent); }
.dot.is-current { background: var(--cta); }

/* Only the active step is visible */
.step { display: none; }
.step.is-active { display: block; }

.step h2 { outline: none; padding-right: 1.5rem; }

/* Form fields */
.field { margin-bottom: 1rem; }

label { display: block; font-weight: 700; margin-bottom: 0.3rem; }
.optional { font-weight: 400; opacity: 0.75; }

input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--brand);
  background: var(--card-bg);
  border: 1.5px solid rgba(35, 61, 77, 0.4);
  border-radius: 12px;
  padding: 0.65em 0.8em;
}

textarea { resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* aria-invalid is set by script.js when a field has a problem */
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }

.field-error, .form-error {
  color: var(--error);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0.3rem 0 0;
}

.hint { font-size: 0.95rem; margin: 0 0 0.8rem; }
.hint.small { font-size: 0.85rem; margin: 0.3rem 0 0; }

/* Buttons row at the bottom of each step */
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: flex-end; margin-top: 1.4rem; }
.consult-card .btn { font-size: 1.05rem; }

/* Honeypot field: off-screen, never visible */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Small slide-in when the popup opens (skipped for people who prefer less motion) */
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: pop 0.25s ease-out; }
  @keyframes pop {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---------- 10. Phones and small screens ---------- */
@media (max-width: 860px) {
  .nav a { display: none; }   /* keep just the Book button in the header */
  .nav a.lang-switch { display: inline-block; }   /* but always keep the language switch */
}

@media (max-width: 760px) {
  .hero-inner, .programs, .steps-list { grid-template-columns: 1fr; }
  .areas { grid-template-columns: repeat(2, 1fr); }
  .hero-art { order: -1; }
  .brand { font-size: 1.05rem; white-space: nowrap; }
  .brand-logo { height: 38px; }
  .btn-small { white-space: nowrap; }
  .whatsapp-float .label { display: none; }
  .whatsapp-float { padding: 0.65rem; }
}

@media (max-width: 420px) {
  .areas { grid-template-columns: 1fr; }
}

/* Narrow phones: tighten the header so the name, language switch and button all fit */
@media (max-width: 520px) {
  .header-inner { gap: 0.5rem; }
  .brand { font-size: 0.95rem; gap: 0.4rem; }
  .brand-logo { height: 32px; }
  .nav { gap: 0.5rem; }
  .nav a.lang-switch { font-size: 0.8rem; padding: 0.15em 0.6em; }
  .btn-small { font-size: 0.85rem; padding: 0.4em 0.9em; }
}

/* Very narrow phones: the logo alone is enough (the full name is right below in the hero) */
@media (max-width: 420px) {
  .brand span { display: none; }
}