/* ── Tokens ───────────────────────────────────────────────────────── */
:root {
  --paper:      #E8E2CE;
  --paper-mid:  #DDD6BF;
  --paper-dark: #CEC7AF;
  --paper-deep: #C5BC9E;
  --ink:        #221C10;
  --ink-soft:   #4A4132;
  --ink-muted:  #7A7060;
  --ink-faint:  #A89E8C;
  --accent:     #4E4A8C;
  --accent-lt:  #E8E7F2;
  --sage:       #4E6B55;
  --sage-lt:    #E3EDE5;
  --terra:      #8B4E30;
  --terra-lt:   #EDE4DC;
  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Figtree', system-ui, sans-serif;
  --rule: rgba(34,28,16,0.11);
  --r: 20px;
  --r-sm: 14px;
  --r-pill: 999px;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; background-color: var(--paper); }

/* ── Paper body ──────────────────────────────────────────────────── */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
  min-height: 100vh;
  position: relative;
}

/* Grain layer */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='1'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.055;
  mix-blend-mode: multiply;
}

/* Vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: radial-gradient(ellipse at 50% 0%, transparent 55%, rgba(34,28,16,0.06) 100%);
}

/* ── Layout ──────────────────────────────────────────────────────── */
.wrap { max-width: 820px; margin: 0 auto; padding: 0 2rem; }
.wide { max-width: 1040px; margin: 0 auto; padding: 0 2rem; }

/* ── Nav ─────────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper); /* Solid background to prevent notch bleed */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(34,28,16,0.07);
  padding-top: env(safe-area-inset-top);
}
/* The Notch Shield — Projects background up into the status bar area */
nav::before {
  content: "";
  position: absolute;
  top: -100px;
  left: 0;
  width: 100%;
  height: 100px;
  background: inherit;
  pointer-events: none;
}
.nav-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-name {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-name em { font-style: italic; color: var(--accent); }
.nav-links { display: flex; gap: 1.75rem; list-style: none; }
.nav-links a {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.18s;
}
.nav-links a:hover { color: var(--ink); }

.nav-social {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: 1rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
}
.nav-social a {
  font-size: 1.1rem;
  color: var(--ink-muted);
  transition: color 0.18s;
  display: flex;
}
.nav-social a:hover { color: var(--ink); }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  padding: 7rem 0 6rem;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 5rem;
  align-items: center;
}
.hero-kicker {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.8rem, 5.5vw, 4.2rem);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 1.75rem;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 200;
}
.hero-bio {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.8;
  max-width: 46ch;
  margin-bottom: 2.25rem;
}
.hero-actions { display: flex; align-items: center; gap: 1.5rem; }
.btn {
  font-family: var(--sans);
  font-size: 0.83rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--r-pill);
  padding: 0.6rem 1.4rem;
  transition: all 0.18s;
  display: inline-block;
  cursor: pointer;
  border: none;
}
.btn-fill {
  background: var(--ink);
  color: var(--paper);
}
.btn-fill:hover { opacity: 0.78; }
.btn-outline {
  color: var(--ink-soft);
  background: var(--paper-mid);
}
.btn-outline:hover {
  background: var(--paper-dark);
  color: var(--ink);
}

/* Photo card */
.photo-card {
  position: relative;
}
.photo-wrap {
  background: var(--paper-dark);
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 4/5;
  position: relative;
}
.photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(12%) contrast(0.96) brightness(1.02);
}

.photo-stamp {
  position: absolute;
  bottom: -1rem;
  right: -1rem;
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 0.65rem 1rem;
  box-shadow: 0 4px 20px rgba(34,28,16,0.12);
}
.photo-stamp .city {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
}
.photo-stamp .role {
  font-family: var(--serif);
  font-size: 0.88rem;
  color: var(--ink);
  font-weight: 400;
  font-style: italic;
  display: block;
  margin-top: 0.1rem;
}

/* Available dot */
.avail {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sage);
  background: var(--sage-lt);
  padding: 0.35rem 0.8rem;
  border-radius: var(--r-pill);
  letter-spacing: 0.01em;
}
.avail-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--sage);
  animation: blink 2.2s infinite;
}
 @keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ── Divider ─────────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid rgba(34,28,16,0.07);
  margin: 0;
}

/* ── Sections ────────────────────────────────────────────────────── */
section { padding: 6.5rem 0; }
.section-head {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin-bottom: 3rem;
}
.section-num {
  font-family: var(--serif);
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-faint);
  font-weight: 300;
  flex-shrink: 0;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
}
.section-title em { font-style: italic; color: var(--accent); }
.section-rule {
  flex: 1;
  height: 1px;
  background: rgba(34,28,16,0.07);
  align-self: center;
}

/* ── Tags ────────────────────────────────────────────────────────── */
.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.7rem;
  border-radius: var(--r-pill);
  display: inline-block;
}
.ti { background: var(--accent-lt); color: var(--accent); }
.ts { background: var(--sage-lt);   color: var(--sage); }
.tt { background: var(--terra-lt);  color: var(--terra); }
.tn { background: var(--paper-mid); color: var(--ink-soft); }

/* ── About stats — M3 surface container, no borders ─────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 4rem;
  align-items: start;
}
.about-body {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.85;
}
.about-body p + p { margin-top: 1rem; }
.about-body strong { font-weight: 400; color: var(--ink); }

.about-photo {
  margin-top: 2rem;
  max-width: 240px;
  position: relative;
  transform: rotate(-1.5deg);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.about-photo:hover {
  transform: rotate(0deg) scale(1.03);
}
.about-photo img {
  width: 100%;
  display: block;
  box-shadow: 0 8px 30px rgba(34,28,16,0.12);
  filter: sepia(5%) contrast(1.02);
}
/* Caption below photo */
.photo-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 0.75rem;
  text-align: center;
  transform: rotate(1deg);
}

.about-aside {
  display: flex;
  flex-direction: column;
  background: var(--paper-mid);
  border-radius: 28px;
  overflow: hidden;
  padding: 0.5rem 0;
}
.aside-stat {
  padding: 1.1rem 1.4rem;
  position: relative;
}
/* Inset separators for the academic look */
.aside-stat:not(:last-child)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 1.4rem;
  right: 1.4rem;
  height: 1px;
  background: rgba(34,28,16,0.07);
}
.aside-stat .n {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 300;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 0.3rem;
}
.aside-stat .n em { font-style: italic; color: var(--accent); }
.aside-stat .l {
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  text-transform: uppercase;
}

/* ── Timeline ────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: grid;
  grid-template-columns: 140px 1px 1fr;
  gap: 0 2rem;
  padding-bottom: 3rem;
  position: relative;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-date {
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--ink-faint);
  text-align: right;
  padding-top: 0.25rem;
  line-height: 1.5;
}
.tl-line {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tl-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent-lt);
  border: 2px solid var(--accent);
  flex-shrink: 0;
  margin-top: 0.25rem;
  position: relative;
  z-index: 1;
  opacity: 0.75;
}
.tl-line::after {
  content: '';
  position: absolute;
  top: 1.2rem;
  bottom: -3rem;
  width: 1px;
  background: linear-gradient(to bottom, rgba(34,28,16,0.1), rgba(34,28,16,0.04));
  left: 50%;
  transform: translateX(-50%);
}
.tl-item:last-child .tl-line::after { display: none; }
.tl-body {}
.tl-org {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.tl-role {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.45rem;
}
.tl-loc {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-weight: 400;
  margin-bottom: 0.65rem;
}
.tl-desc {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.72;
  font-weight: 300;
  max-width: 56ch;
  margin-bottom: 0.85rem;
}

/* Tab switcher — M3 segmented button */
.tab-bar {
  display: inline-flex;
  gap: 0;
  margin-bottom: 2.75rem;
  background: var(--paper-mid);
  border-radius: var(--r-pill);
  padding: 4px;
  position: relative;
  isolation: isolate;
}
.tab-btn {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-muted);
  background: none;
  border: none;
  padding: 0.45rem 1.2rem;
  cursor: pointer;
  border-radius: var(--r-pill);
  transition: color 0.25s;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 2;
  min-width: 100px;
}
.tab-btn.active {
  color: var(--ink);
}

.tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  background: var(--paper);
  border-radius: var(--r-pill);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s;
  z-index: 1;
  box-shadow: 0 2px 8px rgba(34,28,16,0.06);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Work grid ───────────────────────────────────────────────────── */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.work-card {
  background: var(--paper-mid);
  border-radius: var(--r);
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.25s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.work-card:hover {
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 12px 40px rgba(34,28,16,0.09);
}
.work-card-img {
  height: 170px;
  background: var(--paper-dark);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.work-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(18%) contrast(0.92) brightness(1.03);
}
.work-card-img svg { opacity: 0.15; }
.work-card-body { padding: 1.4rem 1.5rem 1.6rem; }
.work-card-body .w-date {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.5rem;
}
.work-card-body h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-bottom: 0.55rem;
}
.work-card-body p {
  font-family: var(--serif);
  font-size: 0.87rem;
  font-weight: 300;
  color: var(--ink-soft);
  line-height: 1.65;
  margin-bottom: 1rem;
}

/* ── Code block ──────────────────────────────────────────────────── */
.code-wrap {
  background: #1E1A11;
  border-radius: var(--r);
  padding: 1.5rem 1.75rem;
  overflow-x: auto;
  position: relative;
  border: 1px solid rgba(34,28,16,0.35);
  margin: 0;
}
.code-wrap::before {
  content: attr(data-lang);
  position: absolute;
  top: 0.65rem;
  right: 1rem;
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.2);
}
.code-wrap code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.75;
  color: #CEC9BE;
}
.kw  { color: #9B96CF; }
.fn  { color: #C4B79E; }
.str { color: #8FAF7A; }
.cm  { color: #5A5549; font-style: italic; }
.nm  { color: #C47A5A; }

/* ── Pull quote ──────────────────────────────────────────────────── */
.pull-quote {
  padding: 2rem 2.5rem;
  border-left: 2px solid var(--paper-deep);
  margin: 2.5rem 0;
  background: var(--paper-mid);
  border-radius: 0 var(--r) var(--r) 0;
}
.pull-quote blockquote {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.65;
  letter-spacing: -0.01em;
}
.pull-quote cite {
  display: block;
  margin-top: 0.75rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-style: normal;
}

/* ── Modal ───────────────────────────────────────────────────────── */
.services__modal {
    position: fixed;
    inset: 0;
    background: rgba(34,28,16,0.3);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.active-modal {
    opacity: 1;
    visibility: visible;
}

.resume__modal-content {
    background: var(--paper);
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    border-radius: 32px;
    padding: 4rem 2.5rem 2.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(20,20,19,0.2);
}

.services__modal-close {
    position: absolute;
    top: 1.75rem;
    right: 1.75rem;
    font-size: 1.75rem;
    color: var(--ink-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.resume__iframe-container {
    height: 75vh;
    border-radius: 16px;
    overflow: hidden; /* This clips the scrollbar */
    position: relative;
    background: var(--paper); /* Match doc background */
}

.resume__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% + 18px); /* Push scrollbar off-edge */
    height: 100%;
    border: none;
    -webkit-overflow-scrolling: touch;
}

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  padding: 4rem 0 3rem;
  border-top: 1px solid var(--rule);
}
.footer-base {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-weight: 400;
}
.footer-links-left {
  display: flex;
  gap: 1.5rem;
}
.footer-links-left a {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.18s;
}
.footer-links-left a:hover { color: var(--ink); }

/* ── Responsive ──────────────────────────────────────────────────── */
 @media (max-width: 860px) {
  .hero { padding: 1.5rem 0 2rem; }
  .hero-grid { display: flex; flex-direction: column; gap: 1.25rem; text-align: center; }
  .hero-data { display: contents; }
  .hero-kicker { order: 1; margin-bottom: 0.75rem; }
  .hero h1 { order: 2; margin-left: auto; margin-right: auto; margin-bottom: 1rem; font-size: 2.8rem; }
  .hero-bio { order: 3; margin-left: auto; margin-right: auto; margin-bottom: 1.25rem; }
  .hero-actions { order: 4; justify-content: center; gap: 1rem; }
  .photo-card { order: 5; max-width: 160px; margin: 0.5rem auto; }
  .hero-status { order: 6; margin-top: 0.5rem !important; }
  .about-grid { grid-template-columns: 1fr; gap: 3rem; text-align: center; }
  .hero h1 { margin-left: auto; margin-right: auto; }
  .hero-bio { margin-left: auto; margin-right: auto; }
  .hero-actions { justify-content: center; }
  /* Ensure face is visible in hero crop */
  .hero .photo-wrap img { object-position: center 20%; }
  .work-grid { grid-template-columns: 1fr; }
  .footer-base { flex-direction: column; gap: 1.5rem; text-align: center; }
  .footer-links-left { justify-content: center; }
  .about-aside { max-width: 300px; margin: 0 auto; }
}

 @media (max-width: 580px) {
  .wrap, .wide { padding: 0 1.5rem; }
  .nav-inner { padding: 0 1.5rem; }
  .nav-links li:not(.nav-social) { display: none; } /* Hide text links on very small screens, keep socials */
  .tl-item { grid-template-columns: 90px 1px 1fr; gap: 0 1.25rem; }
  .tl-date { text-align: left; font-size: 0.7rem; }
  .hero h1 { font-size: 2.6rem; }
  .pull-quote { padding: 1.5rem 1.75rem; }
}

/* ── Fade-in ─────────────────────────────────────────────────────── */
 @keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.r1 { animation: rise 0.6s ease both; }
.r2 { animation: rise 0.6s 0.08s ease both; }
.r3 { animation: rise 0.6s 0.16s ease both; }
.r4 { animation: rise 0.6s 0.24s ease both; }
.r5 { animation: rise 0.6s 0.32s ease both; }
.r6 { animation: rise 0.6s 0.40s ease both; }
.r7 { animation: rise 0.6s 0.48s ease both; }
.r8 { animation: rise 0.6s 0.56s ease both; }
.r9 { animation: rise 0.6s 0.64s ease both; }
.r10 { animation: rise 0.6s 0.72s ease both; }
.r11 { animation: rise 0.6s 0.80s ease both; }
.r12 { animation: rise 0.6s 0.88s ease both; }
.r13 { animation: rise 0.6s 0.96s ease both; }
.r14 { animation: rise 0.6s 1.04s ease both; }
.r15 { animation: rise 0.6s 1.12s ease both; }

/* ── Scroll Up ───────────────────────────────────────────────────── */
.scrollup {
  position: fixed;
  right: 2.5rem;
  bottom: -20%;
  background: var(--ink-soft);
  padding: 0.5rem;
  border-radius: 12px;
  display: flex;
  z-index: 100;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(34,28,16,0.15);
}
.scrollup:hover {
  transform: translateY(-0.3rem);
  background: var(--ink);
}
.scroll__icon {
  font-size: 1.5rem;
  color: var(--paper);
}
.show-scroll {
  bottom: 3rem;
}

@media (max-width: 580px) {
  .scrollup {
    right: 1.5rem;
    bottom: -20%;
  }
  .show-scroll {
    bottom: 2rem;
  }
}