/* Shared UI for the whole site. Light by default, dark via [data-theme="dark"]. */

:root {
  --bg: #fff;
  --text: #111;
  --muted: #6b6b6b;
  --rule: rgba(0, 0, 0, 0.16);
  --pill-border: rgba(0, 0, 0, 0.35);
  --header-h: 100px;
  --gutter: 16px;
}

:root[data-theme="dark"] {
  --bg: #000;
  --text: #fff;
  --muted: #8f8f8f;
  --rule: rgba(255, 255, 255, 0.22);
  --pill-border: rgba(255, 255, 255, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

/* One-section-at-a-time scrolling (home). Sections are min-height, never fixed,
 * so text that outgrows the viewport still scrolls normally instead of clipping.
 * Snapping is disabled on short viewports, where forcing it would trap content. */
html.snap {
  scroll-padding-top: var(--header-h);
}

@media (min-height: 700px) {
  html.snap {
    scroll-snap-type: y mandatory;
  }
}

/* Content starts at --gutter below the section top, which is exactly where the
 * sticky portrait sits — so the first line of text lines up with the photo's top edge. */
.snap-section {
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: var(--gutter);
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Full-height screens are their own separation; dividers would hug the header.
 * Repeats padding-top because .section's shorthand would otherwise win. */
.snap-section.section {
  border-top: none;
  padding-top: var(--gutter);
  padding-bottom: 0;
}

.snap-section .intro {
  margin-bottom: 0;
}

/* The last screen already ends at the fold; trailing padding would add dead scroll. */
html.snap .site-main {
  padding-bottom: 0;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 48px;
  max-width: 1600px;
  margin: 0 auto;
}

.site-wordmark {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a,
.lang-toggle {
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
  text-decoration: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.site-nav a:hover,
.lang-toggle:hover {
  opacity: 0.7;
}

.theme-toggle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--text);
  background: linear-gradient(90deg, var(--text) 0 50%, transparent 50% 100%);
  cursor: pointer;
  padding: 0;
  flex: none;
}

/* Two-column layout shared by home and production */
.site-main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 40px 48px 120px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 900px) {
  :root {
    --header-h: 84px;
  }
  .site-main {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 24px 24px 80px;
  }
  .site-header {
    padding: 24px;
  }
}

.site-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--gutter));
}

@media (max-width: 900px) {
  .site-sidebar {
    position: static;
  }
}

.hairline {
  width: 56px;
  height: 1px;
  background: var(--rule);
  margin: 32px 0;
}

/* Home — portrait */
.portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  filter: grayscale(1);
  transition: filter 0.3s ease;
}

.portrait:hover {
  filter: grayscale(0);
}

@media (max-width: 900px) {
  .portrait {
    max-width: 220px;
  }
}

/* Home — prose */
/* Same size as body copy — hierarchy comes from position, not scale. */
.intro {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.6;
  max-width: 60ch;
  margin-bottom: 56px;
}

.intro a {
  color: inherit;
  text-underline-offset: 3px;
}

.intro a:hover {
  opacity: 0.7;
}

.section {
  border-top: 1px solid var(--rule);
  padding: 32px 0 8px;
  max-width: 60ch;
}

.section h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.section p {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.section p:last-child {
  margin-bottom: 0;
}

.section a {
  color: inherit;
  text-underline-offset: 3px;
}

.section a:hover {
  opacity: 0.7;
}

.links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
}

.links a {
  color: inherit;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.links a:hover {
  opacity: 0.7;
}

/* Production — page heading */
.page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}

/* Production — filters */
.filter-label {
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 320px;
}

.pill {
  font: inherit;
  font-size: 0.9rem;
  line-height: 1;
  padding: 10px 26px;
  border-radius: 999px;
  border: 1px solid var(--pill-border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pill:hover {
  border-color: var(--text);
}

.pill[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Production — post list */
.list-head {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 14px;
}

.sort-control {
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.sort-control:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 4px;
}

.post {
  border-top: 1px solid var(--rule);
  padding: 40px 0 48px;
}

.post-badge {
  display: inline-block;
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  line-height: 1;
  padding: 8px 20px;
  margin-bottom: 24px;
}

.post-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.post-title {
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 20px;
  max-width: 18ch;
}

.post-title a {
  color: inherit;
  text-decoration: none;
}

.post-title a:hover {
  text-decoration: underline;
  text-underline-offset: 6px;
}

.post-excerpt {
  font-size: 1.15rem;
  max-width: 46ch;
  margin-bottom: 22px;
}

.post-link {
  color: var(--text);
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.post-link:hover {
  opacity: 0.7;
}

.empty-state {
  border-top: 1px solid var(--rule);
  padding: 48px 0;
  color: var(--muted);
}

/* Native article page */
.article-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 120px;
}

.article-back {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  margin-bottom: 40px;
}

.article-back:hover {
  color: var(--text);
}

.article-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 16px;
}

.article-meta {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

.article-body {
  font-size: 1.15rem;
}

.article-body p {
  margin-bottom: 24px;
}

.article-body h2 {
  font-size: 1.6rem;
  font-weight: 500;
  margin: 40px 0 16px;
}

.article-body a {
  color: inherit;
  text-underline-offset: 3px;
}

.article-body blockquote {
  border-left: 2px solid var(--rule);
  padding-left: 20px;
  margin: 0 0 24px;
  color: var(--muted);
}
