/* ============ Design tokens ============ */
:root {
  --color-bg: #faf8f4;
  --color-bg-alt: #f1ede3;
  --color-surface: #ffffff;
  --color-text: #201d18;
  --color-text-muted: #5c574c;
  --color-border: #e3ddce;
  --color-accent: #a8431d;
  --color-accent-strong: #7e3115;
  --color-accent-2: #234d3d;

  --font-serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-small: clamp(0.85rem, 0.83rem + 0.1vw, 0.9rem);
  --text-lede: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  --text-h1: clamp(2.2rem, 1.7rem + 2.2vw, 3.4rem);
  --text-h2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --text-h3: clamp(1.1rem, 1.02rem + 0.35vw, 1.3rem);

  --space-section: clamp(3rem, 2.4rem + 3vw, 6rem);
  --space-md: 1.25rem;
  --content-width: 42rem;
  --wide-width: 60rem;

  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============ Reset ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: var(--color-accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--color-accent-strong); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--color-accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
}
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
p {
  margin: 0 0 1.1em;
  line-height: 1.75;
  letter-spacing: 0.3px;
}
p:last-child { margin-bottom: 0; }

.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

/* ============ Header / nav ============ */
.site-header {
  padding-block: 1.25rem;
}
.site-header__inner {
  max-width: var(--wide-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.site-logo {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
  text-decoration: none;
}
.site-nav {
  display: flex;
  gap: clamp(0.9rem, 0.6rem + 1vw, 1.6rem);
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--color-text-muted);
  font-size: var(--text-small);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color var(--duration-fast) var(--ease-out-expo), border-color var(--duration-fast) var(--ease-out-expo);
}
.site-nav a:hover, .site-nav a:focus-visible {
  color: var(--color-accent);
  border-color: currentColor;
}

/* ============ Hero ============ */
.hero { padding-block: clamp(2rem, 1.5rem + 2vw, 4rem) var(--space-section); }
.hero__inner {
  max-width: var(--content-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: clamp(1.25rem, 1rem + 1vw, 2rem);
}
.hero__photo-wrap {
  position: relative;
  width: clamp(140px, 10vw + 90px, 200px);
  height: clamp(140px, 10vw + 90px, 200px);
  display: grid;
  place-items: center;
}
.hero__photo-wrap::before {
  content: '';
  position: absolute;
  z-index: 0;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--color-accent), var(--color-accent-2), var(--color-accent));
  opacity: 0.55;
}
.hero__photo-wrap::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: -4px;
  border-radius: 50%;
  background: var(--color-bg);
}
.hero__photo {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 12px 30px -14px rgba(32, 29, 24, 0.35);
}
.hero__eyebrow {
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.hero__heading { font-size: clamp(1.8rem, 1.4rem + 1.6vw, 2.6rem); margin-bottom: 0.4em; }
.hero__lede {
  font-size: var(--text-lede);
  color: var(--color-text-muted);
  max-width: 38rem;
  margin-inline: auto;
  text-align: left;
}

/* ============ Sections ============ */
section[id] { padding-block: var(--space-section); }
.section-marker {
  font-family: var(--font-sans);
  font-size: var(--text-small);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 0.75rem;
}
.section-intro { color: var(--color-text-muted); max-width: 36rem; }

#about p { font-size: 1.05rem; line-height: 1.8; }

/* ============ Timeline (career / education) ============ */
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1.75rem; }
.timeline__item {
  border-left: 2px solid var(--color-border);
  padding-left: 1.25rem;
  position: relative;
}
.timeline__item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 0.3em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
}
.timeline__meta {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  margin-bottom: 0.25em;
  font-variant-numeric: tabular-nums;
}
.timeline__item h3 { margin-bottom: 0.3em; }

/* ============ Projects grid ============ */
.project-grid {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 1.25rem;
}
.project-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  transition: transform var(--duration-normal) var(--ease-out-expo), box-shadow var(--duration-normal) var(--ease-out-expo);
}
.project-card:hover, .project-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px -18px rgba(32, 29, 24, 0.3);
}
.project-card--feature {
  grid-column: 1 / -1;
  background: var(--color-bg-alt);
}
.project-card__tag {
  font-size: var(--text-small);
  color: var(--color-accent-2);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.4em;
}
.project-card h3 { font-size: var(--text-h3); margin-bottom: 0.4em; }
.project-card h3 a { color: var(--color-text); text-decoration: none; }
.project-card h3 a:hover { color: var(--color-accent); }
.project-card p:last-child { color: var(--color-text-muted); }

/* ============ Writing preview + post list ============ */
.writing-preview, .post-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  display: grid;
  gap: 1.75rem;
}
.post-list {
  max-width: var(--wide-width);
  padding: 2rem 1.25rem;
}
.writing-preview__item, .post-list__item {
  transition: opacity var(--duration-fast) var(--ease-out-expo);
}
.writing-preview__item a, .post-list__item a {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 4px;
  display: inline-block;
  transition: all var(--duration-normal) var(--ease-out-expo);
}
.writing-preview__item a:hover, .post-list__item a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  padding-bottom: 6px;
}
.writing-preview__item p, .post-list__item p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-top: 0.5em;
  line-height: 1.65;
}
.writing-preview__date, .post-list__date {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  margin-top: 0.6em !important;
  display: block;
}

.page-intro {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: clamp(2rem, 1.5rem + 2vw, 4rem) 1.25rem 1rem;
}
.page-intro h1 {
  font-size: var(--text-h1);
}
.page-intro p {
  color: var(--color-text-muted);
  max-width: 38rem;
  font-size: var(--text-lede);
}

.post-group { max-width: var(--wide-width); margin: 0 auto; padding: 2rem 1.25rem; border-top: 1px solid var(--color-border); }
.post-group__blurb { color: var(--color-text-muted); max-width: 36rem; }

/* ============ Post page ============ */
.post { max-width: var(--content-width); margin: 0 auto; padding: clamp(2rem, 1.5rem + 2vw, 4rem) 1.25rem 4rem; }
.post__eyebrow a {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  text-decoration: none;
}
.post__eyebrow a:hover { color: var(--color-accent); }
.post__header h1 {
  font-size: var(--text-h1);
  margin-top: 0.5em;
  line-height: 1.25;
}
.post__date {
  font-size: var(--text-small);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5em;
}
.post__summary {
  font-size: var(--text-lede);
  color: var(--color-text-muted);
  border-left: 4px solid var(--color-accent);
  padding-left: 1.25em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
  margin-top: 1.5em;
  margin-bottom: 2em;
  line-height: 1.7;
}
.post__body { line-height: 1.8; }
.post__body h2 {
  margin-top: 2.5em;
  margin-bottom: 0.75em;
  padding-top: 0.5em;
}
.post__body h3 {
  margin-top: 2em;
  margin-bottom: 0.75em;
}
.post__body ul, .post__body ol {
  padding-left: 1.5em;
  margin-bottom: 1.25em;
}
.post__body li {
  margin-bottom: 0.75em;
  line-height: 1.7;
}
/* ============ Tags ============ */
.tag {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.35em 0.7em;
  margin-right: 0.5em;
  margin-bottom: 0.4em;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out-expo);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag:hover {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.post-list__tags, .post__tags, .writing-preview__tags {
  margin: 0.5em 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em;
}


/* ============ Footer ============ */
.site-footer { padding-block: 2.5rem; border-top: 1px solid var(--color-border); margin-top: var(--space-section); }
.site-footer__inner {
  max-width: var(--wide-width);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: var(--text-small);
  color: var(--color-text-muted);
}
.site-footer__links a { color: var(--color-text-muted); margin-left: 1rem; text-decoration: none; }
.site-footer__links a:first-child { margin-left: 0; }
.site-footer__links a:hover { color: var(--color-accent); }

/* ============ Responsive ============ */
@media (max-width: 640px) {
  .site-header__inner { flex-direction: column; align-items: flex-start; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
  .project-card:hover { transform: none; }
}
