/* ============================================================
   Jason Lee · personal site
   Single stylesheet. No build step. No external dependencies.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Colors — light mode */
  --bg:        #FAFAF7;
  --fg:        #2A2A28;
  --muted:     #6F6F6A;
  --subtle:    #9A9A93;
  --border:    #E4E4DD;
  --surface:   #F2F2EC;
  --accent:    #5B7C57;
  --accent-hover: #436343;

  /* Typography */
  --font-serif: Georgia, "Iowan Old Style", "Apple Garamond", "Palatino Linotype", "Times New Roman", serif;
  --font-sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-mono:  ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  /* Sizing — fluid */
  --content-width: 680px;
  --content-width-wide: 960px;
  --gutter: clamp(1.25rem, 4vw, 2rem);

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
}

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

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, picture, video { display: block; max-width: 100%; height: auto; }

/* ---------- Layout ---------- */
.site {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.container--wide { max-width: var(--content-width-wide); }

main { flex: 1; padding-block: var(--space-16) var(--space-24); }

@media (max-width: 640px) {
  main { padding-block: var(--space-12) var(--space-16); }
}

/* ---------- Header ---------- */
.site-header {
  padding-block: var(--space-8) 0;
  border-bottom: 1px solid transparent;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.site-name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: var(--space-6);
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 120ms ease, border-color 120ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  color: var(--fg);
}

h1 {
  font-size: clamp(2rem, 1.5rem + 2.4vw, 2.75rem);
  margin-bottom: var(--space-6);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.375rem, 1.2rem + 0.8vw, 1.625rem);
  margin-top: var(--space-16);
  margin-bottom: var(--space-4);
}

h3 {
  font-size: 1.125rem;
  margin-top: var(--space-8);
  margin-bottom: var(--space-2);
  font-weight: 600;
}

p {
  margin-block: var(--space-4);
  color: var(--fg);
}

.lead {
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.1875rem);
  line-height: 1.7;
  color: var(--fg);
}

.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
small, .small { font-size: 0.875rem; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: color 120ms ease, border-color 120ms ease;
}

a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-hover);
}

strong, b { font-weight: 600; color: var(--fg); }
em, i { font-style: italic; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ---------- Lists ---------- */
ul, ol { padding-left: 1.25rem; margin-block: var(--space-4); }
li { margin-block: var(--space-2); }
li::marker { color: var(--subtle); }

ul.bare {
  list-style: none;
  padding-left: 0;
}

ul.bare > li { margin-block: var(--space-4); }

/* ---------- Hero (Home page) ---------- */
.hero {
  padding-block: var(--space-8) var(--space-4);
}

.hero h1 {
  margin-bottom: var(--space-6);
}

.hero .lead {
  max-width: 38em;
}

.hero .lead + .lead { margin-top: var(--space-4); }

/* ---------- Section navigation cards (Home) ---------- */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.section-card {
  display: block;
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.section-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--fg);
  transform: translateY(-1px);
}

.section-card h3 {
  margin: 0 0 var(--space-2) 0;
  font-family: var(--font-serif);
  color: var(--fg);
}

.section-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Meta line (year, label, etc.) ---------- */
.meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--subtle);
  letter-spacing: 0.02em;
}

/* ---------- Subgroup label (inline italic serif) ---------- */
.subgroup-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
  margin-top: var(--space-6);
  margin-bottom: var(--space-2);
}

.subgroup-label:first-child { margin-top: var(--space-4); }

/* ---------- Entry (resume/timeline item) ---------- */
.entry {
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.entry:last-child { border-bottom: 0; }

.entry .meta { margin-bottom: var(--space-2); }
.entry h3 { margin-top: 0; }

/* ---------- Compact list (one-line entries) ---------- */
.compact-list {
  list-style: none;
  padding-left: 0;
  margin-block: var(--space-4);
}

.compact-list > li {
  padding-block: var(--space-2);
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
}

.compact-list > li:last-child { border-bottom: 0; }

/* ---------- Earlier section (de-emphasized historical content) ---------- */
.earlier { opacity: 0.9; }
.earlier h2 { color: var(--muted); }

/* ---------- Books card grid (text-only, compact) ---------- */
.book-cards {
  list-style: none;
  padding-left: 0;
  margin-block: var(--space-6);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  column-gap: var(--space-6);
  row-gap: var(--space-4);
}

.book-cards > li { margin: 0; }

.book-card {
  display: flex;
  flex-direction: column;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.book-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: var(--space-1);
  color: var(--fg);
  font-family: var(--font-sans);
}

.book-card-author {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: var(--space-1);
}

.book-card-meta {
  font-size: 0.75rem;
  color: var(--subtle);
  line-height: 1.4;
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: var(--space-8);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.site-footer a {
  color: var(--muted);
  border-bottom-color: transparent;
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.footer-links {
  display: flex;
  gap: var(--space-4);
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li { margin: 0; }

/* ---------- Photo gallery ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  gap: var(--space-3);
  margin-block: var(--space-6);
}

.photo-grid figure {
  margin: 0;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface);
  aspect-ratio: 4 / 3;
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease, opacity 200ms ease;
}

.photo-grid figure:hover img {
  transform: scale(1.03);
}

.year-heading {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--subtle);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: var(--space-12);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}

/* ---------- Utility ---------- */
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: var(--space-8);
}

::selection {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--fg);
}

/* ---------- Focus styles (a11y) ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

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