:root {
  --bg: #f5f0e6;
  --paper: #ffffff;
  --ink: #1a1814;
  --muted: #6b6358;
  --rule: #d9cfbf;
  --accent: #1a4f7a;
  --card-bg: #ffffff;
}
[data-theme="dark"] {
  --bg: #1a1814;
  --paper: #221f1a;
  --ink: #e8dfd0;
  --muted: #8a8174;
  --rule: #3a342c;
  --accent: #6ea8d8;
  --card-bg: #2a2620;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #1a1814;
    --paper: #221f1a;
    --ink: #e8dfd0;
    --muted: #8a8174;
    --rule: #3a342c;
    --accent: #6ea8d8;
    --card-bg: #2a2620;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  max-width: 80ch;
  margin: 0 auto;
  padding: 1.5rem;
}
h1, h2, h3 {
  font-family: "Iowan Old Style", "Charter", Georgia, serif;
  letter-spacing: -0.01em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
h1 { font-size: 2.5rem; margin-top: 0; }
h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.3em;
  margin-bottom: 1em;
}
h3 { font-size: 1.15rem; margin-top: 0; }
.muted { color: var(--muted); }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { opacity: 0.8; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}
.logo {
  font-weight: 600;
  font-size: 0.95rem;
  margin-right: auto;
}
.nav-links {
  display: flex;
  gap: 1.25rem;
}
.nav-links a {
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--muted);
}
.nav-links a:hover {
  color: var(--ink);
}
.theme-btn {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink);
}
.theme-btn:hover {
  border-color: var(--accent);
}

/* Hero */
.hero {
  margin-bottom: 3rem;
}
.tagline {
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: -0.25em;
}
.hero-desc {
  font-size: 1rem;
  max-width: 55ch;
}

/* Project grid */
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 600px) {
  .project-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.project-card {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.project-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.project-info {
  padding: 1rem 1.25rem 1.25rem;
}
.project-info h3 {
  margin-bottom: 0.3em;
}
.project-info p {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.project-link {
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

/* Sections */
section {
  margin-bottom: 3rem;
  scroll-margin-top: 1.5rem;
}

/* Contact form */
.form-row {
  margin-bottom: 1rem;
}
.form-row label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--muted);
}
.form-row input,
.form-row textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(26,79,122,0.15);
}
.submit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.submit-btn:hover {
  opacity: 0.85;
}
.form-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.footer-inner p { margin: 0.15rem 0; }
.footer-links {
  display: flex;
  gap: 1rem;
}
.footer-links a {
  text-decoration: none;
  font-size: 0.85rem;
}
footer .attribution {
  font-size: 0.75rem;
  opacity: 0.7;
  text-align: center;
  margin: 0.5rem 0 0;
}

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