/* =========================================================
   Portfolio Stylesheet
   Design tokens: warm paper background, chalkboard blue +
   spectrum amber accents, grotesk/mono type pairing.
   ========================================================= */

:root {
  /* Color */
  --bg: #FAFAF8;
  --bg-raised: #FFFFFF;
  --ink: #14171F;
  --ink-soft: #3A3F4B;
  --muted: #6B7280;
  --line: #E3E1DA;
  --accent: #2B4C7E;      /* chalkboard blue */
  --accent-ink: #1C3557;  /* darker blue for text/hover */
  --spectrum: #E8A33D;    /* amber, spectral-line accent */
  --spectrum-soft: #FBEBD1;

  /* Type */
  --font-display: "Space Grotesk", "Arial Narrow", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* Layout */
  --max-width: 1080px;
  --gutter: 24px;
  --radius: 3px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
p { margin: 0 0 1em; color: var(--ink-soft); }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

/* ---------- Utility label style (mono, tracked-out) ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--spectrum);
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.nav-brand span { color: var(--spectrum); }

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav-links a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  color: var(--muted);
  border-radius: var(--radius);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--accent); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 3px;
  height: 2px;
  background: var(--spectrum);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover { border-color: var(--ink); transform: translateY(-1px); }

/* ---------- Hero (home) ---------- */
.hero {
  position: relative;
  padding: 88px 0 64px;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 70%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 0%, black 70%, transparent 100%);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 56px;
  align-items: center;
}
.hero-photo-wrap {
  position: relative;
  justify-self: center;
}
.hero-photo {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  box-shadow: 0 24px 48px -24px rgba(20, 23, 31, 0.25);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.hero-name {
  font-size: clamp(34px, 5vw, 52px);
}
.hero-role {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}
.hero-bio {
  max-width: 46ch;
  font-size: 17px;
}

/* Signature wave divider */
.wave-divider {
  width: 100%;
  height: 48px;
  margin: 8px 0 0;
  overflow: visible;
}
.wave-divider path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-wave 1.6s ease forwards 0.2s;
}
@keyframes draw-wave {
  to { stroke-dashoffset: 0; }
}

.social-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.social-row a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.social-row a:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-1px);
}
.social-row svg { width: 15px; height: 15px; }

/* ---------- Section shell ---------- */
.section {
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
}
.section:last-of-type { border-bottom: none; }
.section-head {
  max-width: 60ch;
  margin-bottom: 40px;
}
.section-title { font-size: clamp(24px, 3vw, 32px); }

/* ---------- Education / Interests grid ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}
.info-card h3 {
  font-size: 18px;
  margin-bottom: 12px;
}
.edu-item {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px dashed var(--line);
}
.edu-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.edu-item .school {
  font-weight: 600;
  font-size: 15px;
}
.edu-item .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--spectrum-soft);
  color: #8A5A11;
}

/* ---------- Projects grid ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}
.project-card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -28px rgba(20, 23, 31, 0.35);
  border-color: var(--accent);
}
.project-thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.project-title { font-size: 18px; margin-bottom: 0; }
.project-desc { font-size: 14.5px; margin-bottom: 0; flex: 1; }
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.project-tags .tag {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-ink);
  margin-top: 4px;
}
.project-link svg { width: 14px; height: 14px; }
.project-link:hover { text-decoration: underline; }

/* ---------- Resume page ---------- */
.resume-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.resume-frame-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.resume-frame {
  width: 100%;
  height: 780px;
  border: none;
  display: block;
}
.resume-fallback {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---------- Contact page ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}
.contact-list a,
.contact-list .contact-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 14px;
}
.contact-list svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.contact-list a:hover { color: var(--accent-ink); }

.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-field textarea { resize: vertical; min-height: 130px; }
.form-note {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}
.form-success {
  display: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #1C6B3E;
  background: #E8F5EC;
  border: 1px solid #BFE6CC;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.form-success.visible { display: block; }

.form-error {
  display: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: #9C2B2B;
  background: #FBEAEA;
  border: 1px solid #EFC3C3;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.form-error.visible { display: block; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 36px 0 48px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-photo-wrap { order: -1; }
  .hero-bio { margin: 0 auto; }
  .social-row { justify-content: center; }
  .info-grid { grid-template-columns: 1fr; gap: 32px; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 8px var(--gutter) 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 4px; }
  .nav-toggle { display: flex; }
  .hero { padding: 56px 0 40px; }
  .hero-photo { width: 180px; height: 180px; }
  .section { padding: 52px 0; }
  .resume-frame { height: 520px; }
  .resume-toolbar { justify-content: center; text-align: center; }
}
