/* ==========================================================================
   base.css — "The Catalogue"
   A printed-record aesthetic: paper, ink, hairline rules, marginalia.
   No shadows, no gradients, no glow, no rounded cards. Rules do the work.
   ========================================================================== */

:root {
  --paper:    #F6F3EC;
  --paper-2:  #EFEBE1;
  --ink:      #1A1917;
  --ink-2:    #494339;
  --ink-3:    #7A7264;
  --rule:     #D8D1C3;
  --rule-2:   #C3BAA8;
  --accent:   #7A2233;   /* oxblood */
  --accent-2: #A34C57;
  --stamp:    #7A2233;
  --ok:       #2F5D3F;

  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 66ch;
  --gutter: clamp(18px, 5vw, 56px);
  --maxw: 1180px;
}

[data-theme="dark"] {
  --paper:    #14130F;
  --paper-2:  #1C1A15;
  --ink:      #EDE7DA;
  --ink-2:    #B4AB99;
  --ink-3:    #857C6C;
  --rule:     #33302A;
  --rule-2:   #4A453C;
  --accent:   #C8A24A;   /* brass */
  --accent-2: #DCBB6E;
  --stamp:    #C8A24A;
  --ok:       #7FA98A;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.62;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}

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

a { color: inherit; text-decoration: none; }
main a:not(.btn):not(.tab) {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule-2);
}
main a:not(.btn):not(.tab):hover { text-decoration-color: var(--accent); color: var(--accent); }

::selection { background: var(--accent); color: var(--paper); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

/* --------------------------------------------------------------------------
   Type
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.01em; margin: 0; line-height: 1.1; }

h1.display {
  font-size: clamp(3.1rem, 9.5vw, 7.4rem);
  line-height: .94;
  letter-spacing: -0.028em;
  font-weight: 400;
}
h1.display em { font-style: italic; color: var(--ink-2); }

h2 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); font-weight: 400; }
h3 { font-size: 1.24rem; font-weight: 600; letter-spacing: -0.005em; }

p { margin: 0 0 1.05em; }
.lede { font-size: clamp(1.16rem, 2vw, 1.42rem); line-height: 1.5; max-width: var(--measure); color: var(--ink); }
.prose { max-width: var(--measure); }
.muted { color: var(--ink-2); }
.mono {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-feature-settings: normal;
}
.small { font-size: .93rem; line-height: 1.55; color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Rules & sections
   -------------------------------------------------------------------------- */
section { padding: clamp(46px, 7vw, 92px) 0; }
section + section { border-top: 1px solid var(--rule); }
.tint { background: var(--paper-2); }

/* Section head: number in the margin, title in the text column */
.sec {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 0 26px;
  align-items: baseline;
  margin-bottom: clamp(26px, 4vw, 46px);
}
.sec .n {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--ink-3);
  padding-top: .45em;
  border-top: 2px solid var(--ink);
}
.sec .t { border-top: 1px solid var(--rule); padding-top: .45em; }
.sec .t p { margin: .5em 0 0; color: var(--ink-2); font-size: .98rem; max-width: 54ch; }

/* Two-column body used across pages */
.cols { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 0 26px; }
.cols > .aside {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.7;
}

@media (max-width: 760px) {
  .sec, .cols { grid-template-columns: 1fr; gap: 12px; }
  .sec .n { border-top: none; padding-top: 0; }
  .sec .t { border-top: none; padding-top: 0; }
  .cols > .aside { margin-bottom: 4px; }
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(9px);
  border-bottom: 1px solid var(--rule);
}
.nav-in { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; min-width: 0; }
.brand-av {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--rule-2);
}
.brand-t {
  font-family: var(--mono); font-size: .73rem; letter-spacing: .12em;
  text-transform: uppercase; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.brand-t > span { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 3px; }
.nav-links > a {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-2);
  padding: 8px 11px; border-bottom: 2px solid transparent;
}
.nav-links > a:hover { color: var(--ink); }
.nav-links > a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

.icon-btn, .kbd-hint {
  font-family: var(--mono); font-size: .64rem; letter-spacing: .08em;
  color: var(--ink-2); background: transparent;
  border: 1px solid var(--rule-2); border-radius: 2px;
  padding: 5px 8px; cursor: pointer; line-height: 1;
}
.icon-btn:hover, .kbd-hint:hover { border-color: var(--ink-2); color: var(--ink); }
.icon-btn { min-width: 30px; }

@media (max-width: 860px) {
  /* Six sections will not fit on one phone-width line. Rather than hide half the
     site behind a hamburger, the links drop to their own scrollable row: every
     destination stays visible and reachable with one thumb. */
  .nav-in { flex-wrap: wrap; height: auto; padding-top: 9px; row-gap: 0; }
  .brand { order: 1; }
  .nav-actions, .nav > .wrap > .nav-in > .icon-btn { order: 2; }
  .nav-links {
    order: 3; flex: 1 0 100%; padding: 0 0 2px;
    overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links > a { padding: 9px 10px 8px; font-size: .64rem; white-space: nowrap; scroll-snap-align: start; }
  .kbd-hint { display: none; }
  .brand-t { font-size: .62rem; }
}
@media (max-width: 430px) {
  .nav-links > a { padding: 9px 8px 8px; letter-spacing: .05em; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .09em;
  text-transform: uppercase;
  padding: 11px 17px; border: 1px solid var(--ink);
  border-radius: 2px; background: transparent; color: var(--ink);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  text-align: left;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-quiet { border-color: var(--rule-2); color: var(--ink-2); }
.btn-quiet:hover { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer { border-top: 1px solid var(--rule); padding: 34px 0 46px; background: var(--paper-2); }
.foot-in {
  display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center;
  font-family: var(--mono); font-size: .68rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3);
}
.foot-in .sp { margin-left: auto; }
footer a { border-bottom: 1px solid var(--rule-2); }
footer a:hover { color: var(--accent); border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Reveal (subtle; disabled for reduced motion and no-JS)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: .7rem; letter-spacing: .08em;
  text-transform: uppercase; padding: 10px 16px; border-radius: 2px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* --------------------------------------------------------------------------
   Skip link / focus
   -------------------------------------------------------------------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 300;
  background: var(--ink); color: var(--paper); padding: 10px 16px;
  font-family: var(--mono); font-size: .72rem;
}
.skip:focus { left: 8px; top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
