/* ==========================================================================
   Altare — shared styles
   Aesthetic: warm neutral / amber / editorial-SaaS
   ========================================================================== */

:root {
  /* palette */
  --ivory: #F5F0E6;
  --ivory-2: #EDE6D7;
  --paper: #FBF8F1;
  --ink: #1A1714;
  --ink-2: #3A332C;
  --taupe: #756A5C;
  --taupe-2: #A89C8A;
  --rule: #D8CEBC;
  --rule-2: #E8DFCC;
  --amber: oklch(0.72 0.13 65);
  --amber-deep: oklch(0.58 0.14 55);
  --amber-soft: oklch(0.92 0.05 75);
  --teal: oklch(0.42 0.06 210);

  /* type */
  --sans: 'Inter Tight', system-ui, sans-serif;
  --display: 'Instrument Sans', 'Inter Tight', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  /* scale */
  --gutter: clamp(1.25rem, 3vw, 2.5rem);
  --container: 1280px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

/* paper grain texture — applied to body via pseudo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.15  0 0 0 0 0.13  0 0 0 0 0.1  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

main, header, footer, section, nav { position: relative; z-index: 2; }

a { color: inherit; text-decoration: none; }

/* ---------- Containers ---------- */
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 960px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Type ---------- */
.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--taupe);
}
.eyebrow .dot {
  display: inline-block;
  width: 5px; height: 5px;
  background: var(--amber);
  border-radius: 50%;
  vertical-align: middle;
  margin: -2px 10px 0 0;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}
.h-display {
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 1.0;
  letter-spacing: -0.035em;
  font-weight: 450;
}
.h-display em {
  font-style: italic;
  font-family: 'Instrument Serif', 'Instrument Sans', serif;
  font-weight: 400;
}
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); line-height: 1.1; letter-spacing: -0.025em; }
h3 { font-size: 1.25rem; line-height: 1.25; letter-spacing: -0.01em; font-weight: 500; }

p { text-wrap: pretty; color: var(--ink-2); }
.lede { font-size: 1.125rem; line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.num  { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }

hr.rule { border: none; border-top: 1px solid var(--rule); margin: 0; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--ivory) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
}
.brand {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 22px; height: 22px;
  display: inline-block;
  position: relative;
  top: 4px;
}
.brand sup {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--taupe);
  text-transform: uppercase;
  padding-left: 4px;
}
.nav-links {
  display: flex; gap: 28px;
  font-size: 14px;
  color: var(--ink-2);
}
.nav-links a {
  position: relative;
  padding: 4px 0;
  transition: color .2s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--amber-deep);
}
.nav-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--ink);
  color: var(--ivory);
  transition: background .2s, color .2s;
}
.nav-cta:hover { background: var(--amber-deep); border-color: var(--amber-deep); }
.nav-cta .arrow { transition: transform .2s; }
.nav-cta:hover .arrow { transform: translateX(3px); }

/* Mobile nav collapse */
@media (max-width: 860px) {
  .nav-links { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: all .2s ease;
  border: 1px solid transparent;
  font-family: inherit;
}
.btn-primary {
  background: var(--ink);
  color: var(--ivory);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--amber-deep); border-color: var(--amber-deep); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Chip / pill ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--paper);
}
.chip .dot { width: 6px; height: 6px; background: var(--amber); border-radius: 50%; }
.chip.warn .dot { background: oklch(0.62 0.18 30); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--rule);
  background: var(--paper);
  padding: 56px 0 32px;
  margin-top: 120px;
  color: var(--ink-2);
  font-size: 14px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
}
.footer h4 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--taupe);
  font-weight: 600;
  margin-bottom: 14px;
}
.footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer a:hover { color: var(--ink); }
.footer-bottom {
  display: flex; justify-content: space-between;
  padding-top: 32px; margin-top: 48px;
  border-top: 1px solid var(--rule);
  font-size: 12px; color: var(--taupe);
}
.footer-about {
  max-width: 32ch;
  color: var(--taupe);
  font-size: 13px;
  line-height: 1.55;
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Page section ---------- */
.section { padding: clamp(64px, 9vw, 128px) 0; }
.section-label {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 24px;
}
.section-label .num { color: var(--taupe); font-size: 11px; letter-spacing: 0.1em; }
.section-label .line { flex: 1; height: 1px; background: var(--rule); max-width: 60px; }

/* ---------- Card ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 28px;
  transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--taupe-2); }

/* ---------- Link with arrow ---------- */
.arrow-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink);
  font-weight: 500;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
  transition: gap .2s, color .2s, border-color .2s;
}
.arrow-link:hover { gap: 10px; color: var(--amber-deep); border-color: var(--amber-deep); }

/* ---------- Archival placeholder (striped SVG) ---------- */
.archival {
  position: relative;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  background:
    repeating-linear-gradient(
      135deg,
      var(--ivory-2) 0 8px,
      var(--paper) 8px 16px
    );
  aspect-ratio: 4/3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--taupe);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.archival .plate-no { color: var(--ink-2); }
.archival .plate-label { max-width: 70%; line-height: 1.5; }
.archival.dark {
  background:
    repeating-linear-gradient(
      135deg,
      #241f1a 0 8px,
      #2a241e 8px 16px
    );
  color: var(--amber-soft);
  border-color: var(--ink);
}
.archival.dark .plate-no { color: var(--amber); }

/* ---------- Data row ---------- */
.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 14px;
}
.kv .k { color: var(--taupe); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.kv .v { color: var(--ink); }

/* ---------- Reveal on scroll ---------- */
.js-anim .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
.js-anim .reveal.in { opacity: 1; transform: none; }

/* ---------- Tag / status ---------- */
.tag {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber-deep);
  border: 1px solid color-mix(in oklab, var(--amber-deep) 25%, transparent);
}
.tag.neutral { background: var(--ivory-2); color: var(--taupe); border-color: var(--rule); }
.tag.crit { background: oklch(0.94 0.04 30); color: oklch(0.42 0.16 30); border-color: oklch(0.82 0.08 30); }

/* ---------- Utilities ---------- */
.hidden { display: none !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; } .mt-5 { margin-top: 48px; } .mt-6 { margin-top: 64px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; } .mb-5 { margin-bottom: 48px; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---------- Tweaks panel ---------- */
.tweaks {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  width: 280px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 18px 18px 16px;
  box-shadow: 0 12px 40px -10px rgba(26, 23, 20, 0.35);
  font-size: 13px;
  display: none;
}
.tweaks.show { display: block; }
.tweaks h5 {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--taupe);
  font-weight: 600;
  margin-bottom: 12px;
}
.tweaks label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--taupe);
  margin: 10px 0 6px;
}
.tweak-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tweak-chip {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--rule);
  background: var(--ivory);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: var(--ink-2);
  text-align: center;
}
.tweak-chip.on {
  background: var(--ink);
  color: var(--ivory);
  border-color: var(--ink);
}
