/* ============================================================
   Variables
   ============================================================ */
:root {
  --bg: #0d0d0d;
  --bg-alt: #111111;
  --bg-card: #161616;
  --border: #242424;
  --text: #e5e5e5;
  --text-muted: #888888;
  --text-dim: #4a4a4a;
  --accent: #d4a853;
  --accent-dim: rgba(212, 168, 83, 0.12);
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --max-w: 52rem;
  --header-h: 3.75rem;
  --radius: 6px;
  --ease: 0.2s ease;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; }

/* ============================================================
   Typography utilities
   ============================================================ */
.mono { font-family: var(--font-mono); }
a { color: var(--accent); text-decoration: none; transition: opacity var(--ease); }
a:hover { opacity: 0.75; }
strong { font-weight: 600; color: var(--text); }

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--ease), box-shadow var(--ease);
  padding-top: env(safe-area-inset-top, 0px);
}
.site-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 32px rgba(0, 0, 0, 0.5);
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.08em;
  opacity: 1;
  transition: opacity var(--ease);
}
.header-logo:hover { opacity: 0.65; }
.header-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-link {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  position: relative;
  transition: color var(--ease);
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.25s ease;
}
.nav-link:hover { color: var(--text); opacity: 1; }
.nav-link:hover::after { width: 100%; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text-muted);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.hamburger:hover span { background: var(--text); }
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  background: rgba(13, 13, 13, 0.98);
  border-top: 1px solid var(--border);
  padding: 0.5rem 1.5rem 1.25rem;
}
.mobile-menu.open { display: flex; }
.mobile-nav-link {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.05em;
  transition: color var(--ease);
}
.mobile-nav-link:last-child { border-bottom: none; }
.mobile-nav-link:hover { color: var(--text); opacity: 1; }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  min-height: 100vh; /* fallback */
  display: flex;
  align-items: center;
  padding-top: max(var(--header-h), env(safe-area-inset-top, 0px));
  overflow: hidden;
}

/* Dot grid */
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, #2c2c2c 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}
.hero-grid-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 75% 65% at 50% 55%, transparent 20%, var(--bg) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding-top: 5rem;
  padding-bottom: 7rem;
}
.hero-label {
  display: inline-block;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.hero-name {
  font-size: clamp(2.8rem, 10vw, 5.5rem);
  font-weight: 600;
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 2rem;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 2.5rem;
}
.location-badge,
.permit-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.location-badge {
  border: 1px solid rgba(212, 168, 83, 0.5);
  color: var(--accent);
}
.permit-badge {
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.hero-cta {
  display: flex;
  gap: 0.875rem;
  flex-wrap: wrap;
}
.hero-scroll-hint {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: scrollPulse 2.4s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) translateY(0); }
  50% { opacity: 0.7; transform: translateX(-50%) translateY(5px); }
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--ease), color var(--ease), border-color var(--ease), transform 0.12s ease;
}
.btn:hover { transform: translateY(-1px); opacity: 1; }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: var(--accent);
  color: #0d0d0d;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover { background: #c99c3e; border-color: #c99c3e; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--text-muted); background: rgba(255,255,255,0.03); }

/* ============================================================
   Sections
   ============================================================ */
.section { padding: 5rem 0; }
.section-alt { background: var(--bg-alt); }
.section-contact { background: var(--bg-alt); }
.section-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

/* ============================================================
   About
   ============================================================ */
.about-body {
  display: grid;
  grid-template-columns: 1fr 9rem;
  gap: 3rem;
  align-items: start;
}
.about-text {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}
.about-stats {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.stat { display: flex; flex-direction: column; gap: 0.15rem; }
.stat-value {
  font-size: 1.75rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================================
   Timeline / Experience
   ============================================================ */
.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: visible;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65rem;
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-left: 2rem;
  padding-bottom: 2.5rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -4px;
  top: 0.6rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color var(--ease);
}
.job-card:hover { border-color: #333; }
.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.job-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.job-company {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.job-via {
  font-size: 0.8rem;
  opacity: 0.65;
}
.job-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex-shrink: 0;
}
.job-location {
  font-size: 0.75rem;
  color: var(--text-dim);
}
.job-period {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.job-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.job-bullets li {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
  padding-left: 1.1rem;
  position: relative;
}
.job-bullets li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.65rem;
  top: 0.28rem;
  line-height: 1;
}
.job-bullets strong { color: var(--text); }

/* ============================================================
   Skills
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 2rem;
}
.skills-group-label {
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.8rem;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  transition: border-color var(--ease), color var(--ease);
}
.tag:hover { border-color: #3a3a3a; color: var(--text); }
.tag-primary {
  border-color: rgba(212, 168, 83, 0.35);
  color: var(--accent);
  background: var(--accent-dim);
}
.tag-primary:hover { border-color: rgba(212, 168, 83, 0.6); }

/* ============================================================
   Education
   ============================================================ */
.edu-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.edu-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
}
.edu-degree {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.edu-school {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.edu-year {
  font-size: 0.73rem;
  color: var(--text-dim);
  margin-bottom: 0;
}
.edu-thesis {
  font-size: 0.83rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Languages
   ============================================================ */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-item {
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-right: 1px solid var(--border);
}
.lang-item:last-child { border-right: none; }
.lang-name {
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--text);
}
.lang-level {
  font-size: 0.68rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ============================================================
   Contact
   ============================================================ */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 3rem;
  align-items: start;
}
.contact-intro {
  font-size: 0.93rem;
  line-height: 1.75;
  color: var(--text-muted);
  margin-bottom: 2rem;
}
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.contact-link-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.contact-link-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.contact-link-value {
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-all;
}
a.contact-link-value { color: var(--accent); }
a.contact-link-value:hover { opacity: 0.75; }

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.form-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.form-input {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem; /* 16px — prevents iOS zoom */
  padding: 0.7rem 0.9rem;
  width: 100%;
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease);
  -webkit-appearance: none;
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.1);
}
.form-textarea { resize: vertical; min-height: 130px; }
.form-submit { align-self: flex-start; }
.form-status {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  min-height: 1.4em;
}
.form-status.success { color: #4ade80; }
.form-status.error { color: #f87171; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.footer-links { display: flex; gap: 1.5rem; }
.footer-links a {
  color: var(--text-dim);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  transition: color var(--ease);
}
.footer-links a:hover { color: var(--text); opacity: 1; }

/* ============================================================
   Fade-in animation
   ============================================================ */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .about-body { grid-template-columns: 1fr; }
  .about-stats { flex-direction: row; gap: 2.5rem; }
  .contact-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .header-nav { display: none; }
}

@media (max-width: 640px) {
  .hero-name { font-size: clamp(2.4rem, 13vw, 3.5rem); }
  .hero-content { padding-top: 3rem; padding-bottom: 5rem; }
  .hero-scroll-hint { display: none; }

  .about-body { grid-template-columns: 1fr; }
  .about-stats { flex-direction: row; flex-wrap: wrap; gap: 1.5rem 2.5rem; }

  .job-header { flex-direction: column; gap: 0.5rem; }
  .job-meta { text-align: left; }

  .skills-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; }

  .lang-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto;
  }
  .lang-item { border-right: none; border-bottom: 1px solid var(--border); }
  .lang-item:nth-child(odd) { border-right: 1px solid var(--border); }
  .lang-item:nth-last-child(-n+2) { border-bottom: none; }

  .contact-layout { grid-template-columns: 1fr; }
  .form-submit { align-self: stretch; width: 100%; }

  .section { padding: 3.5rem 0; }
}

@media (max-width: 420px) {
  .skills-grid { grid-template-columns: 1fr; }
  .job-card { padding: 1rem; }
  .edu-item { padding: 1rem; }
  .timeline-item { padding-left: 1.5rem; }
  .container { padding: 0 1rem; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { width: 100%; text-align: center; }
}

@media (max-width: 374px) {
  .lang-grid { grid-template-columns: 1fr; }
  .lang-item { border-right: none; border-bottom: 1px solid var(--border); }
  .lang-item:last-child { border-bottom: none; }
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  .site-header,
  .site-footer,
  .hero-grid-bg,
  .hero-scroll-hint,
  .hero-cta,
  .contact-form,
  .contact-intro { display: none !important; }

  :root {
    --bg: white;
    --bg-alt: white;
    --bg-card: #f8f8f8;
    --text: #111;
    --text-muted: #444;
    --text-dim: #666;
    --border: #ddd;
    --accent: #8a6820;
  }

  body { background: white; color: #111; font-size: 10.5pt; }

  .hero {
    min-height: unset;
    padding-top: 0;
  }
  .hero-name { font-size: 26pt; }
  .hero-content { padding-top: 0; padding-bottom: 1rem; }
  .hero-meta, .location-badge, .permit-badge { border-color: #ccc; }

  .section, .section-alt, .section-contact { padding: 1rem 0; background: white; }
  .section-header { margin-bottom: 0.75rem; padding-bottom: 0.5rem; }

  .job-card, .edu-item { box-shadow: none; background: white; }
  .timeline::before { background: #ccc; }
  .timeline-dot { border-color: white; box-shadow: none; }

  .tag, .tag-primary {
    border-color: #ccc;
    background: transparent;
    color: #555;
  }

  .lang-grid { border-color: #ccc; }
  .lang-item { background: white; border-color: #ccc; }

  a[href^="http"]::after {
    content: " [" attr(href) "]";
    font-size: 0.75em;
    color: #888;
  }
  a.contact-link-value[href^="http"]::after { content: ""; }

  .fade-in { opacity: 1; transform: none; }

  @page { margin: 1.5cm; }
}
