/* =====================================================================
   SHELFLAYER — shared system
   "The Library, indexed."
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@300;400;500&display=swap');

:root {
  /* surfaces */
  --ink: #0a0908;
  --ash: #161412;
  --char: #1d1a16;
  --vellum: #f0e7d3;
  --vellum-soft: #e6dcc4;
  --parchment: #d9cea9;

  /* accents — the two halves of the brand */
  --gold: #c9a14a;
  --gold-bright: #f5cf75;
  --gold-deep: #6e5223;
  --blueprint: #4d8df5;
  --blueprint-bright: #8fb4ff;
  --blueprint-deep: #1a3a7a;

  /* derived */
  --rule: rgba(201, 161, 74, 0.25);
  --rule-cool: rgba(77, 141, 245, 0.22);
  --ink-on-vellum: #1a1410;

  /* type */
  --serif-display: "Cormorant", "EB Garamond", Georgia, serif;
  --serif-body: "EB Garamond", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ink);
  color: var(--vellum);
  font-family: var(--serif-body);
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201,161,74,0.06), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(77,141,245,0.05), transparent 60%),
    var(--ink);
  min-height: 100vh;
}

a { color: var(--gold-bright); text-decoration: none; }
a:hover { color: var(--vellum); }

/* ---------- type ---------- */

h1, h2, h3, h4 {
  font-family: var(--serif-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(48px, 7vw, 112px); line-height: 0.95; }
h2 { font-size: clamp(36px, 4.4vw, 64px); line-height: 1.02; }
h3 { font-size: clamp(22px, 2vw, 30px); line-height: 1.15; }
h4 { font-size: 20px; line-height: 1.25; font-weight: 500; }

p { margin: 0 0 1em; text-wrap: pretty; }

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}
.kicker--cool { color: var(--blueprint-bright); }

.italic-serif { font-style: italic; font-family: var(--serif-body); }
.numeral { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* drop cap */
.dropcap::first-letter {
  font-family: var(--serif-display);
  float: left;
  font-size: 5.2em;
  line-height: 0.82;
  padding: 0.06em 0.12em 0 0;
  color: var(--gold);
  font-weight: 500;
}

/* ---------- layout primitives ---------- */

.shell { max-width: 1320px; margin: 0 auto; padding: 0 56px; }
.shell--narrow { max-width: 880px; }
@media (max-width: 720px) { .shell { padding: 0 24px; } }

.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule) 15%, var(--rule) 85%, transparent);
  border: 0;
  margin: 0;
}

/* gilt ornament divider */
.ornament {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}
.ornament::before, .ornament::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule));
}
.ornament::after {
  background: linear-gradient(90deg, var(--rule), transparent);
}
.ornament .diamond {
  width: 6px; height: 6px; transform: rotate(45deg);
  background: var(--gold); flex: 0 0 auto;
}

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

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 9, 8, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--rule);
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 18px 56px;
  max-width: 1440px;
  margin: 0 auto;
}
@media (max-width: 720px) { .masthead__inner { padding: 14px 24px; } }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--vellum);
}
.brand__mark {
  width: 36px; height: 36px;
  position: relative;
}
.brand__name {
  font-family: var(--serif-display);
  font-size: 22px;
  letter-spacing: 0.02em;
  font-weight: 500;
}
.brand__name em {
  color: var(--gold);
  font-style: italic;
  font-weight: 400;
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav a {
  color: var(--vellum);
  opacity: 0.78;
  position: relative;
  padding: 6px 0;
}
.nav a:hover { opacity: 1; color: var(--gold-bright); }
.nav a.active {
  opacity: 1;
  color: var(--gold-bright);
}
.nav a.active::after {
  content: ""; position: absolute;
  left: 0; right: 0; bottom: -19px;
  height: 1px; background: var(--gold);
}
@media (max-width: 980px) { .nav { display: none; } }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid var(--gold);
  color: var(--ink);
  background: var(--gold);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.btn:hover { background: var(--gold-bright); border-color: var(--gold-bright); color: var(--ink); }

.btn--ghost {
  background: transparent;
  color: var(--gold-bright);
}
.btn--ghost:hover { background: rgba(201,161,74,0.08); color: var(--gold-bright); }

.btn--blueprint {
  border-color: var(--blueprint);
  background: var(--blueprint);
  color: var(--ink);
}
.btn--blueprint:hover { background: var(--blueprint-bright); border-color: var(--blueprint-bright); }

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

.colophon {
  margin-top: 120px;
  padding: 64px 0 48px;
  border-top: 1px solid var(--rule);
  background:
    linear-gradient(180deg, transparent, rgba(201,161,74,0.04));
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(240,231,211,0.6);
}
.colophon__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
}
@media (max-width: 880px) { .colophon__grid { grid-template-columns: 1fr 1fr; } }
.colophon h5 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 16px;
  font-weight: 400;
}
.colophon ul { list-style: none; padding: 0; margin: 0; }
.colophon li { margin-bottom: 8px; }
.colophon a { color: var(--vellum); opacity: 0.7; }
.colophon a:hover { opacity: 1; color: var(--gold-bright); }
.colophon__motto {
  font-family: var(--serif-display);
  font-style: italic;
  color: var(--vellum);
  font-size: 22px;
  line-height: 1.3;
  margin-bottom: 18px;
  max-width: 340px;
}
.colophon__base {
  display: flex;
  justify-content: space-between;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
}

/* ---------- cards / catalog ---------- */

.card {
  border: 1px solid var(--rule);
  padding: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.012), transparent);
  position: relative;
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  border: 1px solid transparent;
  pointer-events: none;
}
.card__no {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.2em;
  margin-bottom: 12px;
}

/* book spine */
.spine {
  position: relative;
  aspect-ratio: 2/3;
  background: linear-gradient(180deg, var(--char), var(--ash));
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.spine::before, .spine::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%;
  height: 1px;
  background: var(--gold);
  opacity: 0.55;
}
.spine::before { top: 10%; }
.spine::after { bottom: 10%; }
.spine__title {
  font-family: var(--serif-display);
  font-style: italic;
  color: var(--gold-bright);
  text-align: center;
  padding: 18px 14px;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.spine__call {
  position: absolute;
  bottom: 14px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 0.18em;
}

/* metadata table — "catalog card" */
.catalog-card {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.catalog-card dt {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10px;
  margin-top: 10px;
}
.catalog-card dd {
  margin: 2px 0 0;
  color: var(--vellum);
}

/* ---------- code blocks ---------- */

.code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  background: #0c0e14;
  border: 1px solid var(--rule-cool);
  color: #cfd8e8;
  padding: 22px 24px;
  position: relative;
  overflow-x: auto;
}
.code__tag {
  position: absolute;
  top: -1px; right: -1px;
  background: var(--blueprint-deep);
  color: var(--blueprint-bright);
  padding: 4px 12px;
  font-size: 10px;
  letter-spacing: 0.22em;
  border-left: 1px solid var(--rule-cool);
  border-bottom: 1px solid var(--rule-cool);
}
.code .k { color: #8fb4ff; }      /* keyword */
.code .s { color: #f5cf75; }      /* string */
.code .c { color: #6a7080; font-style: italic; } /* comment */
.code .n { color: #ffd28e; }      /* number */
.code .p { color: #9aa3b4; }      /* punctuation */
.code .v { color: #e3eaf6; }      /* var */

/* ---------- folio / page mark ---------- */

.folio {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--gold);
  text-transform: uppercase;
}

/* ---------- arch ornament (svg-based) ---------- */
.arch-line {
  width: 100%; height: 80px;
  display: block;
  opacity: 0.7;
}

/* utility */
.text-center { text-align: center; }
.text-gold { color: var(--gold-bright); }
.text-blue { color: var(--blueprint-bright); }
.muted { color: rgba(240,231,211,0.6); }
.flex { display: flex; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-8 { gap: 32px; }
.gap-12 { gap: 48px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mt-12 { margin-top: 48px; }
.mt-16 { margin-top: 64px; }
.mt-24 { margin-top: 96px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.mb-12 { margin-bottom: 48px; }

/* ---------- section ---------- */
section { padding: 96px 0; }
section.tight { padding: 64px 0; }
section.compact { padding: 48px 0; }

/* selection */
::selection { background: var(--gold); color: var(--ink); }

/* scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--gold-deep); border: 2px solid var(--ink); }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
