/* aincient-labs.com — shared chrome (DECISIONS 0490): face, tokens, base, masthead, nav, footer.
   Every page loads this first; the page's own sheet (monograph.css, prose.css) follows. */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
  src: url(../fonts/plex-sans-latin.woff2) format("woff2");
}

:root {
  --paper: #FFFFFF;
  --ink: #0D0D0D;
  --ink-2: #2B2B2B;
  --grey: #636363;
  --hair: #E0DED9;
  --well: #F3F1EC;
  --mark: #C2452A;
  --mark-ink: #FFFFFF;
  --btn: #0D0D0D;
  --btn-ink: #FFFFFF;

  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --col: clamp(340px, 30vw, 470px);
  --pad: clamp(24px, 2.6vw, 44px);
  --gutter: 16px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121110;
    --ink: #F2F0EC;
    --ink-2: #D4D0C9;
    --grey: #A39E96;
    --hair: #2C2A27;
    --well: #1B1A18;
    --btn: #F2F0EC;
    --btn-ink: #121110;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; -webkit-tap-highlight-color: color-mix(in srgb, var(--mark) 16%, transparent); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
[hidden] { display: none !important; }
::selection { background: var(--mark); color: var(--mark-ink); }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 3px; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .22em; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
a:hover { text-decoration-color: currentColor; }

h1, h2, h3, h4 { font-weight: 500; margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
code { font-family: var(--mono); font-size: .88em; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--btn); color: var(--btn-ink); padding: 10px 14px; text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- Masthead: lockup + nav. Wide-screen position is the page's call ---------- */
.brand { display: inline-block; text-decoration: none; }
.brand img { height: 30px; width: auto; }
.nav { margin-top: 18px; }
.nav-menu { display: grid; grid-template-columns: 1fr; font-size: 15px; max-width: 300px; border-bottom: 1px solid var(--hair); }
.nav-menu a { color: var(--grey); text-decoration: none; padding: 5px 0; border-top: 1px solid var(--hair); }
.nav-menu a:hover { color: var(--ink); }
.nav-toggle { display: none; }

/* ---------- Footer ---------- */
.foot {
  max-width: 1920px; margin: 0 auto;
  border-top: 1px solid var(--hair);
  padding: 22px var(--pad) 36px;
  padding-left: max(var(--pad), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad), env(safe-area-inset-right, 0px));
  display: grid; grid-template-columns: var(--col) 1fr; gap: 10px 0;
  font-size: 14px; color: var(--grey);
}
.foot strong { color: var(--ink); font-weight: 600; }
.foot p:first-child { padding-right: var(--pad); }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.foot-links a { color: var(--ink-2); text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; }
.foot-legal { grid-column: 2; }

@media (max-width: 960px) {
  :root { --pad: 20px; }
  .masthead {
    position: sticky; top: 0; left: 0; width: auto;
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px max(var(--gutter), env(safe-area-inset-right, 0px)) 12px max(var(--gutter), env(safe-area-inset-left, 0px));
    background: var(--paper); border-bottom: 1px solid var(--hair);
    z-index: 20;
  }
  .brand { padding: 9px 0; }
  .brand img { height: 26px; }
  .nav { margin: 0; }
  .nav-toggle {
    display: grid; place-items: center; width: 44px; height: 44px; margin-right: -10px;
    background: none; border: 0; color: var(--ink); cursor: pointer;
  }
  .nav-toggle .nav-toggle-close { display: none; }
  .nav[data-open="true"] .nav-toggle-open { display: none; }
  .nav[data-open="true"] .nav-toggle-close { display: block; }
  .nav-menu {
    position: absolute; left: 0; right: 0; top: 100%;
    display: none; flex-direction: column; gap: 0;
    background: var(--paper); border-bottom: 1px solid var(--ink);
    padding: 4px max(var(--gutter), env(safe-area-inset-right, 0px)) 12px max(var(--gutter), env(safe-area-inset-left, 0px));
  }
  .nav[data-open="true"] .nav-menu { display: flex; }
  .nav-menu { grid-template-columns: 1fr; max-width: none; border-bottom: 1px solid var(--ink); }
  .nav-menu a { color: var(--ink); font-size: 17px; padding: 12px 0; border-top: 0; border-bottom: 1px solid var(--hair); }
  .nav-menu a:last-child { border-bottom: 0; }
  .foot { grid-template-columns: 1fr; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
  .foot-legal { grid-column: 1; }
}

/* Phones on their side: the bar scrolls away instead of taking a fifth of a 390px-tall screen. */
@media (max-width: 960px) and (max-height: 500px) {
  .masthead { position: relative; }
}

/* Touch: footer links get a full-height tap row. */
@media (pointer: coarse) {
  .foot-links { gap: 0 20px; }
  .foot-links a { padding: 11px 0; }
}

@media (min-width: 961px) and (max-height: 860px) {
  .brand img { height: 26px; }
  .nav { margin-top: 12px; }
  .nav-menu { font-size: 14px; }
  .nav-menu a { padding: 2px 0; }
}
