/* ── Design tokens ── */
:root {
  --bg: #f5f0e6;
  --paper: #ffffff;
  --ink: #1a1814;
  --muted: #6b6358;
  --rule: #d9cfbf;
  --accent: #1a4f7a;
  --card-bg: #ffffff;
  --hero-overlay: rgba(26, 24, 20, 0.35);
  --thumb-bg: #d9cfbf;
}
.dark, :root.dark {
  --bg: #1a1814;
  --paper: #221f1a;
  --ink: #e8dfd0;
  --muted: #8a8174;
  --rule: #3a342c;
  --accent: #6ea8d8;
  --card-bg: #2a2620;
  --hero-overlay: rgba(0, 0, 0, 0.5);
  --thumb-bg: #3a342c;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

/* ── Typography ── */
h1, h2, h3 {
  font-family: "Iowan Old Style", "Charter", Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
h1 { font-size: 2.8rem; margin: 0 0 0.25rem; }
h2 {
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.15rem; margin: 0 0 0.3rem; }
p { margin: 0 0 1rem; }
.subtitle { font-size: 1.1rem; color: var(--muted); margin: 0; }
.muted { color: var(--muted); font-size: 0.9rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { opacity: 0.8; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Layout ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Nav ── */
.nav { display: flex; gap: 1.5rem; }
.nav-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.nav-link:hover { border-color: var(--accent); opacity: 1; }

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.theme-toggle:hover { background: var(--rule); }

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0 4rem;
  align-items: center;
}
.hero-image {
  aspect-ratio: 4 / 3;
  background: var(--thumb-bg);
  border-radius: 4px;
  background-image: linear-gradient(135deg, var(--thumb-bg) 0%, var(--muted) 100%);
  min-height: 300px;
}
.hero-text { padding: 1rem 0; }

/* ── Work / Project grid ── */
.work { margin-bottom: 4rem; }
.project-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
.project {
  background: var(--card-bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--rule);
  transition: box-shadow 0.2s;
}
.project:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.08); }
.project-thumb {
  aspect-ratio: 16 / 10;
  background: var(--thumb-bg);
  background-image: linear-gradient(135deg, var(--thumb-bg) 0%, var(--muted) 100%);
}
.project-info { padding: 1.2rem; }
.project-meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}
.project-info p { font-size: 0.9rem; margin: 0; }

/* ── About ── */
.about { margin-bottom: 4rem; }
.about-body {
  max-width: 65ch;
  font-size: 1.05rem;
}

/* ── Contact ── */
.contact { margin-bottom: 4rem; }
form {
  max-width: 480px;
  margin-bottom: 1rem;
}
.field {
  margin-bottom: 1rem;
}
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--ink);
}
input, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  background: var(--card-bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  transition: border-color 0.2s;
}
input:focus, textarea:focus {
  border-color: var(--accent);
  outline: none;
}
button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.65rem 1.8rem;
  font: inherit;
  font-size: 0.95rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s;
}
button[type="submit"]:hover { opacity: 0.85; }
.form-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--accent);
}

/* ── Footer ── */
footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
footer .attribution { font-size: 0.75rem; opacity: 0.7; }
footer p { margin: 0; }

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

/* ── Mobile ── */
@media (max-width: 700px) {
  h1 { font-size: 2rem; }
  .hero {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0 2.5rem;
  }
  .hero-image { min-height: 220px; }
  .project-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  header { padding: 0.8rem 1rem; }
  main { padding: 0 1rem; }
  footer { flex-direction: column; text-align: center; }
}
