@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #fdfcfa;
  --bg-alt: #f7f5f2;
  --fg: #1a1a1a;
  --muted: #6b6860;

  --rose: #c45d5d;
  --rose-soft: #f5e8e8;
  --rose-muted: #d4a5a5;

  --sage: #5d8a6b;
  --sage-soft: #e8f0ea;
  --sage-muted: #a5c4ad;

  --gold: #b8860b;
  --gold-soft: #f5f0e0;
  --gold-muted: #d4c4a0;

  --border: #e8e5e0;
  --border-dark: #d0cdc8;
  --max-width: 900px;
  --radius: 12px;
  --radius-sm: 6px;
}

[data-theme="dark"] {
  --bg: #1a1a1f;
  --bg-alt: #232328;
  --fg: #e8e5e0;
  --muted: #a09a90;

  --rose: #e07070;
  --rose-soft: #3a2525;
  --rose-muted: #8a5555;

  --sage: #7ab08a;
  --sage-soft: #253028;
  --sage-muted: #5a8a65;

  --gold: #d4a020;
  --gold-soft: #302a18;
  --gold-muted: #8a7a40;

  --border: #333338;
  --border-dark: #444448;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration-color: var(--border-dark);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
a:hover { color: var(--rose); text-decoration-color: var(--rose-muted); }

::selection { background: var(--rose-soft); color: var(--fg); }

h1, h2, h3 {
  font-family: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  font-weight: 400;
  margin: 0;
  color: var(--fg);
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
}

/* Grain texture overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { opacity: 0.015; }

/* ---------- header ---------- */

header.site {
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  z-index: 10;
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.site-name {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 19px;
  font-weight: 500;
  color: var(--fg);
}
.site-name:hover { color: var(--rose); text-decoration: none; }

nav.site-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
nav.site-nav a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
nav.site-nav a:hover { color: var(--fg); text-decoration: none; }
nav.site-nav a.current { color: var(--rose); }

.theme-toggle {
  background: none;
  border: 1px solid var(--gold-muted);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--gold);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { transform: rotate(20deg); }

/* ---------- hero / intro ---------- */

.intro {
  padding: 56px 0 40px;
  border-bottom: 1px solid var(--border);
}
.intro h1 {
  font-size: 34px;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.intro p {
  max-width: 640px;
  color: var(--muted);
  font-size: 17px;
  margin: 0;
}
.intro .links {
  margin-top: 18px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---------- project list (home) ---------- */

.project-list {
  padding: 10px 0 60px;
}

.project-entry {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  padding: 36px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.project-entry .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.project-entry .thumb img,
.project-entry .thumb svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.project-entry .thumb-link { display: block; height: 100%; }

.entry-title {
  font-size: 22px;
  margin-bottom: 6px;
}
.entry-title a { color: var(--fg); }
.entry-title a:hover { color: var(--rose); text-decoration: none; }

.entry-meta {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 14px;
}

.entry-desc p { margin: 0 0 10px; color: var(--fg); }
.entry-desc p:last-child { margin-bottom: 0; }

.tag-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ---------- project detail page ---------- */

.project-header {
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--border);
}
.project-header .kicker {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rose);
  margin-bottom: 10px;
}
.project-header h1 {
  font-size: 32px;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  max-width: 780px;
}
.project-header .subtitle {
  color: var(--muted);
  font-size: 18px;
  max-width: 680px;
  margin-bottom: 20px;
  font-family: 'Inter', sans-serif;
}
.project-header .meta-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  font-size: 14px;
}
.project-header .meta-row div { color: var(--muted); }
.project-header .meta-row strong {
  display: block;
  color: var(--fg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}
.project-header .links {
  margin-top: 22px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--rose);
}
.project-header .links a::after { content: " \2197"; }

.project-body {
  padding: 40px 0 70px;
  max-width: 760px;
}
.project-body h2 {
  font-size: 22px;
  margin: 40px 0 14px;
  position: relative;
  padding-left: 1rem;
}
.project-body h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 4px;
  height: 1em;
  background: linear-gradient(180deg, var(--rose), var(--gold));
  border-radius: 2px;
}
.project-body h2:first-child { margin-top: 0; }
.project-body p { margin: 0 0 16px; }
.project-body ul { padding-left: 22px; margin: 0 0 16px; }
.project-body li { margin-bottom: 6px; }
.project-body li::marker { color: var(--rose); }
.project-body code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--rose-soft);
  color: var(--rose);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
.project-body figure {
  margin: 28px 0;
  max-width: 900px;
}
.project-body figure img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}
.project-body figcaption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}
.figure-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.callout {
  border-left: 3px solid var(--sage);
  padding: 4px 20px;
  margin: 26px 0;
  color: var(--fg);
  background: var(--sage-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- about page ---------- */

.about-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--border);
}
.about-header h1 { font-size: 32px; letter-spacing: -0.02em; margin-bottom: 14px; }
.about-header .subtitle {
  color: var(--muted);
  font-size: 18px;
  max-width: 620px;
  margin: 0;
  font-family: 'Inter', sans-serif;
}

.about-body {
  padding: 40px 0 70px;
  max-width: 680px;
}
.about-body p { margin: 0 0 16px; }
.about-body h2 {
  font-size: 22px;
  margin: 44px 0 14px;
  position: relative;
  padding-left: 1rem;
}
.about-body h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 4px;
  height: 1em;
  background: linear-gradient(180deg, var(--rose), var(--gold));
  border-radius: 2px;
}
.about-body h2:first-child { margin-top: 0; }

.facts-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  font-size: 14px;
  margin: 26px 0 30px;
  padding: 20px 24px;
  background: var(--bg-alt);
  border-left: 3px solid var(--rose);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.facts-row div { color: var(--muted); }
.facts-row strong {
  display: block;
  color: var(--fg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
}

.pull-quote {
  font-family: 'Newsreader', Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  color: var(--fg);
  max-width: 600px;
  margin: 34px 0;
  padding-left: 22px;
  border-left: 3px solid var(--gold);
}

.about-body .tag-row { margin: 0 0 16px; }

/* ---------- footer ---------- */

footer.site {
  border-top: 1px solid var(--border);
  padding: 26px 0 60px;
  font-size: 13px;
  color: var(--muted);
}
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--rose); }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .project-entry { grid-template-columns: 1fr; }
  .figure-row { grid-template-columns: 1fr; }
  .intro h1 { font-size: 27px; }
  .project-header h1 { font-size: 26px; }
}

@media (max-width: 600px) {
  header.site .wrap { padding: 0 20px; }
  nav.site-nav { gap: 16px; }
}
