:root {
  --bg: #0f0d0a;
  --bg-alt: #16130d;
  --card: #1a160f;
  --border: #332c1d;
  --border-soft: #241f15;
  --text: #f3ede0;
  --text-dim: #ab9d80;
  --accent: #d4a24e;
  --accent-strong: #eabb6c;
  --accent-ink: #241a06;
  --accent-2: #4f8a6d;
  --accent-2-strong: #6bab89;
  --danger: #d9694a;
  --max-width: 1080px;
  --font-display: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #faf6ec;
    --bg-alt: #ffffff;
    --card: #ffffff;
    --border: #e6dcc3;
    --border-soft: #efe8d5;
    --text: #211c12;
    --text-dim: #6f6248;
    --accent: #a8752e;
    --accent-strong: #8a5f24;
    --accent-ink: #ffffff;
    --accent-2: #2f6b4f;
    --accent-2-strong: #24543e;
    --danger: #b8452c;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  scroll-behavior: smooth;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

/* Scroll progress bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  z-index: 100;
  transition: width 0.1s linear;
}

/* Nav */
nav.site-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
nav.site-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
  padding-bottom: 6px;
}
.nav-brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: var(--text);
  flex-shrink: 0;
}
.nav-links { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  color: var(--text-dim);
  font-size: 0.88rem;
  white-space: nowrap;
  position: relative;
  padding: 10px 0 8px;
  transition: color 0.25s var(--ease);
}
.nav-links a:hover { color: var(--accent); text-decoration: none; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: -3px;
  height: 1px;
  background: var(--accent);
  transition: right 0.3s var(--ease);
}
.nav-links a:hover::after { right: 0; }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after { right: 0; }

@media (max-width: 640px) {
  nav.site-nav .container { gap: 14px; }
  .nav-links { gap: 16px; font-size: 0.84rem; }
}

/* Hero */
.hero {
  position: relative;
  padding: 100px 0 72px;
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -220px;
  left: 50%;
  transform: translateX(-62%);
  width: 900px;
  height: 560px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--accent) 18%, transparent) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}
.hero .container { position: relative; z-index: 1; }

@media (max-width: 640px) {
  .hero { padding: 52px 0 44px; }
  section { padding: 44px 0; }
  .hero-meta { font-size: 0.85rem; gap: 8px 16px; }
  .hero-actions .btn { flex: 1 1 auto; text-align: center; }
}
.hero-eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  margin: 0 0 10px;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hero .role {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-dim);
  margin-bottom: 22px;
}
.hero .tagline {
  max-width: 640px;
  color: var(--text-dim);
  margin-bottom: 30px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 30px;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.94rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: var(--accent-ink);
  box-shadow: 0 1px 0 0 color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:hover { box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

/* Sections */
section { padding: 72px 0; border-bottom: 1px solid var(--border-soft); }
section:last-of-type { border-bottom: none; }
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.7rem;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.section-sub {
  color: var(--text-dim);
  margin: 0 0 36px;
  max-width: 640px;
}

/* About */
.about-text { color: var(--text-dim); max-width: 760px; }

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
@media (max-width: 360px) {
  .skills-grid { grid-template-columns: 1fr; }
}
.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.skill-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateY(-2px); }
.skill-card h3 {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.skill-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-tag {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.82rem;
  color: var(--text-dim);
}

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 36px; }
.timeline-item {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
}
.timeline-date {
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding-top: 4px;
}
.timeline-content h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 2px; font-size: 1.15rem; }
.timeline-content .subtitle { color: var(--accent); font-size: 0.9rem; margin-bottom: 4px; }
.timeline-content .loc { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 10px; }
.timeline-content .desc { color: var(--text-dim); margin-bottom: 12px; }
.timeline-content ul { margin: 0; padding-left: 20px; color: var(--text-dim); }
.timeline-content li { margin-bottom: 6px; font-size: 0.92rem; }

@media (max-width: 640px) {
  .timeline-item { grid-template-columns: 1fr; gap: 6px; }
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
@media (max-width: 360px) {
  .projects-grid { grid-template-columns: 1fr; }
}
.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
.project-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  box-shadow: 0 16px 32px -18px rgba(0, 0, 0, 0.45);
}
.project-thumb {
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 600;
  color: #fff8e8dd;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
}
.project-body { padding: 18px 20px; flex: 1; display: flex; flex-direction: column; }
.project-body h3 { font-family: var(--font-display); font-weight: 600; margin: 0 0 4px; font-size: 1.08rem; }
.project-client { color: var(--accent); font-size: 0.78rem; font-weight: 600; margin-bottom: 8px; }
.project-body p { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 14px; flex: 1; }
.project-link { display: inline-block; margin-top: 12px; font-size: 0.85rem; font-weight: 600; }
.tech-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-tag {
  font-size: 0.72rem;
  color: var(--text-dim);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
}
.featured-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--bg);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--accent);
}
.project-thumb-wrap { position: relative; }

/* Contact */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.contact-info p { color: var(--text-dim); }
.contact-links { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
form.contact-form { display: flex; flex-direction: column; gap: 14px; }
.contact-form input, .contact-form textarea {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem; /* 16px: below this, iOS Safari auto-zooms the page on focus */
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.contact-form textarea { min-height: 120px; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.form-status { font-size: 0.88rem; min-height: 20px; }
.form-status.ok { color: var(--accent-2); }
.form-status.err { color: var(--danger); }

@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; }
}

footer {
  padding: 32px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Scroll-reveal + entrance animation */
.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

.reveal-item {
  opacity: 0;
  transform: translateY(26px) scale(0.98);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal-item.is-visible { opacity: 1; transform: translateY(0) scale(1); }

.hero-eyebrow, .hero h1, .hero .role, .hero .tagline, .hero-meta, .hero-actions {
  opacity: 0;
  animation: rise-in 0.8s var(--ease) forwards;
}
.hero-eyebrow { animation-delay: 0.05s; }
.hero h1 { animation-delay: 0.14s; }
.hero .role { animation-delay: 0.22s; }
.hero .tagline { animation-delay: 0.3s; }
.hero-meta { animation-delay: 0.38s; }
.hero-actions { animation-delay: 0.46s; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal-item { opacity: 1; transform: none; }
  .hero-eyebrow, .hero h1, .hero .role, .hero .tagline, .hero-meta, .hero-actions { opacity: 1; animation: none; }
}
