/* ---------------------------------------------------------------
   Nicolas — editorial single page
   Thesis: ink on paper. Type carries the hierarchy; the accent is
   reserved for links only, so every coloured thing is reachable.
   --------------------------------------------------------------- */

:root {
  /* Palette — warm paper, warm ink, one reserved accent */
  --paper:      #f6f3ec;
  --paper-sunk: #efeae0;
  --ink:        #15130f;
  --ink-soft:   #5c564c;
  --rule:       #d8d1c3;
  --accent:     #9a3412;

  /* Type */
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino,
           "Times New Roman", Georgia, serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
           Helvetica, Arial, sans-serif;

  /* Rhythm */
  --measure: 34rem;      /* reading width  */
  --shell:   72rem;      /* page width     */
  --gutter:  clamp(1.5rem, 6vw, 7rem);
  --step:    clamp(3.5rem, 9vh, 7rem);
}

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

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

body {
  margin: 0;
  padding: 0 var(--gutter);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body > * { max-width: var(--shell); margin-inline: auto; }

/* --- Links ---------------------------------------------------- */

a { color: var(--accent); }

a:not(.entry-link):not(.skip) {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 0.75rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.8rem;
  text-decoration: none;
}

/* --- Masthead ------------------------------------------------- */

.masthead {
  padding: calc(var(--step) * 1.2) 0 var(--step);
}

.eyebrow,
.section-h,
.entry-num,
.entry-year,
.contact-k,
.jump,
.footer,
.aside {
  font-family: var(--sans);
}

.eyebrow {
  margin: 0 0 1.25rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.name {
  margin: 0;
  font-size: clamp(3.75rem, 13vw, 11rem);
  font-weight: 400;
  line-height: 0.88;
  letter-spacing: -0.03em;
}

/* The hairline under the name is the one piece of furniture. */
.name::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 1px;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  background: var(--ink);
}

.lede {
  max-width: var(--measure);
  margin: clamp(1.75rem, 4vw, 2.5rem) 0 0;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  line-height: 1.45;
  text-wrap: pretty;
}

.lede em,
.prose em {
  font-style: italic;
  color: var(--ink-soft);
}

.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: clamp(2.5rem, 6vw, 4rem);
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- Sections ------------------------------------------------- */

.section {
  padding: var(--step) 0;
  border-top: 1px solid var(--rule);
}

.section-h {
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* --- Work index ----------------------------------------------- */

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

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

.entry-link {
  display: grid;
  grid-template-columns: 2.75rem 1fr auto 1.5rem;
  align-items: baseline;
  gap: 0 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem) 0.5rem;
  color: inherit;
  text-decoration: none;
  transition: background-color 160ms ease, padding-inline 160ms ease;
}

.entry-link:hover,
.entry-link:focus-visible {
  background: var(--paper-sunk);
  padding-inline: 0.9rem 0.1rem;
}

.entry-num,
.entry-year {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.entry-body { display: block; }

.entry-title {
  display: block;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.entry-note {
  display: block;
  max-width: 38ch;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.entry-arrow {
  justify-self: end;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-0.4rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.entry-link:hover .entry-arrow,
.entry-link:focus-visible .entry-arrow {
  opacity: 1;
  transform: translateX(0);
}

.aside {
  max-width: var(--measure);
  margin: 2rem 0 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* --- Prose ---------------------------------------------------- */

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.25em; text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }

/* --- Contact -------------------------------------------------- */

.contact {
  margin: 0;
  padding: 0;
  list-style: none;
  max-width: var(--measure);
}

.contact li {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--rule);
}

.contact li:first-child { border-top: 1px solid var(--rule); }

.contact-k {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* --- Footer --------------------------------------------------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: var(--step) 0 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.footer p { margin: 0; }

/* --- Narrow viewports ----------------------------------------- */
/* Reorder rather than shrink: the number sits above the title and
   the year trails the note, so the title keeps full width. */

@media (max-width: 34rem) {
  .entry-link {
    grid-template-columns: 1fr auto;
    gap: 0.35rem 1rem;
    padding-block: 1.5rem;
  }
  .entry-num { grid-column: 1 / -1; }
  .entry-body { grid-column: 1 / -1; }
  .entry-year { grid-column: 1; }
  .entry-arrow { grid-column: 2; opacity: 1; transform: none; }
  .entry-link:hover { padding-inline: 0.5rem; }
  .contact li { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* --- Preferences ---------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .entry-arrow { opacity: 1; transform: none; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #14130f;
    --paper-sunk: #1d1b16;
    --ink:        #f2eee4;
    --ink-soft:   #a09889;
    --rule:       #332f27;
    --accent:     #e8814f;
  }
  .skip { background: var(--ink); color: var(--paper); }
}

@media print {
  body { background: #fff; color: #000; padding: 0; }
  .jump, .skip, .entry-arrow { display: none; }
  .section, .entry, .contact li { border-color: #bbb; }
}
