/* ============================================================================
   PORTFOLIO STYLESHEET
   Design language: a developer's editor/terminal, rendered calmly.
   Dark theme is the default; a light theme is available via the toggle.
   ========================================================================= */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- Design tokens ---------- */
:root {
  /* Color: dark theme (default) */
  --bg: #11141c;
  --bg-elevated: #161a24;
  --surface: #1c212e;
  --surface-hover: #232938;
  --border: #2a3142;
  --text: #f0eee7;
  --text-muted: #939bb0;
  --accent: #5ee6b0;
  --accent-soft: rgba(94, 230, 176, 0.12);
  --accent-2: #f5a623;
  --accent-2-soft: rgba(245, 166, 35, 0.12);
  --danger: #f5715c;
  --accent-contrast: #0b0d12;
  --shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.45);

  /* Type */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Inter", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* Layout */
  --maxw: 1120px;
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --header-h: 72px;
}

[data-theme="light"] {
  --bg: #f7f5f0;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f1efe7;
  --border: #e4dfd2;
  --text: #181a20;
  --text-muted: #5d6271;
  --accent: #18a877;
  --accent-soft: rgba(24, 168, 119, 0.1);
  --accent-2: #c2790f;
  --accent-2-soft: rgba(194, 121, 15, 0.1);
  --danger: #d44a33;
  --accent-contrast: #ffffff;
  --shadow: 0 20px 40px -24px rgba(20, 20, 20, 0.18);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body { padding: 0; margin: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

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

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

.mono { font-family: var(--font-mono); }

/* eyebrow / comment-style section label — echoes a code comment */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.85rem;
}
.eyebrow::before { content: "//"; color: var(--text-muted); }

.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-head { max-width: 640px; margin-bottom: 2.5rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.section-head p { color: var(--text-muted); margin-top: 0.6rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-hover); border-color: var(--text-muted); }
.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.82rem; }
.btn-row { display: flex; gap: 0.85rem; flex-wrap: wrap; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; }

.logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo .bracket { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-hover); border-color: var(--text-muted); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: inline-flex; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.5rem var(--gutter) 1rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }
  .nav-links.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-links a { padding: 0.6rem 0; width: 100%; }
  .nav-toggle {
    display: inline-flex;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.25rem 0;
  margin-top: 4rem;
}
.site-footer .container {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.footer-note { color: var(--text-muted); font-size: 0.85rem; }
.footer-socials { display: flex; gap: 0.6rem; }

/* ---------- Hero / terminal signature ---------- */
.hero {
  padding: clamp(3rem, 9vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.hero-kicker {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: block;
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  margin-bottom: 0.9rem;
}
.hero h1 .role-line { display: block; color: var(--text-muted); font-size: 0.5em; margin-top: 0.5rem; font-family: var(--font-mono); font-weight: 500; letter-spacing: 0; }
.hero p.lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin-bottom: 1.75rem;
}

.terminal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.terminal-dot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-dot.red { background: #f5715c; }
.terminal-dot.yellow { background: #f5c623; }
.terminal-dot.green { background: #5ee6b0; }
.terminal-title {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.terminal-body {
  padding: 1.25rem 1.4rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  min-height: 230px;
}
.terminal-body .tline { white-space: pre-wrap; word-break: break-word; min-height: 1.6em; }
.t-comment { color: var(--text-muted); }
.t-keyword { color: var(--accent-2); }
.t-string { color: var(--accent); }
.t-plain { color: var(--text); }
.t-cursor {
  display: inline-block;
  width: 8px; height: 1.05em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: -2px;
  animation: blink 1s step-start infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.skill-card h3 {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 0.9rem;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
}
.chip.chip-muted { background: var(--surface-hover); color: var(--text-muted); }
.chip.chip-amber { background: var(--accent-2-soft); color: var(--accent-2); }

/* ---------- Project cards ---------- */
.projects-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.search-field {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}
.search-field input {
  width: 100%;
  padding: 0.6rem 0.9rem 0.6rem 2.3rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.search-field svg {
  position: absolute; left: 0.7rem; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-muted);
}
.toolbar-controls { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.select-field select {
  padding: 0.55rem 2rem 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23939bb0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
}
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.view-toggle button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: var(--surface);
  color: var(--text-muted);
  border: none;
  border-left: 1px solid var(--border);
}
.view-toggle button:first-child { border-left: none; }
.view-toggle button.active { background: var(--accent-soft); color: var(--accent); }
.view-toggle svg { width: 17px; height: 17px; }

.results-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  margin-bottom: 1.25rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}
.projects-grid.is-list {
  grid-template-columns: 1fr;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.project-thumb {
  aspect-ratio: 1200 / 630;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }

.project-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: 0.65rem; flex: 1; }
.project-name { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.project-name .pin { color: var(--accent-2); font-size: 0.95rem; }
.project-desc { color: var(--text-muted); font-size: 0.9rem; flex: 1; }
.project-meta { display: flex; align-items: center; gap: 1rem; font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); }
.project-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.project-meta svg { width: 14px; height: 14px; }
.project-links { display: flex; gap: 0.6rem; margin-top: 0.25rem; }

/* list view variant */
.projects-grid.is-list .project-card {
  flex-direction: row;
}
.projects-grid.is-list .project-thumb {
  width: 220px;
  aspect-ratio: auto;
  flex-shrink: 0;
  border-bottom: none;
  border-right: 1px solid var(--border);
}
.projects-grid.is-list .project-body { flex-direction: column; }
@media (max-width: 700px) {
  .projects-grid.is-list .project-card { flex-direction: column; }
  .projects-grid.is-list .project-thumb { width: 100%; aspect-ratio: 1200/630; border-right: none; border-bottom: 1px solid var(--border); }
}

.state-block {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.state-block .mono { color: var(--accent); }

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.skeleton-card .project-thumb { background: linear-gradient(100deg, var(--bg-elevated) 30%, var(--surface-hover) 50%, var(--bg-elevated) 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
.skeleton-line { height: 0.7rem; border-radius: 4px; background: var(--surface-hover); margin: 1.1rem 1.2rem; }
.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-90 { width: 90%; }
@keyframes shimmer { 0% { background-position: 0% 0; } 100% { background-position: -200% 0; } }

/* ---------- Timeline (About page) ---------- */
.timeline { display: flex; flex-direction: column; gap: 1.5rem; }
.timeline-item {
  position: relative;
  padding-left: 1.6rem;
  border-left: 2px solid var(--border);
  padding-bottom: 0.25rem;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px; top: 4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.timeline-item h3 { font-size: 1.05rem; }
.timeline-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent-2); margin: 0.25rem 0 0.6rem; }
.timeline-item ul { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.timeline-item li { color: var(--text-muted); font-size: 0.92rem; padding-left: 1rem; position: relative; }
.timeline-item li::before { content: "›"; position: absolute; left: 0; color: var(--accent); }
.timeline-item p.detail { color: var(--text-muted); font-size: 0.92rem; }

/* ---------- About summary card ---------- */
.about-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  font-size: 1.02rem;
  color: var(--text);
  margin-bottom: 3rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
}
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Contact page ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
@media (max-width: 840px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.contact-card:hover { border-color: var(--accent); transform: translateX(2px); }
.contact-card .icon-btn { pointer-events: none; }
.contact-card .ct-label { font-size: 0.78rem; color: var(--text-muted); font-family: var(--font-mono); }
.contact-card .ct-value { font-weight: 600; }
.contact-card .copy-btn { margin-left: auto; }

.form-grid { display: flex; flex-direction: column; gap: 1rem; }
.form-field { display: flex; flex-direction: column; gap: 0.4rem; }
.form-field label { font-size: 0.85rem; font-family: var(--font-mono); color: var(--text-muted); }
.form-field input, .form-field textarea {
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); }
.form-note { font-size: 0.82rem; color: var(--text-muted); }
.form-status { font-size: 0.88rem; padding: 0.6rem 0.85rem; border-radius: var(--radius-sm); display: none; }
.form-status.show { display: block; }
.form-status.ok { background: var(--accent-soft); color: var(--accent); }
.form-status.err { background: rgba(245, 113, 92, 0.12); color: var(--danger); }

/* ---------- Page hero (Projects / About / Contact headers) ---------- */
.page-hero { padding: clamp(2.5rem, 6vw, 4rem) 0 1.5rem; }
.page-hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.page-hero p { color: var(--text-muted); margin-top: 0.6rem; max-width: 56ch; }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 5vw, 3rem);
  text-align: center;
}
.cta-band h2 { margin-bottom: 0.6rem; }
.cta-band p { color: var(--text-muted); margin-bottom: 1.5rem; }
.cta-band .btn-row { justify-content: center; }

/* ---------- Misc ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
