/* /css/petrohrys.css
   Phase 1 — Editorial Index design system.
   Loaded only by homepage and the 5 new section pages.
   Source of truth: docs/superpowers/specs/2026-05-20-petrohrys-homepage-reposition-design.md */

/* ===== Tokens ===== */
:root {
  /* Color */
  --bg: #fafaf8;
  --text: #0e0e10;
  --text-2: #5a5a5e;
  --text-3: #9a9aa0;
  --rule: #e6e6e1;
  --hover-tint: rgba(14, 14, 16, 0.025);

  /* Type families */
  --ff-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --ff-sans:  'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ff-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Type scale */
  --fs-xs: 0.75rem;     /* 12 px */
  --fs-sm: 0.875rem;    /* 14 px */
  --fs-md: 1.125rem;    /* 18 px */
  --fs-lg: 1.375rem;    /* 22 px */
  --fs-xl: 1.75rem;     /* 28 px */
  --fs-display: clamp(2.5rem, 6vw, 4rem); /* 40 → 64 px */

  /* Spacing (8 px grid) */
  --s-0: 0.25rem;  /* 4  */
  --s-1: 0.5rem;   /* 8  */
  --s-2: 0.75rem;  /* 12 */
  --s-3: 1rem;     /* 16 */
  --s-4: 1.5rem;   /* 24 */
  --s-5: 2rem;     /* 32 */
  --s-6: 3rem;     /* 48 */
  --s-7: 4rem;     /* 64 */
  --s-8: 6rem;     /* 96 */
  --s-9: 8rem;     /* 128 */
  --s-10: 12rem;  /* 192 */

  /* Layout widths */
  --col-main: 720px;
  --col-text: 580px;
  --col-footer: 1080px;

  /* Borders */
  --rule-w: 1px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img { max-width: 100%; height: auto; display: block; }

/* ===== Base ===== */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}

body {
  font-family: var(--ff-sans);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--ff-serif);
  color: var(--text);
  font-weight: 500;
}
h1 {
  font-size: var(--fs-display);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 400;
}
h2 {
  font-size: var(--fs-xl);
  line-height: 1.2;
  letter-spacing: -0.015em;
}
h3 {
  font-size: var(--fs-lg);
  line-height: 1.3;
}

p { max-width: var(--col-text); }

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 150ms ease;
}
a:hover { text-decoration-color: var(--text); }
a:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ===== Skip link ===== */
.skip {
  position: absolute;
  left: -9999px;
  top: var(--s-3);
}
.skip:focus {
  left: var(--s-3);
  background: var(--text);
  color: var(--bg);
  padding: var(--s-1) var(--s-3);
  text-decoration: none;
  z-index: 1000;
}

/* ===== Header / Top nav ===== */
header[role="banner"] {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: var(--rule-w) solid var(--rule);
  z-index: 100;
}
header > nav {
  max-width: var(--col-footer);
  margin: 0 auto;
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-5);
}
.wordmark {
  font-family: var(--ff-serif);
  font-size: var(--fs-md);
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
  margin-right: auto;
  color: var(--text);
}
.wordmark:hover { text-decoration: none; }
.nav-primary, .nav-lang {
  display: flex;
  gap: var(--s-4);
}
.nav-primary a {
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
}
.nav-primary a:hover { text-decoration: underline; text-decoration-color: var(--text); }
.nav-primary [aria-current="page"] { text-decoration: underline; text-decoration-color: var(--text); }
.nav-lang {
  gap: var(--s-2);
  margin-left: var(--s-4);
}
.nav-lang a {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nav-lang [aria-current="page"] { color: var(--text); }
.nav-lang a:hover { color: var(--text); }

/* Mobile <details> nav — hidden on desktop */
.nav-mobile { display: none; }
.nav-mobile-panel { display: none; }

@media (max-width: 767px) {
  header > nav > .nav-primary,
  header > nav > .nav-lang { display: none; }

  header > nav {
    gap: var(--s-3);
    position: relative;  /* anchor for the absolute panel below */
  }

  .nav-mobile {
    display: block;
    margin-left: auto;
    position: static;
  }
  .nav-mobile summary {
    list-style: none;
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 500;
    padding: var(--s-1) var(--s-2);
  }
  .nav-mobile summary::-webkit-details-marker { display: none; }
  .nav-mobile summary::marker { content: ""; }
  .nav-mobile[open] summary { color: var(--text-3); }

  /* The wrapper panel: single absolutely-positioned overlay holding both ULs */
  .nav-mobile[open] > .nav-mobile-panel {
    display: flex;
    flex-direction: column;
    gap: var(--s-5);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: var(--rule-w) solid var(--rule);
    padding: var(--s-4);
    z-index: 101;
  }
  .nav-mobile-panel .nav-primary,
  .nav-mobile-panel .nav-lang {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    padding: 0;
    margin: 0;
  }
  .nav-mobile-panel .nav-lang {
    border-top: var(--rule-w) solid var(--rule);
    padding-top: var(--s-3);
  }
  .nav-mobile-panel .nav-lang a {
    color: var(--text-3);
  }
}

/* ===== Main ===== */
main {
  max-width: var(--col-main);
  margin: 0 auto;
  padding: var(--s-8) var(--s-4) var(--s-9);
}
@media (max-width: 640px) {
  main { padding: var(--s-7) var(--s-4); }
}
main > * + * { margin-top: var(--s-8); }
@media (max-width: 640px) {
  main > * + * { margin-top: var(--s-7); }
}

/* ===== Hero (homepage) ===== */
.hero .eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s-4);
}
.hero h1 {
  max-width: 14ch;
  margin-bottom: var(--s-4);
}
.hero .lede {
  font-family: var(--ff-serif);
  font-size: var(--fs-lg);
  line-height: 1.45;
  color: var(--text-2);
  max-width: var(--col-text);
}

/* ===== Page hero (section pages) ===== */
.page-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: var(--s-3);
  max-width: 18ch;
}
.page-hero .lede {
  font-family: var(--ff-serif);
  font-size: var(--fs-md);
  color: var(--text-2);
  max-width: var(--col-text);
}

/* ===== Section heading ===== */
section > h2 { margin-bottom: var(--s-4); }

/* ===== Prose blocks ===== */
.prose p + p { margin-top: var(--s-3); }

/* ===== TOC (homepage) ===== */
.toc { border-top: var(--rule-w) solid var(--rule); }
.toc li { border-bottom: var(--rule-w) solid var(--rule); }
.toc a {
  display: grid;
  grid-template-columns: 4ch 1fr auto;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-2);
  text-decoration: none;
  align-items: start;
  transition: background 150ms ease;
}
.toc a:hover { background: var(--hover-tint); }
.toc .num {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding-top: 0.4em;
}
.toc .title {
  font-family: var(--ff-serif);
  font-size: var(--fs-lg);
  font-weight: 500;
  display: block;
  color: var(--text);
}
.toc .lede {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-top: var(--s-1);
  display: block;
  max-width: 56ch;
}
.toc .arrow {
  color: var(--text-3);
  font-size: var(--fs-md);
  align-self: center;
}
@media (max-width: 640px) {
  .toc a { grid-template-columns: 4ch 1fr; }
  .toc .arrow { display: none; }
}

/* ===== Entries list (Selected writing / Essays) ===== */
.entries { border-top: var(--rule-w) solid var(--rule); }
.entries li { border-bottom: var(--rule-w) solid var(--rule); }
.entries a {
  display: grid;
  grid-template-columns: 14ch 1fr;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-2);
  text-decoration: none;
  align-items: baseline;
  transition: background 150ms ease;
}
.entries a:hover { background: var(--hover-tint); }
.entries .meta {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  color: var(--text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.entries .title {
  font-family: var(--ff-serif);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
}
@media (max-width: 640px) {
  .entries a { grid-template-columns: 1fr; gap: var(--s-1); }
}

.more {
  margin-top: var(--s-4);
  font-size: var(--fs-sm);
}

/* ===== Breadcrumb (section pages) ===== */
.breadcrumb {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s-5);
  max-width: none;
}
.breadcrumb a {
  color: var(--text-3);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { margin: 0 var(--s-1); }

/* ===== About page socials list ===== */
.socials {
  font-size: var(--fs-sm);
  color: var(--text-3);
  max-width: none;
}
.socials a {
  color: var(--text-3);
  margin-right: var(--s-3);
  text-decoration: none;
}
.socials a:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text);
}

/* ===== Visually-hidden utility ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Footer ===== */
footer[role="contentinfo"] {
  border-top: var(--rule-w) solid var(--rule);
  padding: var(--s-7) var(--s-4) var(--s-5);
  margin-top: var(--s-9);
  background: var(--bg);
}
.footer-grid {
  max-width: var(--col-footer);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-5);
}
@media (max-width: 959px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s-6); }
}
@media (max-width: 639px) {
  .footer-grid { grid-template-columns: 1fr; gap: var(--s-5); }
}
.footer-grid h3 {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s-3);
}
.footer-grid ul {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.footer-grid a {
  font-size: var(--fs-sm);
  color: var(--text);
  text-decoration: none;
}
.footer-grid a:hover {
  text-decoration: underline;
  text-decoration-color: var(--text);
}
.footer-bottom {
  max-width: var(--col-footer);
  margin: var(--s-6) auto 0;
  padding-top: var(--s-4);
  border-top: var(--rule-w) solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ===== End ===== */
