/* ===========================================================================
   Aratus Academy — page shell: container, header, navigation, footer.
   =========================================================================== */

.wrap {
  inline-size: min(var(--max), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.wrap-narrow { inline-size: min(var(--max-narrow), calc(100% - var(--gutter) * 2)); margin-inline: auto; }
.wrap-wide { inline-size: min(var(--max-wide), calc(100% - var(--gutter) * 2)); margin-inline: auto; }

.site-main { display: block; min-block-size: 50vh; }

/* ---- header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-header);
  border-block-end: 1px solid transparent;
  background: rgba(66, 16, 24, 0.78);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header { background: color-mix(in srgb, var(--bg) 78%, transparent); }
}

.site-header.is-scrolled {
  border-block-end-color: var(--line);
  background: rgba(66, 16, 24, 0.92);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-block-size: var(--header-h);
  inline-size: min(var(--max), calc(100% - var(--gutter) * 2));
  margin-inline: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: 0 1 auto;
  min-inline-size: 0;
  min-block-size: var(--tap);
}

.brand-mark {
  /* A seal carries more detail than the old line mark, so it is drawn larger. */
  inline-size: 44px;
  block-size: 44px;
  flex: none;
  /* The mark is a compass drawn to the edge of its canvas with transparency
     around it. `contain` keeps the full figure visible; `cover` cropped the
     north and south points off. No disc or border behind it either — the logo
     is a line drawing and a ring around it reads as two competing circles. */
  object-fit: contain;
  aspect-ratio: 1;
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-inline-size: 0;
}

.brand-name strong {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-name span {
  font-size: 0.64rem;
  color: var(--muted);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: var(--case-eyebrow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[lang="ckb"] .brand-name strong { letter-spacing: 0; }
[lang="ckb"] .brand-name span { font-size: 0.78rem; }

/* Desktop nav is hidden on small screens; the drawer carries it instead. */
.nav-links { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
}

/* Buttons in the header are drawer-only until there is room for them. */
.header-actions .btn { display: none; }

.menu-btn { display: grid; }

/* ---- mobile drawer -------------------------------------------------------- */

.mobile-nav { display: none; }

.mobile-nav.is-open {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5) var(--gutter) var(--sp-7);
  border-block-end: 1px solid var(--line);
  background: var(--bg);
  max-block-size: calc(100dvh - var(--header-h));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mobile-nav a {
  display: flex;
  align-items: center;
  min-block-size: var(--tap);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--muted);
  border-block-end: 1px solid var(--line);
  padding-block: var(--sp-2);
}

.mobile-nav a:last-of-type { border-block-end: 0; }
.mobile-nav a:hover,
.mobile-nav a.is-active { color: var(--ink); }

.mobile-nav .btn { margin-block-start: var(--sp-3); }
.mobile-nav form { margin: 0; }

/* ---- footer --------------------------------------------------------------- */

.site-footer {
  border-block-start: 1px solid var(--line);
  padding-block: var(--sp-9) var(--sp-7);
  background: var(--bg-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-7);
}

.footer-quote {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.35;
  max-width: 20ch;
}

[lang="ckb"] .footer-quote { font-style: normal; }

.footer-addr {
  margin-block-start: var(--sp-4);
  color: var(--dim);
  font-size: 0.88rem;
}

.footer-col h4 {
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: var(--case-eyebrow);
  color: var(--gold);
  margin-block-end: var(--sp-4);
}

[lang="ckb"] .footer-col h4 { font-size: 0.95rem; }

.footer-col a,
.footer-col p {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  margin-block-end: var(--sp-2);
}

/* Footer links are primary navigation on mobile — keep them thumb-sized. */
.footer-col a {
  min-block-size: var(--tap);
  display: flex;
  align-items: center;
}

.footer-col a:hover { color: var(--ink); }

.news-form {
  display: grid;
  gap: var(--sp-2);
  margin-block-start: var(--sp-3);
}

.news-form label {
  color: var(--muted);
  font-size: 0.86rem;
}

.news-form input {
  inline-size: 100%;
  min-block-size: var(--tap);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  outline: none;
}

.news-form input:focus { border-color: var(--gold); }
.news-form .btn { min-block-size: var(--tap); inline-size: 100%; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--sp-3) var(--sp-4);
  margin-block-start: var(--sp-8);
  padding-block-start: var(--sp-5);
  border-block-start: 1px solid var(--line);
  color: var(--dim);
  font-size: 0.82rem;
}

.footer-bottom nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
}

.footer-bottom nav a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--tap);
}

/* ---- breakpoints ---------------------------------------------------------- */

@media (min-width: 600px) {
  .brand-mark { inline-size: 52px; block-size: 52px; }
  .brand-name strong { font-size: 1.18rem; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-quote { font-size: 1.55rem; }
  .news-form .btn { inline-size: auto; justify-self: start; padding-inline: var(--sp-6); }
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    flex-wrap: wrap;
    min-inline-size: 0;
  }

  .nav-links a {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--tap);
    color: var(--muted);
    font-size: 0.92rem;
    transition: color var(--dur-fast) var(--ease);
  }

  .nav-links a:hover,
  .nav-links a.is-active { color: var(--ink); }

  .nav-links a.is-active { color: var(--gold-2); }

  .header-actions .btn { display: inline-flex; }

  /* Scoped with .icon-btn deliberately. The button carries both classes, and
     components.css — which loads after this file — sets `.icon-btn { display:
     grid }` at the same specificity, so a bare `.menu-btn` rule here loses the
     cascade and the burger stays visible on desktop, where tapping it does
     nothing because .mobile-nav is hidden at this width. */
  .icon-btn.menu-btn { display: none; }
  .mobile-nav.is-open { display: none; }

  .footer-grid {
    grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
    gap: var(--sp-8);
  }
}

@media (min-width: 1200px) {
  .nav-links { gap: var(--sp-6); }
}

/* ---------------------------------------------------------------------------
   Sign up in the header
   ---------------------------------------------------------------------------
   Three buttons (Sign in / Sign up / Subscribe) plus the language toggle is a
   lot of width. Sign up is the one a returning visitor never needs, so it is
   the first to go when the bar gets tight — it stays reachable in the mobile
   menu and the footer.
   --------------------------------------------------------------------------- */

.header-signup { display: none; }

/* Signed-in counterpart: Sign out follows the same rule. Below 1040px it
   would wrap the navigation; the account menu and the phone menu carry it. */
.header-signout { display: none; }

@media (min-width: 1040px) {
  .header-signup { display: inline-flex; }
  .header-signout { display: block; }
}
