/* ==========================================================================
   katteryn — house stylesheet
   Palette, type and components inherited from the katteryn.com landing page.
   Light-only by design: the house look is fixed cream, matching the atelier
   page. Do not add a dark theme without changing the landing page too.
   ========================================================================== */

:root {
  --bg: #fbf6ee;
  --bg-deep: #2c241c;
  --bg-tint: #f5eee2;
  --ink: #1a1612;
  --ink-muted: #7a6f63;
  --rule: #e8dfd1;
  --accent: #b08d5b;
  --accent-warm: #c9a576;

  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --measure: 68ch;
  --gutter: 28px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- shell ---------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main { flex: 1; }

/* --- masthead ------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 22px 0;
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
}

.wordmark svg,
.wordmark img { width: 26px; height: 26px; opacity: 0.85; flex: none; }

.wordmark span {
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1;
}

.nav {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.nav a:hover,
.nav a:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }

.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* --- article head --------------------------------------------------------- */

.article-head {
  padding: 72px 0 40px;
  max-width: var(--measure);
}

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}

h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 5.6vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

h1 em { font-style: italic; color: var(--accent); font-weight: 300; }

.standfirst {
  font-family: var(--serif);
  font-size: clamp(19px, 2.2vw, 23px);
  font-style: italic;
  font-weight: 300;
  line-height: 1.55;
  color: var(--ink);
  max-width: 46ch;
}

.byline {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.byline strong { color: var(--ink); font-weight: 600; }

/* --- prose ---------------------------------------------------------------- */

.prose { max-width: var(--measure); padding-bottom: 40px; }

.prose > * + * { margin-top: 1.25em; }

.prose h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(25px, 3vw, 33px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-top: 2.6em;
  padding-top: 1.1em;
  border-top: 1px solid var(--rule);
}

.prose h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.3;
  margin-top: 2em;
}

.prose h4 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2em;
}

.prose p { text-wrap: pretty; }

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-warm);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.18s ease;
}

.prose a:hover, .prose a:focus-visible { color: var(--accent); }

.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.5em; }
.prose li::marker { color: var(--accent); }

.prose strong { font-weight: 600; }

.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink);
}

.prose blockquote cite {
  display: block;
  margin-top: 10px;
  font-family: var(--sans);
  font-style: normal;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.lead { font-size: 19px; line-height: 1.65; }

/* --- technical notation --------------------------------------------------- */

/* Miller-Bravais indices: <span class="idx">(11<b>2</b>0)</span> renders the
   overbar on the negative index the way crystallography actually writes it. */
.idx { font-family: var(--mono); font-size: 0.94em; white-space: nowrap; }
.idx b { font-weight: 400; text-decoration: overline; }

code, .mono { font-family: var(--mono); font-size: 0.9em; }

code {
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.1em 0.38em;
}

/* --- spec table ----------------------------------------------------------- */

.table-scroll { overflow-x: auto; margin-top: 1.6em; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

caption {
  caption-side: top;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 12px;
}

th, td {
  text-align: left;
  padding: 11px 16px 11px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom-color: var(--ink-muted);
}

tbody th { font-weight: 500; }

td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- callout -------------------------------------------------------------- */

.note {
  background: var(--bg-tint);
  border-left: 2px solid var(--accent);
  padding: 22px 26px;
  font-size: 15.5px;
  line-height: 1.65;
}

.note > p + p { margin-top: 0.9em; }

.note .note-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* --- figure --------------------------------------------------------------- */

figure { margin-top: 1.9em; }
figure svg, figure img { display: block; width: 100%; height: auto; }

figcaption {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-muted);
}

figcaption b { color: var(--ink); font-weight: 600; }

/* --- index / card lists --------------------------------------------------- */

.cluster { margin-top: 56px; }

.cluster-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink-muted);
}

.cluster-head h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 27px;
  letter-spacing: -0.02em;
}

.cluster-count {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.cluster p.cluster-note {
  margin-top: 14px;
  font-size: 15px;
  color: var(--ink-muted);
  max-width: 60ch;
}

.entries { list-style: none; padding: 0; margin-top: 20px; }

.entries li { border-bottom: 1px solid var(--rule); }

.entries a,
.entries span.pending {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.18s ease;
}

.entries a:hover, .entries a:focus-visible { color: var(--accent); }

.entries .t { font-size: 16px; line-height: 1.45; }

.entries span.pending { color: var(--ink-muted); }

.status {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
  padding-top: 4px;
}

.status.live { color: var(--accent); }

/* --- research lines (two-up cards) ---------------------------------------- */

.lines {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  margin-top: 40px;
}

.line {
  border-top: 2px solid var(--accent);
  padding-top: 24px;
}

.line .line-no {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}

.line h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.line p { font-size: 15.5px; line-height: 1.65; }
.line p + p { margin-top: 0.9em; }

.kv {
  list-style: none;
  margin-top: 20px;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.kv li {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  line-height: 1.45;
}

.kv .k {
  color: var(--ink-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  flex: none;
  padding-top: 2px;
}

.kv .v { text-align: right; }

/* --- stat row ------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 36px;
}

.stat {
  background: var(--bg);
  padding: 22px 20px;
}

.stat .n {
  display: block;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat .l {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  line-height: 1.4;
}

/* --- related -------------------------------------------------------------- */

.related {
  margin-top: 72px;
  padding-top: 26px;
  border-top: 1px solid var(--ink-muted);
  max-width: var(--measure);
}

.related h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.related ul { list-style: none; }
.related li + li { margin-top: 12px; }

.related a {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 300;
  transition: color 0.18s ease;
}

.related a:hover, .related a:focus-visible { color: var(--accent); }

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

.foot {
  margin-top: 96px;
  background: var(--bg-deep);
  color: #d9cfc1;
  padding: 56px 0 44px;
  font-size: 14px;
}

.foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 36px 28px;
}

.foot h3 {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-warm);
  margin-bottom: 14px;
}

.foot ul { list-style: none; }
.foot li + li { margin-top: 9px; }

.foot a {
  color: #d9cfc1;
  text-decoration: none;
  transition: color 0.18s ease;
}

.foot a:hover, .foot a:focus-visible { color: #fff; }

/* --- house marks (S1-S4) -------------------------------------------------- */

.house-marks {
  margin-top: 44px;
  padding-top: 34px;
  border-top: 1px solid rgba(217, 207, 193, 0.18);
  text-align: center;
}

.house-marks svg {
  display: block;
  width: 186px;
  height: auto;
  margin: 0 auto;
}

.house-marks .hm-caption {
  margin-top: 18px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

.house-marks .hm-sub {
  margin-top: 9px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #a2958a;
}

.house-marks .hm-sub a { color: #d9cfc1; text-decoration: underline; text-underline-offset: 3px; }
.house-marks .hm-sub a:hover { color: #fff; }

@media (max-width: 480px) {
  .house-marks svg { width: 150px; }
}

.foot-base {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid rgba(217, 207, 193, 0.18);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  justify-content: space-between;
  font-size: 12px;
  color: #a2958a;
}

.foot-base .house { font-family: var(--serif); font-style: italic; }
.foot-base a { color: var(--accent-warm); }

/* --- accessibility -------------------------------------------------------- */

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: static;
  display: inline-block;
  margin: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* --- narrow --------------------------------------------------------------- */

@media (max-width: 640px) {
  :root { --gutter: 20px; }
  body { font-size: 16.5px; }
  .article-head { padding: 48px 0 32px; }
  .nav { gap: 18px; font-size: 11px; }
  .prose h2 { margin-top: 2em; }
  .foot { margin-top: 64px; }
}

/* --- print ---------------------------------------------------------------- */

@media print {
  .masthead, .foot, .nav, .related { display: none; }
  body { background: #fff; font-size: 11pt; }
  .prose, .article-head { max-width: none; }
}
