/* ==========================================================================
   layout.css — page chrome shared by every page: skip link, navigation,
   section scaffolding and footer.
   ========================================================================== */

.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-weight: 500;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: var(--nav-h);
  color: var(--ink);
  transition: color 0.35s var(--ease);
}
.nav::before {
  content: ""; position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.nav.is-scrolled::before, .nav.is-open::before { opacity: 1; }
.nav__inner { position: relative; height: 100%; display: flex; align-items: center; gap: 20px; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 1.4rem; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; }
.brand__mark { width: 34px; height: 34px; flex: none; transition: transform 0.8s var(--ease-out); }
.brand:hover .brand__mark { transform: rotate(-30deg); } /* the aperture turns */
.brand__mark .lg-rings { fill: none; stroke: currentColor; }
.brand__mark .lg-gold { fill: none; stroke: var(--logo-gold); }
.brand__mark .lg-fill { fill: var(--logo-gold); }

.nav__links { display: flex; align-items: center; gap: 2px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.nav__links a {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 8px 11px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2);
  transition: color 0.2s, background-color 0.2s;
}
.nav__links a span { color: var(--ink-3); font-size: 0.62rem; transition: color 0.2s; }
.nav__links a:hover { color: var(--ink); background: var(--line); }
.nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active span { color: var(--accent); }
.nav__links .nav__out { align-items: center; }
.nav__links .nav__out .i { width: 12px; height: 12px; margin-left: -2px; color: var(--ink-3); transition: transform 0.3s var(--ease), color 0.2s; }
.nav__links .nav__out:hover .i { transform: translate(2px, -2px); color: var(--accent); }

.nav__actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle .i--moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i--sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i--moon { display: block; }
[data-force-theme] .theme-toggle { display: none; }
.menu-btn { display: none; }

@media (max-width: 1060px) {
  .menu-btn { display: grid; }
  .nav__actions { margin-left: auto; }
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto; height: calc(100svh - var(--nav-h));
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 24px var(--gutter) 40px; margin: 0;
    background: var(--bg);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.3s var(--ease), transform 0.4s var(--ease-out), visibility 0.3s;
    overflow-y: auto;
  }
  .nav.is-open .nav__links { opacity: 1; visibility: visible; transform: none; }
  .nav__links li { border-bottom: 1px solid var(--line); }
  .nav__links a {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 16px 0; border-radius: 0;
    font-family: var(--font-serif); font-size: 2.1rem; letter-spacing: -0.01em; text-transform: none;
    color: var(--ink);
  }
  .nav__links a span { order: 2; font-family: var(--font-mono); font-size: 0.75rem; }
  .nav__links a:hover { background: transparent; color: var(--accent); }
  .nav__links .nav__out .i { display: none; }
  .menu-btn .i--close { display: none; }
  .nav.is-open .menu-btn .i--menu { display: none; }
  .nav.is-open .menu-btn .i--close { display: block; }
}

/* ---------- Sections ---------- */
.section { position: relative; padding-block: clamp(64px, 8vw, 112px); }
.section + .section { border-top: 1px solid var(--line); }

.section-head {
  display: grid;
  grid-template-columns: auto auto minmax(40px, 1fr) auto;
  align-items: baseline;
  gap: 12px 20px;
  margin-bottom: clamp(32px, 4.5vw, 56px);
}
.section-head__idx { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; color: var(--accent); }
.section-head__title {
  margin: 0;
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(2.6rem, 5.6vw, 4.9rem); line-height: 0.95; letter-spacing: -0.025em;
}
.section-head__title em { font-style: italic; }
.section-head__rule {
  height: 1px; align-self: center; background: var(--line-2);
  transform-origin: left; transform: scaleX(0);
  transition: transform 1.4s var(--ease-out) 0.2s;
}
.section-head.is-visible .section-head__rule, html:not(.js) .section-head__rule { transform: scaleX(1); }
.section-head__meta { color: var(--ink-3); text-align: right; }

@media (max-width: 720px) {
  .section-head { grid-template-columns: auto 1fr; }
  .section-head__rule { display: none; }
  .section-head__meta { grid-column: 1 / -1; text-align: left; }
}

/* Corner brackets, like a viewfinder or a drawing frame */
.frame-corners { position: absolute; pointer-events: none; }
.frame-corners i { position: absolute; width: 18px; height: 18px; border: 0 solid var(--corner, var(--ink-3)); }
.frame-corners i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.frame-corners i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.frame-corners i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.frame-corners i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- Footer ---------- */
.footer { position: relative; padding: clamp(56px, 8vw, 96px) 0 24px; border-top: 1px solid var(--line); overflow: hidden; }
.footer__grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 32px; }
.footer h4 { margin: 0 0 14px; color: var(--ink-3); font-weight: 400; }
.footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.footer ul a { color: var(--ink-2); transition: color 0.2s; }
.footer ul a:hover { color: var(--accent); }
.footer__tag { margin: 0; max-width: 32ch; font-family: var(--font-serif); font-size: 1.7rem; line-height: 1.15; letter-spacing: -0.01em; }
.footer__tag em { color: var(--accent); }
.footer__word {
  margin: clamp(40px, 7vw, 80px) 0 0;
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(3rem, 13.2vw, 12.5rem); line-height: 0.8; letter-spacing: -0.045em;
  white-space: nowrap; user-select: none;
  background: linear-gradient(to bottom, var(--ink) 30%, color-mix(in srgb, var(--ink) 0%, transparent) 115%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-3); }
.footer__bottom a:hover { color: var(--accent); }
@media (max-width: 900px) { .footer__grid { grid-template-columns: 1fr 1fr; } .footer__grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer__grid { grid-template-columns: 1fr; } }
