/* zuhd.news — Typography is the design. */

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

/* --- Scale ---
   Base: 18px, ratio: 1.25 (Major Third)
   18 / 22.5 / 28.1 / 35.2 / 43.9
*/

:root {
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-sans: 'Source Sans 3', system-ui, sans-serif;

  --size-base: 1.125rem;   /* 18px */
  --size-sm: 0.875rem;     /* 14px */
  --size-xs: 0.75rem;      /* 12px */
  --size-h3: 1.25rem;      /* 20px */
  --size-h2: 1.563rem;     /* 25px */
  --size-h1: 1.953rem;     /* 31.25px */
  --size-display: 2.441rem; /* 39px */

  --leading-body: 1.55;
  --leading-heading: 1.2;

  --text: #1a1a1a;
  --text-secondary: #555;
  --bg: #fff;
  --accent: #444;
  --rule: #ddd;

  --measure: 80ch;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
}

/* --- Base --- */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-serif);
  font-size: var(--size-base);
  line-height: var(--leading-body);
  color: var(--text);
  background: var(--bg);
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-md);
  padding-top: var(--space-lg);
  padding-bottom: var(--space-xl);
}

/* --- Typography --- */
h1 {
  font-family: var(--font-serif);
  line-height: var(--leading-heading);
  font-weight: 700;
}

h1 { font-size: var(--size-display); margin-bottom: var(--space-sm); }

p {
  margin-bottom: var(--space-sm);
}

strong { font-weight: 700; }
em { font-style: italic; }

a {
  color: var(--text);
  text-decoration-color: var(--accent);
  text-underline-offset: 0.15em;
  text-decoration-thickness: 1px;
  transition: text-decoration-color 0.15s;
}

a:hover {
  text-decoration-color: var(--text);
}


/* --- Header --- */
header {
  margin-bottom: var(--space-lg);
}

.wordmark {
  font-family: var(--font-serif);
  font-size: var(--size-h2);
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  letter-spacing: -0.02em;
}

.tagline {
  font-family: var(--font-sans);
  font-size: var(--size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* --- Article Header --- */
.article-header {
  margin-bottom: var(--space-md);
}

.category {
  font-family: var(--font-sans);
  font-size: var(--size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  display: block;
  margin-bottom: var(--space-xs);
}

.meta {
  font-family: var(--font-sans);
  font-size: var(--size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.meta a {
  color: var(--text-secondary);
}

.separator {
  margin: 0 0.4em;
}


/* --- Homepage --- */
.article-preview {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--rule);
}

.article-preview:first-child {
  padding-top: 0;
}

.article-preview h2 {
  font-size: var(--size-h2);
  margin-top: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.article-preview h2 a {
  text-decoration: none;
}

.article-preview time {
  font-family: var(--font-sans);
  font-size: var(--size-sm);
  color: var(--text-secondary);
}

/* --- Footer --- */
footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: var(--size-sm);
  color: var(--text-secondary);
}

.last-updated {
  margin-bottom: var(--space-xs);
}

/* --- Nav Hint --- */
.nav-hint {
  font-family: var(--font-sans);
  font-size: var(--size-xs);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  opacity: 0.6;
}

.hint-reading { display: none; }
body.view-article .hint-nav,
body.view-article .hint-enter { display: none; }
body.view-article .hint-reading { display: inline; }
body.view-article .nav-hint { opacity: 1; }

/* --- Category Strip --- */
.category-strip {
  display: flex;
  gap: 2rem;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  overflow-x: auto;
}

.category-tab {
  font-family: var(--font-sans);
  font-size: var(--size-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 400;
  color: var(--text-secondary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: font-weight 80ms ease, color 80ms ease;
}

.category-tab[aria-selected="true"] {
  font-weight: 700;
  color: var(--text);
}

/* --- Headline List --- */
.headline-item {
  padding: var(--space-xs) 0;
  cursor: pointer;
}

.headline-item h2 {
  font-family: var(--font-sans);
  font-size: var(--size-h3);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: var(--leading-heading);
  margin: 0;
  transition: font-weight 80ms ease, color 80ms ease;
}

.headline-item time {
  font-family: var(--font-sans);
  font-size: var(--size-sm);
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

.headline-item.selected h2 {
  font-weight: 700;
  color: var(--text);
}

/* --- Headline List Fade --- */
.headline-list {
  transition: opacity 60ms ease, transform 60ms ease;
}

.headline-list.switching {
  opacity: 0;
  transform: translateY(-4px);
}

/* --- Article View --- */
.article-view {
  animation: article-in 120ms ease both;
}

.article-view[hidden] {
  display: none;
}

body.view-article .category-strip,
body.view-article .headline-list {
  display: none;
}

@keyframes article-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Screen Reader Only --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Mobile --- */
@media (max-width: 640px) {
  body {
    font-size: 1rem;
    padding: var(--space-sm);
    padding-top: var(--space-md);
  }

  h1 { font-size: var(--size-h1); }

  .headline-item h2 { font-size: var(--size-h3); }

  .category-strip { gap: 1.25rem; }

  .nav-hint { display: none; }
}

/* --- Desktop --- */
@media (min-width: 768px) {
  /* Headlines stacked — scannable index */
  .headline-list {
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--rule);
    margin-bottom: var(--space-lg);
  }

  .headline-item { padding: 3px 0; display: flex; align-items: baseline; gap: var(--space-xs); }
  .headline-item h2 { font-size: var(--size-base); line-height: 1.3; }
  .headline-item time { display: block; font-size: var(--size-xs); white-space: nowrap; flex-shrink: 0; margin-top: 0; order: -1; min-width: 3.5em; }

  /* Article always visible below headlines */
  .article-view[hidden] { display: block; }
  .article-view { animation: none; }
  body.view-article .category-strip { display: flex; }
  body.view-article .headline-list { display: block; }

  /* Constrain article reading measure */
  .article-view { max-width: 65ch; }

  /* Hide article header on desktop (shown in headline strip) */
  .article-view .article-header { display: none; }

  /* No enter/esc hints on desktop */
  .hint-enter, .hint-reading { display: none; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .headline-item h2, .headline-list, .category-tab {
    transition: none;
  }

  .article-view {
    animation: none;
  }
}
