/* ============================================================================
   Zefra Perez - personal site
   Editorial / magazine direction on a warm paper ground.
   Fraunces (display serif) + Newsreader (text serif). Oxblood accent.
   One design system: tokens, then base, then layout, then details.
   ========================================================================== */

/* --- Tokens --------------------------------------------------------------- */
:root {
  /* Warm paper-and-ink neutrals built from one hue at low chroma. */
  --hue: 74;

  --paper:    oklch(97.2% 0.016 var(--hue));   /* warm cream, never #fff */
  --paper-2:  oklch(95%   0.020 var(--hue));   /* a touch deeper */
  --ink:      oklch(24%   0.022 var(--hue));   /* warm near-black, never #000 */
  --ink-soft: oklch(42%   0.020 var(--hue));   /* secondary text */
  --ink-faint:oklch(58%   0.016 var(--hue));   /* captions, metadata */
  --rule:     color-mix(in oklch, var(--ink) 16%, transparent);
  --rule-soft:color-mix(in oklch, var(--ink) 9%, transparent);

  /* One restrained editorial accent: oxblood. */
  --accent:      oklch(41% 0.13 25);
  --accent-deep: oklch(34% 0.12 25);

  /* Fluid type scale (one curve). */
  --step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
  --step-0:  clamp(1.05rem, 1.00rem + 0.25vw, 1.2rem);
  --step-1:  clamp(1.3rem, 1.18rem + 0.55vw, 1.6rem);
  --step-2:  clamp(1.7rem, 1.45rem + 1.1vw, 2.3rem);
  --step-4:  clamp(2.9rem, 2.1rem + 3.6vw, 5.6rem);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-text:    "Newsreader", Georgia, serif;

  --measure: 62ch;
  --radius: 2px;

  color-scheme: light;
}

/* --- Reset-ish base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-optical-sizing: auto;
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: "liga" 1, "onum" 1, "kern" 1;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}

p { text-wrap: pretty; }

/* Subconscious paper grain, borrowed from the warm/organic direction. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

/* --- Masthead ------------------------------------------------------------- */
.masthead {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1.25rem, 3vw, 2rem) clamp(1.5rem, 6vw, 5rem);
  border-bottom: 1px solid var(--rule);
}

.masthead__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.masthead__mark {
  font-size: var(--step--1);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* --- Sheet: asymmetric editorial grid ------------------------------------- */
.sheet {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns:
    [edge-start] minmax(1.5rem, 1fr)
    [main-start] minmax(0, var(--measure))
    [main-end gutter-start] minmax(0, 20rem)
    [gutter-end] minmax(1.5rem, 1fr) [edge-end];
  column-gap: clamp(2rem, 5vw, 5rem);
  row-gap: clamp(2.25rem, 5vw, 4rem);
  padding-block: clamp(3rem, 9vw, 7rem) clamp(3rem, 7vw, 5rem);
  align-content: start;
}

/* Hero breaks past the text measure into the gutter for a confident opening. */
.hero { grid-column: main-start / gutter-end; }

.hero__headline {
  font-size: var(--step-4);
  line-height: 0.98;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

.hero__dek {
  margin: clamp(1.25rem, 3vw, 1.75rem) 0 0;
  font-size: var(--step-1);
  line-height: 1.35;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 34ch;
}

/* Prose column sits in the main measure. */
.prose {
  grid-column: main-start / main-end;
  max-width: var(--measure);
}

.lede {
  margin: 0;
  font-size: var(--step-1);
  line-height: 1.55;
}

/* Drop cap: an editorial detail, one per page. */
.lede::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  float: left;
  font-size: 3.4em;
  line-height: 0.72;
  padding: 0.06em 0.12em 0 0;
  color: var(--accent);
}

/* Sections list (rendered only when state has items). */
.sections {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(1.5rem, 4vw, 2.25rem);
  border-top: 1px solid var(--rule);
}

.sections__title {
  font-size: var(--step-2);
  margin-bottom: 1.25rem;
}

.sections__list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: sec;
}

.sections__list li {
  counter-increment: sec;
  position: relative;
  padding: 0.85rem 0 0.85rem 2.75rem;
  border-bottom: 1px solid var(--rule-soft);
  font-size: var(--step-1);
}

.sections__list li::before {
  content: counter(sec, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.05rem;
  font-family: var(--font-text);
  font-variant-numeric: tabular-nums;
  font-size: var(--step--1);
  letter-spacing: 0.05em;
  color: var(--accent);
}

/* Margin note: marginalia in the gutter, hairline-ruled. */
.margin-note {
  grid-column: gutter-start / gutter-end;
  align-self: start;
  border-left: 2px solid var(--accent);
  padding-left: clamp(0.9rem, 2vw, 1.25rem);
  color: var(--ink-soft);
  font-size: var(--step--1);
  line-height: 1.5;
}

.margin-note__label {
  display: block;
  font-family: var(--font-text);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent-deep);
  margin-bottom: 0.5rem;
}

.margin-note p { margin: 0; }

/* --- Colophon ------------------------------------------------------------- */
.colophon {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem clamp(1.5rem, 5vw, 3rem);
  align-items: baseline;
  padding: 1.5rem clamp(1.5rem, 6vw, 5rem);
  border-top: 1px solid var(--rule);
  font-size: var(--step--1);
  color: var(--ink-faint);
}

.colophon p { margin: 0; }

.colophon__site {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.colophon time { font-variant-numeric: tabular-nums; }

/* --- Details: focus, selection, links, form accents ----------------------- */
::selection { background: var(--accent); color: var(--paper); }

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

a {
  color: inherit;
  text-decoration-color: color-mix(in oklch, var(--accent) 45%, transparent);
  text-decoration-thickness: from-font;
  text-underline-offset: 0.18em;
  transition: text-decoration-color 0.18s ease, text-underline-offset 0.18s ease;
}

@media (hover: hover) {
  a:hover {
    text-decoration-color: var(--accent);
    text-underline-offset: 0.26em;
  }
  .masthead__name:hover { text-decoration-color: var(--accent); }
}

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

/* --- Motion: one restrained entrance, respected reduced-motion ------------ */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(0.75rem); }
    to   { opacity: 1; transform: none; }
  }
  .hero__headline { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
  .hero__dek { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) 0.08s both; }
}

/* --- Narrow screens: fold the gutter under the main column ---------------- */
@media (max-width: 46rem) {
  .sheet { row-gap: clamp(2rem, 7vw, 3rem); }
  .hero, .prose, .margin-note { grid-column: main-start / gutter-end; }
  .hero__headline { max-width: none; }
}
