/* ==========================================================================
   Kingdom of Values School — public site
   One cloth: crest indigo ground, gold thread, counted-stitch grid.
   Layout uses logical properties throughout so Arabic mirrors by itself.
   ========================================================================== */

/* ---------- Fonts (self-hosted, SIL Open Font License) ---------- */
@font-face {
  font-family: "Alexandria";
  src: url("../assets/fonts/alexandria-arabic-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Alexandria";
  src: url("../assets/fonts/alexandria-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --indigo: #2e3192;
  --indigo-deep: #24277a;
  --navy: #141a4f;
  --navy-deep: #0c1136;
  --gold: #ffc629;
  --gold-soft: #ffd75e;
  --gold-deep: #c98f00;
  --cloth: #f4f5fc;
  --cloth-shade: #e6e8f7;
  --white: #ffffff;
  --ink: #151a45;
  --ink-soft: #454c7c;
  --sky: #b9c4ff;
  --danger: #a8231b;
  --danger-tint: #fdecea;
  --success: #17603a;
  --success-tint: #e6f4ec;

  --st: 10px;                       /* one stitch */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --measure: 68ch;
  --radius: 2px;
  --header-h: 4.5rem;

  --font: "Alexandria", "Segoe UI", Tahoma, system-ui, sans-serif;


  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-lift: 0 18px 40px -18px rgba(12, 17, 54, 0.55);
}

@media (max-width: 720px) {
  :root { --st: 8px; --header-h: 4rem; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scrollbar-color: var(--indigo) var(--cloth-shade);
}

body {
  margin: 0;
  background: var(--cloth);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 350;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--indigo);
  accent-color: var(--indigo);
}

[dir="rtl"] body { line-height: 1.95; }

::selection { background: var(--gold); color: var(--navy-deep); }

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, p, ul, ol, dl, dd, figure, blockquote, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; line-height: 1.35; }

p { text-wrap: pretty; }

a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 0.28em; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: var(--radius);
}
.section :focus-visible, .form :focus-visible, .contact :focus-visible { outline-color: var(--indigo); }
.cloth :focus-visible, .days :focus-visible, .site-footer :focus-visible, .site-header :focus-visible { outline-color: var(--gold); }
.values :focus-visible { outline-color: var(--navy-deep); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; inset-block-start: 0.5rem; inset-inline-start: 0.5rem; z-index: 100;
  padding: 0.75rem 1.25rem; background: var(--gold); color: var(--navy-deep);
  font-weight: 700; text-decoration: none; transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.wrap { width: min(100% - 2 * var(--gutter), 78rem); margin-inline: auto; }

.icon { width: 1.25em; height: 1.25em; flex: none; }
[dir="rtl"] .icon--arrow { transform: scaleX(-1); }

.stitch-band { display: block; }

/* ---------- The cloth: indigo ground with the weave showing ---------- */
.cloth {
  position: relative;
  background-color: var(--indigo);
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.085) 1px, transparent 1.4px);
  background-size: var(--st) var(--st);
  color: var(--white);
}

/* ---------- Buttons: patches sewn on with a running stitch ---------- */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 3.25rem; padding: 0.7rem 1.6rem;
  border: 0; border-radius: var(--radius);
  font: inherit; font-weight: 700; line-height: 1.25; text-decoration: none; text-align: center;
  cursor: pointer;
  transition: background-color 0.25s var(--ease-out), color 0.25s var(--ease-out), transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
}
.btn::after {
  content: ""; position: absolute; inset: 5px; border: 1.5px dashed currentColor; opacity: 0.45;
  border-radius: 1px; pointer-events: none; transition: opacity 0.25s var(--ease-out), inset 0.25s var(--ease-out);
}
.btn:hover::after { opacity: 0.9; inset: 4px; }
.btn:active { transform: translateY(1px); }

.btn--gold { background: var(--gold); color: var(--navy-deep); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.7); }
.btn--gold:hover { background: var(--gold-soft); }
.btn--indigo { background: var(--indigo); color: var(--white); box-shadow: 0 12px 26px -16px rgba(20, 26, 79, 0.9); }
.btn--indigo:hover { background: var(--indigo-deep); }
.btn--line { background: rgba(255, 255, 255, 0.08); color: var(--white); }
.btn--line:hover { background: rgba(255, 255, 255, 0.18); }
.btn--outline { background: var(--white); color: var(--indigo); box-shadow: inset 0 0 0 1.5px var(--indigo); }
.btn--outline::after { display: none; }
.btn--outline:hover { background: var(--indigo); color: var(--white); }
.btn--compact { min-height: 2.75rem; padding: 0.5rem 1.15rem; font-size: 0.95rem; }
.btn--large { min-height: 3.75rem; padding-inline: 2.25rem; font-size: 1.1rem; }

.text-link {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; color: var(--indigo);
  text-decoration: underline; text-decoration-style: dashed; text-decoration-color: var(--gold-deep);
  transition: gap 0.25s var(--ease-out), text-decoration-color 0.25s var(--ease-out);
}
.text-link:hover { gap: 0.85rem; text-decoration-style: solid; text-decoration-color: var(--indigo); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; inset-block-start: 0; z-index: 50;
  background: var(--indigo);
  color: var(--white);
  transition: box-shadow 0.3s var(--ease-out), background-color 0.3s var(--ease-out);
}
.site-header.is-stuck { background: var(--indigo-deep); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.8); }
.site-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: var(--header-h); }
/* Arabic labels are short enough to stay on one line down to the menu breakpoint; English may wrap. */
[dir="rtl"] .site-header__bar a { white-space: nowrap; }

.brand { display: inline-flex; align-items: center; gap: 0.8rem; text-decoration: none; font-weight: 800; font-size: 1.15rem; line-height: 1.2; }
/* The crest sits straight on the cloth, in white thread: no tile behind it. */
.brand__patch { display: block; flex: none; height: 3.4rem; aspect-ratio: 427 / 627; }
.brand__patch img { display: block; width: 100%; height: 100%; object-fit: contain; }

.site-nav { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.5rem); }
.site-nav__list { display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 2rem); }
.site-nav__list a {
  display: inline-block; padding-block: 0.6rem; text-decoration: none; font-weight: 500; font-size: 0.98rem;
  border-block-end: 2px dashed transparent; transition: border-color 0.25s var(--ease-out), color 0.25s var(--ease-out);
}
.site-nav__list a:hover { border-block-end-color: rgba(255, 255, 255, 0.6); }
.site-nav__list a[aria-current="page"] { border-block-end-color: var(--gold); color: var(--gold); font-weight: 700; }
.site-nav__end { display: flex; align-items: center; gap: 1rem; }

.lang-switch {
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.5rem 0.2rem;
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
  border-block-end: 2px dashed transparent; transition: border-color 0.25s var(--ease-out);
}
.lang-switch:hover { border-block-end-color: var(--gold); }

.nav-toggle {
  display: none; width: 3rem; height: 3rem; place-items: center;
  background: transparent; border: 1.5px dashed rgba(255, 255, 255, 0.6); border-radius: var(--radius); color: inherit; cursor: pointer;
}
.nav-toggle .icon { width: 1.6rem; height: 1.6rem; }
.nav-toggle__close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__close { display: block; }

@media (max-width: 1000px) {
  .nav-toggle { display: grid; }
  .site-nav {
    position: fixed; inset: var(--header-h) 0 0 0; z-index: 49;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2rem;
    padding: 2rem var(--gutter) 3rem; overflow-y: auto;
    background: var(--navy);
    visibility: hidden; opacity: 0; transform: translateY(-0.75rem);
    transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), visibility 0s linear 0.3s;
  }
  .site-nav.is-open { visibility: visible; opacity: 1; transform: none; transition-delay: 0s; }
  .site-nav__list { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav__list a { display: block; padding-block: 1rem; font-size: 1.5rem; font-weight: 700; border-block-end: 1.5px dashed rgba(255, 255, 255, 0.22); }
  .site-nav__end { flex-direction: column; align-items: stretch; gap: 1.25rem; }
  .lang-switch { font-size: 1.15rem; }
  .site-nav .btn { min-height: 3.5rem; font-size: 1.1rem; }
}

/* ---------- Hero ---------- */
.hero { overflow: hidden; isolation: isolate; display: flex; flex-direction: column; min-height: calc(100svh - var(--header-h)); }
.cloth__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

.hero__inner {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding-block: clamp(2rem, 3.5vw, 3.5rem) clamp(1.5rem, 2.5vw, 2.25rem); flex: 1;
}
.hero__title { font-size: clamp(3rem, 8.6vw, 6rem); font-weight: 900; line-height: 1; letter-spacing: -0.035em; }
[dir="rtl"] .hero__title { line-height: 1.25; letter-spacing: 0; font-size: clamp(3rem, 8.2vw, 5.75rem); }
.hero__lead { margin-block-start: clamp(1.25rem, 2.5vw, 2rem); max-width: 30ch; font-size: clamp(1.2rem, 2vw, 1.55rem); font-weight: 400; line-height: 1.5; }
[dir="rtl"] .hero__lead { line-height: 1.8; }
.hero__tagline { margin-block-start: 0.9rem; color: var(--gold); font-weight: 600; font-size: 1.05rem; }

/* The photo sits in an opening of the embroidery; the canvas stitches the frame in the padding. */
.hero__panel { padding: calc(var(--st) * 8); }
.hero__panel img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 55% 12%; background: var(--indigo-deep); box-shadow: var(--shadow-lift); }
/* Without script the frame is still sewn on. */
.no-cloth .hero__panel { padding: calc(var(--st) * 2); outline: 2px dashed var(--gold); outline-offset: calc(var(--st) * -1); }

.hero__start { padding-block-end: clamp(1.75rem, 3vw, 2.75rem); }
.hero__band { height: calc(var(--st) * 4); margin-block-end: clamp(1.25rem, 2.2vw, 1.75rem); }
.hero__start-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(1.25rem, 3vw, 2.5rem); }
.hero__prompt { font-size: 1.3rem; font-weight: 700; line-height: 1.3; }
.hero__hint { color: var(--sky); font-size: 0.95rem; line-height: 1.5; }

.grades { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.grade {
  display: grid; place-items: center; min-width: 3.25rem; height: 3.25rem; padding-inline: 0.7rem;
  background: rgba(12, 17, 54, 0.45); color: var(--white);
  border: 1.5px dashed rgba(255, 255, 255, 0.55); border-radius: var(--radius);
  font-size: 1.75rem; font-weight: 500; line-height: 1; text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.grade:hover, .grade:focus-visible { background: var(--gold); color: var(--navy-deep); border-color: var(--navy-deep); border-style: solid; transform: translateY(-3px); }

@media (max-width: 1000px) {
  .hero__inner { grid-template-columns: 1fr; }
  .hero__panel { padding: calc(var(--st) * 6); max-width: 34rem; margin-inline: auto; width: 100%; }
  .hero__panel img { aspect-ratio: 4 / 3; }
  .hero__start-row { grid-template-columns: 1fr; }
  .hero__start-row .btn { justify-self: start; }
}
@media (max-width: 520px) {
  .hero__panel { padding: calc(var(--st) * 5); }
  .grade { min-width: 2.9rem; height: 2.9rem; }
  .hero__start-row .btn { justify-self: stretch; }
}

/* ---------- Sections ---------- */
.section { padding-block: clamp(4rem, 9vw, 7.5rem); }
.section--tint { background: var(--cloth-shade); }
.section__title { font-size: clamp(2rem, 4.6vw, 3.5rem); color: var(--indigo); }
.section__lead { margin-block-start: 1.25rem; max-width: 46ch; font-size: 1.15rem; color: var(--ink-soft); }

/* What we teach: a thread of programmes, not a row of cards */
.teach__grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
.teach__intro { position: sticky; inset-block-start: calc(var(--header-h) + 2rem); }
.teach__intro .text-link { margin-block-start: 1.75rem; }
.thread {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 1.5rem; align-items: center;
  padding-block: 1.6rem; border-block-end: 2px dashed rgba(46, 49, 146, 0.28);
}
.thread:first-child { padding-block-start: 0; }
.thread__glyph { width: 3.5rem; height: 3.5rem; color: var(--gold-deep); transition: color 0.3s var(--ease-out), transform 0.5s var(--ease-out); }
.thread:hover .thread__glyph { color: var(--indigo); transform: rotate(90deg); }
.thread__name { font-size: clamp(1.3rem, 2.4vw, 1.8rem); font-weight: 700; color: var(--ink); }
.thread__line { margin-block-start: 0.35rem; color: var(--ink-soft); }
@media (max-width: 860px) {
  .teach__grid { grid-template-columns: 1fr; }
  .teach__intro { position: static; }
  .thread { grid-template-columns: 2.75rem minmax(0, 1fr); gap: 1.1rem; }
  .thread__glyph { width: 2.75rem; height: 2.75rem; }
}

/* From our days: a rail of photographs on navy */
.days { background: var(--navy); color: var(--white); padding-block-end: clamp(3rem, 6vw, 5rem); }
.days .section__title { color: var(--white); }
.days .section__lead { color: var(--sky); }
.days__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem 3rem; }
.days__head .section__lead { margin: 0; }
.days__rail {
  display: flex; gap: clamp(1.5rem, 3vw, 2.5rem);
  margin-block-start: clamp(2rem, 4vw, 3.5rem);
  padding: 1rem var(--gutter) 2rem; padding-inline-start: max(var(--gutter), calc((100vw - 78rem) / 2));
  overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter);
  scrollbar-color: var(--gold) transparent; scrollbar-width: thin;
}
.days__item { flex: none; scroll-snap-align: start; padding: 0.6rem; outline: 2px dashed var(--gold); outline-offset: -2px; background: rgba(255, 255, 255, 0.04); }
.days__item img { height: clamp(15rem, 34vw, 26rem); width: auto; max-width: 82vw; object-fit: cover; }
.days__empty { margin-block-start: 2rem; color: var(--sky); }

/* What we stand on: a full field of gold */
.values { background: var(--gold); color: var(--navy-deep); }
.values .section__title { color: var(--navy-deep); }
.values__list { margin-block-start: clamp(2rem, 4vw, 3.5rem); border-block-start: 2px dashed rgba(12, 17, 54, 0.55); }
.values__item {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: baseline; gap: 0.5rem 3rem;
  padding-block: clamp(1.1rem, 2.4vw, 1.9rem); border-block-end: 2px dashed rgba(12, 17, 54, 0.55);
  transition: padding-inline-start 0.4s var(--ease-out);
}
.values__item:hover { padding-inline-start: 1rem; }
.values__name { font-size: clamp(1.6rem, 4.2vw, 3.1rem); font-weight: 800; }
.values__line { font-size: 1.1rem; font-weight: 450; color: #2a2a5a; }
@media (max-width: 760px) { .values__item { grid-template-columns: 1fr; } }

/* From the director */
.letter__grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.letter__quote blockquote p { font-size: clamp(1.45rem, 3vw, 2.3rem); font-weight: 300; line-height: 1.45; color: var(--ink); }
[dir="rtl"] .letter__quote blockquote p { line-height: 1.8; }
.letter__quote figcaption { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-block: 1.75rem 1.5rem; color: var(--ink-soft); }
.letter__name { font-weight: 700; color: var(--ink); }
@media (max-width: 860px) { .letter__grid { grid-template-columns: 1fr; } }

/* Closing call */
.close { text-align: center; }
.close__title { font-size: clamp(2.2rem, 6vw, 4.5rem); font-weight: 900; }
.close__lead { margin: 1.25rem auto 0; max-width: 40ch; font-size: 1.2rem; color: var(--sky); }
.close__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-block-start: 2.5rem; }

/* ---------- Inner pages ---------- */
.page-head__inner { padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 5vw, 4rem); }
.page-head__title { font-size: clamp(2.6rem, 7vw, 5rem); font-weight: 900; max-width: 16ch; }
.page-head__lead { margin-block-start: 1.25rem; max-width: 44ch; font-size: clamp(1.1rem, 1.8vw, 1.35rem); color: var(--sky); }
.page-head__band { color: var(--gold); margin-block-end: calc(var(--st) * 1.5); }
.page-head { padding-block-end: 1px; }

.prose { max-width: var(--measure); }
.prose > * + * { margin-block-start: 1.25em; }
.prose--large { font-size: clamp(1.15rem, 1.8vw, 1.4rem); line-height: 1.65; }
[dir="rtl"] .prose--large { line-height: 1.95; }
.prose .section__title { margin-block-end: 0.2em; }

/* A photograph sewn on like a patch */
.patch { padding: 0.75rem; background: var(--white); outline: 2px dashed var(--gold-deep); outline-offset: -2px; box-shadow: var(--shadow-lift); }
.patch img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.about-intro__grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.pair__grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.pair__grid + .pair__grid { margin-block-start: clamp(3rem, 7vw, 6rem); }
.pair__grid--flip { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); }
.pair__grid--flip .patch { order: 2; }
.knights__grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
@media (max-width: 860px) {
  .about-intro__grid, .pair__grid, .pair__grid--flip, .knights__grid { grid-template-columns: 1fr; }
  .pair__grid--flip .patch { order: 0; }
}

/* Director's letter */
.letter-full__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 18rem); gap: clamp(2rem, 6vw, 6rem); align-items: start; }
.prose--letter { font-size: 1.15rem; }
.letter-full__opening { font-size: 1.5rem; font-weight: 700; color: var(--indigo); }
.signature { position: sticky; inset-block-start: calc(var(--header-h) + 2rem); padding-block-start: 1.5rem; border-block-start: 2px dashed var(--gold-deep); color: var(--ink-soft); }
.signature__glyph { width: 3rem; height: 3rem; color: var(--gold-deep); margin-block-end: 1rem; }
.signature__name { font-size: 1.35rem; font-weight: 800; color: var(--ink); }
@media (max-width: 860px) { .letter-full__grid { grid-template-columns: 1fr; } .signature { position: static; } }

/* Contact */
.contact__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.5rem, 6vw, 6rem); align-items: start; }
.contact__number { margin-block: 0.75rem 1.75rem; font-size: clamp(3rem, 8vw, 5.5rem); font-weight: 500; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 1rem; }
.contact__list > div { padding-block: 1.4rem; border-block-end: 2px dashed rgba(46, 49, 146, 0.28); }
.contact__list > div:first-child { padding-block-start: 0; }
.contact__list dt { font-weight: 700; color: var(--indigo); }
.contact__list dd { margin-block-start: 0.3rem; font-size: 1.1rem; }
.contact__list dd .text-link { display: flex; width: fit-content; margin-block-start: 0.6rem; font-size: 1rem; }
.contact__social { display: flex; flex-wrap: wrap; gap: 0.5rem 1.75rem; }
.contact__social a { display: inline-flex; align-items: center; gap: 0.5rem; }
@media (max-width: 860px) { .contact__grid { grid-template-columns: 1fr; } }

/* Vacancies */
.vacancies__list { display: grid; gap: clamp(2rem, 4vw, 3rem); }
.vacancy { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: center; padding-block-end: clamp(2rem, 4vw, 3rem); border-block-end: 2px dashed rgba(46, 49, 146, 0.28); }
.vacancy__image img { aspect-ratio: auto; }
.vacancy__title { font-size: clamp(1.6rem, 3.5vw, 2.5rem); margin-block-end: 1.25rem; }
.vacancies__empty { margin-block-end: 1.5rem; font-size: 1.2rem; }
@media (max-width: 720px) { .vacancy { grid-template-columns: 1fr; } }

/* ---------- Forms ---------- */
.form-page__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.form-page__grid--single { grid-template-columns: minmax(0, 52rem); }
.form-page__aside { position: sticky; inset-block-start: calc(var(--header-h) + 2rem); display: grid; gap: 1.25rem; color: var(--ink-soft); }
@media (max-width: 960px) { .form-page__grid { grid-template-columns: 1fr; } .form-page__aside { position: static; order: 2; } }

.form { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }
.form__legend { float: inline-start; width: 100%; padding: 0 0 0.9rem; margin-block-end: 1.75rem; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; color: var(--indigo); border-block-end: 2px dashed var(--gold-deep); }
.form__legend + * { clear: both; }
.form__note { margin-block-end: 1.5rem; color: var(--ink-soft); max-width: 60ch; }
.form__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1.75rem; }
@media (max-width: 640px) { .form__fields { grid-template-columns: 1fr; } }

.field { display: grid; gap: 0.45rem; align-content: start; }
.field__label { font-weight: 600; font-size: 0.98rem; }
.field__req { color: var(--danger); font-weight: 800; }
.field__opt { color: var(--ink-soft); font-weight: 400; font-size: 0.88rem; }
.field__control {
  width: 100%; min-height: 3.25rem; padding: 0.7rem 0.95rem;
  background: var(--white); color: var(--ink);
  border: 1.5px solid rgba(46, 49, 146, 0.45); border-radius: var(--radius);
  font: inherit; font-weight: 400; line-height: 1.4;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.field__control::placeholder { color: #5b6190; }
.field__control:hover { border-color: var(--indigo); }
.field__control:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; border-color: var(--indigo); }
.field__control[dir="ltr"] { text-align: start; }
[dir="rtl"] .field__control[dir="ltr"] { text-align: end; }
select.field__control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e3192' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 1.2rem; background-position: right 0.85rem center; padding-inline-end: 2.75rem;
}
[dir="rtl"] select.field__control { background-position: left 0.85rem center; }
input[type="file"].field__control { padding: 0.55rem; }
input[type="file"].field__control::file-selector-button { margin-inline-end: 0.9rem; padding: 0.5rem 0.9rem; border: 0; border-radius: var(--radius); background: var(--cloth-shade); color: var(--indigo); font: inherit; font-weight: 600; cursor: pointer; }
.field__hint { font-size: 0.88rem; color: var(--ink-soft); line-height: 1.5; }
.field__error { font-size: 0.92rem; font-weight: 600; color: var(--danger); line-height: 1.5; }
.field--error .field__control { border-color: var(--danger); background: var(--danger-tint); }

/* Segmented choices: each option a square of cloth */
.seg { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.seg__item { position: relative; flex: 1 1 auto; cursor: pointer; }
.seg__item input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg__item span {
  display: grid; place-items: center; min-height: 3rem; padding: 0.5rem 1rem;
  background: var(--white); border: 1.5px dashed rgba(46, 49, 146, 0.55); border-radius: var(--radius);
  font-weight: 500; text-align: center; line-height: 1.3;
  transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.seg__item:hover span { border-color: var(--indigo); background: var(--cloth-shade); }
.seg__item input:checked + span { background: var(--indigo); color: var(--white); border-style: solid; border-color: var(--indigo); font-weight: 700; }
.seg__item input:focus-visible + span { outline: 3px solid var(--indigo); outline-offset: 3px; }

.questions { display: grid; gap: 1.75rem; counter-reset: q; }
.question { counter-increment: q; display: grid; gap: 0.8rem; padding-block-end: 1.75rem; border-block-end: 2px dashed rgba(46, 49, 146, 0.2); }
.question:last-child { border: 0; padding-block-end: 0; }
.question__text { font-weight: 600; font-size: 1.08rem; }
.question__text::before { content: counter(q) ". "; font-size: 1.4em; font-weight: 500; color: var(--gold-deep); }
@media (max-width: 520px) { .seg--wide .seg__item { flex-basis: 30%; } .seg--wide .seg__item span { padding-inline: 0.4rem; font-size: 0.95rem; } }

.form__submit { display: flex; }
@media (max-width: 520px) { .form__submit .btn { width: 100%; } }

.notice { display: flex; gap: 1.1rem; align-items: flex-start; padding: 1.5rem 1.6rem; border-radius: var(--radius); }
.notice > .icon { width: 2rem; height: 2rem; margin-block-start: 0.2rem; }
.notice__title { font-size: 1.35rem; margin-block-end: 0.4rem; }
.notice ul { list-style: disc; padding-inline-start: 1.25rem; }
.notice .text-link { margin-block-start: 1rem; }
.notice--success { background: var(--success-tint); color: var(--success); outline: 2px dashed var(--success); outline-offset: -6px; padding: 2.25rem; }
.notice--success .notice__title { color: var(--success); }
.notice--error { background: var(--danger-tint); color: var(--danger); outline: 2px dashed var(--danger); outline-offset: -6px; }
.notice--error .notice__title { color: var(--danger); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy-deep); color: #d6dbff; font-size: 0.98rem; }
.site-footer__band { color: var(--gold); opacity: 0.9; }
.site-footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr 0.8fr; gap: clamp(2rem, 4vw, 4rem); padding-block: clamp(3rem, 6vw, 5rem) 2.5rem; }
.site-footer__name { font-size: 1.5rem; font-weight: 800; color: var(--white); line-height: 1.3; }
.site-footer__tagline { margin-block-start: 0.75rem; color: var(--gold); font-weight: 600; }
.site-footer__title { font-size: 1rem; font-weight: 700; color: var(--white); letter-spacing: 0; margin-block-end: 0.9rem; }
.site-footer__links { display: grid; gap: 0.15rem; }
.site-footer__links a { display: inline-flex; align-items: center; gap: 0.6rem; padding-block: 0.4rem; text-decoration: none; transition: color 0.2s var(--ease-out); }
.site-footer__links a:hover { color: var(--gold); text-decoration: underline dashed; }
.site-footer__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.25rem 2rem; border-block-start: 1.5px dashed rgba(255, 255, 255, 0.22); font-size: 0.88rem; color: #aab2e8; }
@media (max-width: 900px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .site-footer__grid { grid-template-columns: 1fr; } }

.wa-float {
  position: fixed; inset-block-end: 1.25rem; inset-inline-end: 1.25rem; z-index: 40;
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem;
  background: var(--gold); color: var(--navy-deep); border-radius: var(--radius);
  outline: 1.5px dashed var(--navy-deep); outline-offset: -5px;
  box-shadow: 0 14px 30px -12px rgba(12, 17, 54, 0.7);
  transition: transform 0.25s var(--ease-out), background-color 0.25s var(--ease-out);
}
.wa-float .icon { width: 1.75rem; height: 1.75rem; }
.wa-float:hover { transform: translateY(-3px); background: var(--gold-soft); }
.wa-float:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .site-header, .wa-float, .close, .site-footer__band { display: none; }
  .cloth { background: none; color: #000; }
}

/* The floating WhatsApp button waits until the hero's own actions have scrolled away. */
.has-hero .wa-float { opacity: 0; visibility: hidden; transform: translateY(1rem); transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out), visibility 0s linear 0.3s, background-color 0.25s var(--ease-out); }
.has-hero .wa-float.is-visible { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

/* Keep the ten grade stitches on one line beside the question on wide screens. */
@media (min-width: 1001px) {
  .hero__ask { max-width: 16rem; }
  .grades { flex-wrap: nowrap; justify-content: center; }
  .grade { min-width: 0; flex: 1 1 2.75rem; max-width: 3.5rem; padding-inline: 0.4rem; }
  .grades li { flex: 1 1 2.75rem; max-width: 3.5rem; display: flex; }
  .grades li:first-child, .grades li:first-child .grade { flex: 0 0 auto; max-width: none; padding-inline: 0.5rem; }
  .hero__inner { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
}

/* Phones and tablets: the hero stacks. Order is set in the last block of this file (headline, photograph, grade question). */
@media (max-width: 1000px) {
  .hero { min-height: 0; }
  .hero__inner { display: contents; }
  .hero__copy, .hero__panel { width: min(100% - 2 * var(--gutter), 78rem); margin-inline: auto; }
  .hero__copy { order: 1; padding-block: clamp(2rem, 7vw, 3.5rem) 1.75rem; }
  .hero__start { order: 2; padding-block-end: 1.5rem; }
  .hero__panel { order: 3; margin-block-end: clamp(2rem, 6vw, 3rem); }
}

/* Rail photos keep their place while they load. */
.days__item img { min-width: 14rem; background: rgba(255, 255, 255, 0.06); }

/* Form pages carry their own WhatsApp button; the floating one would sit on the fields. */
body:has(.form) .wa-float { display: none; }

/* Director's portrait (shown once config/site.php names the file). */
.letter__photo { margin-block-start: 1.75rem; max-width: 17rem; }
.letter__photo img, .signature__photo img { aspect-ratio: 4 / 5; object-position: 50% 20%; }
.signature__photo { margin-block-end: 1.25rem; }

/* A value the form shows but the visitor cannot change. */
.field__static { min-height: 3.25rem; display: flex; align-items: center; padding: 0.7rem 0.95rem; background: var(--cloth-shade); border: 1.5px dashed rgba(46, 49, 146, 0.45); border-radius: var(--radius); font-weight: 600; }

/* ==========================================================================
   Stitches everywhere: frames and dividers are sewn from the same cross as
   the hero, on the same grid unit (--st), instead of dashed lines.
   ========================================================================== */
:root {
  --x-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 2l6 6m0-6l-6 6' fill='none' stroke='%23ffc629' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --x-indigo-soft: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 2l6 6m0-6l-6 6' fill='none' stroke='%23a3a8e0' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --x-navy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M2 2l6 6m0-6l-6 6' fill='none' stroke='%230c1136' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --x9-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M2 2l6 6m0-6l-6 6M12 2l6 6m0-6l-6 6M22 2l6 6m0-6l-6 6M2 12l6 6m0-6l-6 6M22 12l6 6m0-6l-6 6M2 22l6 6m0-6l-6 6M12 22l6 6m0-6l-6 6M22 22l6 6m0-6l-6 6' fill='none' stroke='%23ffc629' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --x9-indigo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M2 2l6 6m0-6l-6 6M12 2l6 6m0-6l-6 6M22 2l6 6m0-6l-6 6M2 12l6 6m0-6l-6 6M22 12l6 6m0-6l-6 6M2 22l6 6m0-6l-6 6M12 22l6 6m0-6l-6 6M22 22l6 6m0-6l-6 6' fill='none' stroke='%232e3192' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  --zigzag-gold: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='40' viewBox='0 0 60 40'%3E%3Cpath d='M32 2l6 6m0-6l-6 6M22 12l6 6m0-6l-6 6M42 12l6 6m0-6l-6 6M12 22l6 6m0-6l-6 6M52 22l6 6m0-6l-6 6M2 32l6 6m0-6l-6 6' fill='none' stroke='%23ffc629' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* A row of crosses along the bottom edge of an element. */
.thread, .values__item, .contact__list > div, .vacancy, .form__legend, .question, .values__list {
  border: 0;
  background-image: var(--x-indigo-soft);
  background-size: var(--st) var(--st);
  background-repeat: repeat-x;
  background-position: left bottom;
}
.thread { padding-block-end: calc(1.6rem + var(--st)); }
.contact__list > div { padding-block-end: calc(1.4rem + var(--st)); }
.vacancy { padding-block-end: calc(clamp(2rem, 4vw, 3rem) + var(--st)); }
.question { padding-block-end: calc(1.75rem + var(--st)); }
.question:last-child { background-image: none; }
.form__legend { background-image: var(--x-gold); padding-block-end: calc(0.9rem + var(--st)); }
.values__list { background-image: var(--x-navy); background-position: left top; padding-block-start: var(--st); }
.values__item { background-image: var(--x-navy); padding-block-end: calc(clamp(1.1rem, 2.4vw, 1.9rem) + var(--st)); }
.signature { border: 0; background: var(--x-gold) left top / var(--st) var(--st) repeat-x; padding-block-start: calc(1.5rem + var(--st)); }

/* Photographs are sewn on with a ring of crosses. */
.patch, .days__item {
  padding: calc(var(--st) * 0.6);
  outline: 0;
  background: none;
  border: var(--st) solid transparent;
  border-image: var(--x9-indigo) 10 / var(--st) round;
  box-shadow: none;
}
.patch img { box-shadow: var(--shadow-lift); }
.days__item { border-image-source: var(--x9-gold); }

/* The band under every inner-page heading follows the grid unit on every screen. */
.page-head__band { height: calc(var(--st) * 4); background: var(--zigzag-gold) left top / calc(var(--st) * 6) calc(var(--st) * 4) repeat-x; }

/* Numerals in the page's own face, tabular, so 10 never reads as 18. */
.grade, .contact__number, .question__text::before { font-family: var(--font); font-variant-numeric: tabular-nums; }
.grade { font-size: 1.15rem; font-weight: 700; }
.contact__number { font-weight: 800; letter-spacing: -0.02em; font-size: clamp(2.6rem, 7vw, 4.75rem); }
.question__text::before { font-size: 1em; font-weight: 800; color: var(--indigo); }
.hero__title { letter-spacing: -0.015em; }
[dir="rtl"] .hero__title { letter-spacing: 0; }
.hero__hint { margin-block-start: 0.4rem; }

/* The contact page has its own WhatsApp button too. */
body:has(.contact) .wa-float { display: none; }

/* Technology in the classroom */
.tech { background: var(--cloth-shade); }
.tech__grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(2rem, 6vw, 6rem); align-items: center; }
.tech__quote { margin-block-start: 1.5rem; font-size: clamp(1.25rem, 2.2vw, 1.7rem); font-weight: 300; line-height: 1.5; color: var(--ink); }
[dir="rtl"] .tech__quote { line-height: 1.85; }
.tech__source { margin-block-start: 1rem; color: var(--ink-soft); }
@media (max-width: 860px) { .tech__grid { grid-template-columns: 1fr; } }

/* Phones: headline, then the sewn photograph, then the grade question. */
@media (max-width: 1000px) {
  .hero__copy { padding-block: 1.5rem 1.1rem; }
  .hero__panel { order: 2; padding: calc(var(--st) * 3); margin-block-end: 1.25rem; }
  .hero__panel img { aspect-ratio: 4 / 3; }
  .hero__start { order: 3; }
  .hero__band { margin-block-end: 1rem; }
}
@media (max-width: 520px) {
  .hero__lead { margin-block-start: 0.9rem; font-size: 1.1rem; }
  .hero__tagline { margin-block-start: 0.5rem; font-size: 0.98rem; }
}
