/* ===================================================================
   alnyx — index  ·  editorial / technical-specimen design
   Newsreader (serif display) + JetBrains Mono (meta)
   =================================================================== */

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

:root {
  --paper:   #ECE7DC;   /* warm paper          */
  --paper-2: #E3DDD0;   /* slightly deeper      */
  --ink:     #17150F;   /* warm near-black ink  */
  --muted:   #6E685B;   /* faded ink            */
  --line:    #C9C2B2;   /* hairline rules       */
  --accent:  #C1432B;   /* vermilion            */
  --on-ink:      #ECE7DC;            /* text over inverted rows */
  --on-ink-dim:  rgba(236,231,220,0.74);
  --maxw: 1120px;
}

/* Dark — explicit user choice */
[data-theme="dark"] {
  --paper:   #14130E;
  --paper-2: #1B1A13;
  --ink:     #ECE7DC;
  --muted:   #948D7D;
  --line:    #34322A;
  --accent:  #E0613F;
  --on-ink:      #14130E;
  --on-ink-dim:  rgba(20,19,14,0.70);
}

/* Dark — follow the OS when the user hasn't chosen explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:   #14130E;
    --paper-2: #1B1A13;
    --ink:     #ECE7DC;
    --muted:   #948D7D;
    --line:    #34322A;
    --accent:  #E0613F;
    --on-ink:      #14130E;
    --on-ink-dim:  rgba(20,19,14,0.70);
  }
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

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

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

.sheet {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 40px 96px;
}

/* ---------- UTILITY LINE ---------- */
.util {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.util-mid { font-style: normal; letter-spacing: 0.18em; }
.util-right { display: inline-flex; align-items: center; gap: 18px; }

.theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  transition: color 0.18s ease;
}
.theme-btn:hover, .theme-btn:focus-visible { color: var(--accent); outline: none; }
.theme-btn .glyph {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background:
    linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
}
.theme-btn:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- MASTHEAD ---------- */
.mast {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: end;
  padding: 64px 0 40px;
  border-bottom: 2px solid var(--ink);
}
.word {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  font-size: clamp(84px, 17vw, 220px);
  line-height: 0.82;
  letter-spacing: -0.03em;
  margin-left: -0.04em;
}
.period { color: var(--accent); }

.mast-side { padding-bottom: 10px; }
.lede {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(18px, 2.1vw, 23px);
  line-height: 1.4;
  font-weight: 400;
  max-width: 46ch;
  margin-bottom: 26px;
}
.facts { display: grid; gap: 8px; }
.facts > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.facts dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.facts dd { color: var(--ink); }

/* ---------- CONTENTS / NAV ---------- */
.contents {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  padding: 18px 0 0;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.contents a {
  color: var(--muted);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.contents a:hover { color: var(--accent); border-color: var(--accent); }
.c-no { color: var(--ink); margin-right: 6px; }

/* ---------- SECTION BLOCK ---------- */
.block { padding-top: 80px; }
.block-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--ink);
}
.block-no {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.block-title {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 500;
  font-size: clamp(30px, 4.5vw, 48px);
  letter-spacing: -0.02em;
  line-height: 1;
}
.block-count {
  margin-left: auto;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* ---------- PROJECT INDEX ---------- */
.index { list-style: none; }
.index li { border-bottom: 1px solid var(--line); }

.row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 220px 132px 36px 22px;
  align-items: baseline;
  column-gap: 22px;
  padding: 22px 18px;
  margin: 0 -18px;
  position: relative;
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}
.row:hover,
.row:focus-visible {
  background: var(--ink);
  color: var(--on-ink);
  outline: none;
  padding-left: 28px;
}

.r-no {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.row:hover .r-no, .row:focus-visible .r-no { color: var(--accent); }

.r-main { min-width: 0; }
.r-name {
  display: block;
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.08;
}
.r-desc {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 62ch;
}
.row:hover .r-desc, .row:focus-visible .r-desc { color: var(--on-ink-dim); }

.r-tech, .r-lang {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  align-self: center;
}
.r-lang { color: var(--ink); }
.row:hover .r-tech, .row:focus-visible .r-tech { color: var(--on-ink-dim); }
.row:hover .r-lang, .row:focus-visible .r-lang { color: var(--on-ink); }

.r-stars {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.02em;
  text-align: right;
  align-self: center;
}

.r-go {
  font-size: 16px;
  text-align: right;
  align-self: center;
  opacity: 0;
  transform: translate(-4px, 0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.row:hover .r-go, .row:focus-visible .r-go { opacity: 1; transform: none; color: var(--accent); }

/* ---------- STACK SPEC ---------- */
.spec { display: grid; }
.spec-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.spec-row dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding-top: 4px;
}
.spec-row dd {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.3;
}

/* ---------- CONTACT LINKS ---------- */
.links { list-style: none; }
.links li { border-bottom: 1px solid var(--line); }
.links a {
  display: grid;
  grid-template-columns: 120px 1fr 24px;
  align-items: baseline;
  gap: 20px;
  padding: 20px 18px;
  margin: 0 -18px;
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}
.links a:hover, .links a:focus-visible {
  background: var(--ink);
  color: var(--on-ink);
  outline: none;
  padding-left: 28px;
}
.l-key {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.links a:hover .l-key, .links a:focus-visible .l-key { color: var(--accent); }
.l-val {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(20px, 2.6vw, 30px);
  letter-spacing: -0.01em;
  word-break: break-word;
}
.l-go { text-align: right; color: var(--accent); }

/* ---------- COLOPHON ---------- */
.colophon {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 88px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- FOCUS ---------- */
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 880px) {
  .mast { grid-template-columns: 1fr; gap: 28px; align-items: start; }
  .row {
    grid-template-columns: 28px 1fr auto;
    grid-template-areas:
      "no name name"
      "no desc desc"
      ".  tech meta";
    row-gap: 6px;
    column-gap: 16px;
  }
  .r-no   { grid-area: no; }
  .r-main { grid-area: name; display: contents; }
  .r-name { grid-area: name; }
  .r-desc { grid-area: desc; }
  .r-tech { grid-area: tech; align-self: center; }
  .r-lang { grid-area: meta; text-align: right; align-self: center; }
  .r-stars { display: none; }
  .r-go { display: none; }
}

@media (max-width: 600px) {
  .sheet { padding: 0 22px 72px; }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
  .spec-row { grid-template-columns: 1fr; gap: 4px; }
  .contents { gap: 18px; }
  .links a { grid-template-columns: 1fr; gap: 4px; }
  .l-go { display: none; }
}

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