/* ==========================================================================
   Plinio Hernandez Martos — Portfolio
   Plain CSS, no build step. Light/dark themes (system default + manual toggle).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --text: #0e1726;
  --text-muted: #445064;
  --text-subtle: #5b6779;
  --border: #e1e6ed;
  --border-strong: #cdd5df;
  --accent: #0369a1;
  --accent-strong: #075985;
  --accent-soft: #e5f1f9;
  --accent-ink: #ffffff;
  --success: #047857;
  --success-soft: #e3f4ee;
  --grid-line: rgba(14, 23, 38, 0.05);
  --glow: rgba(3, 105, 161, 0.10);

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(14, 23, 38, 0.06);
  --shadow: 0 1px 2px rgba(14, 23, 38, 0.05), 0 6px 20px rgba(14, 23, 38, 0.06);
  --shadow-lg: 0 2px 4px rgba(14, 23, 38, 0.05), 0 18px 40px rgba(14, 23, 38, 0.10);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --max: 1140px;
  --header-h: 68px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0f1a;
  --surface: #111827;
  --surface-2: #162033;
  --text: #e8edf5;
  --text-muted: #a9b6c9;
  --text-subtle: #8e9db3;
  --border: #1f2a3d;
  --border-strong: #2d3b53;
  --accent: #4cc2f5;
  --accent-strong: #8dd8fa;
  --accent-soft: rgba(76, 194, 245, 0.12);
  --accent-ink: #04111d;
  --success: #3fd3a0;
  --success-soft: rgba(63, 211, 160, 0.12);
  --grid-line: rgba(232, 237, 245, 0.045);
  --glow: rgba(76, 194, 245, 0.10);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0f1a;
    --surface: #111827;
    --surface-2: #162033;
    --text: #e8edf5;
    --text-muted: #a9b6c9;
    --text-subtle: #8e9db3;
    --border: #1f2a3d;
    --border-strong: #2d3b53;
    --accent: #4cc2f5;
    --accent-strong: #8dd8fa;
    --accent-soft: rgba(76, 194, 245, 0.12);
    --accent-ink: #04111d;
    --success: #3fd3a0;
    --success-soft: rgba(63, 211, 160, 0.12);
    --grid-line: rgba(232, 237, 245, 0.045);
    --glow: rgba(76, 194, 245, 0.10);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px rgba(0, 0, 0, 0.4);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@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;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 1rem;
}

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

svg {
  flex-shrink: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

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

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 200;
  padding: 0.65rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
  color: var(--accent-ink);
}

/* ---------- Header & navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header {
    background: var(--bg);
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--text);
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #0f172a;
  color: #4cc2f5;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

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

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav a {
  position: relative;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav a[aria-current="page"],
.nav a.is-current {
  color: var(--text);
}

.nav .nav-cv {
  margin-left: 0.4rem;
  color: var(--accent);
  border: 1px solid var(--border-strong);
}

.nav .nav-cv:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.nav-toggle {
  display: none;
}

.nav-toggle .icon-close {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}

/* Theme toggle: show the icon for the theme you would switch TO */
.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

/* Without JS the toggles cannot work, so hide them and keep the nav visible */
html:not(.js) .theme-toggle,
html:not(.js) .nav-toggle {
  display: none !important;
}

@media (max-width: 860px) {
  .js .nav-toggle {
    display: inline-grid;
  }

  .js .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    z-index: 99;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.75rem 1.25rem 1.5rem;
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100dvh - var(--header-h));
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    display: none;
  }

  .js .nav.is-open {
    display: flex;
  }

  .js .site-header:has(.nav.is-open) {
    background: var(--bg);
  }

  body.nav-open {
    overflow: hidden;
  }

  .js .nav a {
    padding: 0.8rem 0.75rem;
    font-size: 1rem;
  }

  .js .nav .nav-cv {
    margin: 0.5rem 0 0;
    text-align: center;
  }

  html:not(.js) .header-inner {
    height: auto;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  html:not(.js) .site-header {
    height: auto;
    position: static;
  }

  html:not(.js) .nav {
    flex-wrap: wrap;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0.7rem 1.2rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: var(--accent-ink);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  color: var(--text);
  border-color: var(--text-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.btn-ghost:hover {
  color: var(--accent-strong);
  transform: none;
}

.btn-sm {
  min-height: 40px;
  padding: 0.5rem 0.95rem;
  font-size: 0.875rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 4.5rem 0 4.5rem;
  border-bottom: 1px solid var(--border);
}

.hero::before,
.project-hero::before,
.error-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 20%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 30% 20%, #000 30%, transparent 75%);
}

.hero::after,
.project-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 640px;
  height: 640px;
  top: -260px;
  right: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 65%);
  pointer-events: none;
}

.hero,
.project-hero,
.error-page {
  isolation: isolate;
}

.hero-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 960px) {
  .hero {
    padding: 6rem 0 6rem;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 3.5rem;
  }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.hero h1 {
  font-size: clamp(2.35rem, 4.2vw + 1rem, 3.9rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 1rem;
}

.hero-role {
  margin: 0 0 1.25rem;
  font-size: clamp(1.1rem, 1vw + 0.9rem, 1.35rem);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.hero-lead {
  max-width: 38rem;
  font-size: 1.075rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.hero-facts li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hero-facts svg {
  color: var(--accent);
}

/* Hero "profile file" card */
.profile-card {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.75;
}

.profile-card-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.7rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-subtle);
  font-size: 0.75rem;
}

.profile-card-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-strong);
}

.profile-card-bar .file {
  margin-left: 0.6rem;
}

.profile-card pre,
.profile-card code {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  font: inherit;
  font-size: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.profile-card pre {
  margin: 0;
  padding: 1.1rem 1.25rem 1.3rem;
  overflow-x: auto;
  color: var(--text-muted);
}

.profile-card .k {
  color: var(--accent);
}

.profile-card .s {
  color: var(--text);
}

.profile-card .b {
  color: var(--success);
}

/* ---------- Sections ---------- */
.section {
  padding: 4.5rem 0;
}

@media (min-width: 768px) {
  .section {
    padding: 6rem 0;
  }
}

.section-alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-header {
  max-width: 44rem;
  margin-bottom: 2.75rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
}

.section-header h2 {
  font-size: clamp(1.75rem, 1.5vw + 1.2rem, 2.35rem);
  font-weight: 750;
  letter-spacing: -0.025em;
  margin-bottom: 0.85rem;
}

.section-header p {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 3.5rem;
    align-items: start;
  }
}

.about-text p {
  color: var(--text-muted);
  font-size: 1.05rem;
}

.about-text p:first-child {
  color: var(--text);
  font-size: 1.15rem;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-card {
  padding: 1.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.about-card h3 {
  font-size: 0.8rem;
  font-family: var(--mono);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 1.25rem;
}

.about-card dl {
  margin: 0;
  display: grid;
  gap: 0;
}

.about-card dl > div {
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
}

.about-card dl > div:first-child {
  padding-top: 0;
  border-top: 0;
}

.about-card dl > div:last-child {
  padding-bottom: 0;
}

.about-card dt {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  margin-bottom: 0.2rem;
}

.about-card dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.about-card dd strong {
  font-weight: 600;
}

.about-card dd .sub {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ---------- Education ---------- */
.edu-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.edu-item {
  display: grid;
  gap: 0.35rem 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section-alt .edu-item {
  background: var(--bg);
}

.edu-item.is-current {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow);
}

@media (min-width: 760px) {
  .edu-item {
    grid-template-columns: 170px minmax(0, 1fr);
    padding: 1.6rem 1.75rem;
  }
}

.edu-dates {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-subtle);
  padding-top: 0.2rem;
}

.edu-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.edu-inst {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.edu-body ul.edu-notes {
  margin: 0.75rem 0 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.edu-body ul.edu-notes li + li {
  margin-top: 0.25rem;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

:root[data-theme="dark"] .badge-accent {
  color: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge-accent {
    color: var(--accent-strong);
  }
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: transparent;
}

/* ---------- Projects ---------- */
.projects-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 720px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.project-card .shot {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.project-card .shot-link {
  display: block;
  line-height: 0;
}

.project-card .shot-img {
  display: block;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.5rem 1.5rem 1.35rem;
}

.project-meta {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.project-body h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.project-body h3 a {
  color: var(--text);
  text-decoration: none;
}

.project-body h3 a:hover {
  color: var(--accent);
}

.project-body > p:not(.project-meta) {
  color: var(--text-muted);
  font-size: 0.975rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.22rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.project-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: auto;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.code-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.code-status a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}

.code-status a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.code-status svg {
  color: var(--text-subtle);
}

.code-status.is-public {
  color: var(--success);
}

.code-status.is-public svg {
  color: currentColor;
}

/* ---------- Screenshot placeholders (designed, intentional) ---------- */
.shot {
  --tint: #0ea5e9;
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.shot--energy { --tint: #10b981; }
.shot--cinema { --tint: #f43f5e; }
.shot--bus { --tint: #f59e0b; }
.shot--ml { --tint: #8b5cf6; }

.shot-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.shot-bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
}

.shot-url {
  flex: 0 1 55%;
  margin-left: 10px;
  padding: 0 10px;
  height: 18px;
  line-height: 18px;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--text-subtle);
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shot-body {
  position: relative;
  flex: 1;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--tint) 22%, transparent) 1px, transparent 0) 0 0 / 16px 16px,
    linear-gradient(135deg, color-mix(in srgb, var(--tint) 10%, var(--surface-2)), var(--surface-2) 70%);
}

/* Wireframe skeleton */
.shot-wire {
  position: absolute;
  inset: 9% 7%;
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 12% 1fr 1fr;
  grid-template-areas:
    "n n n"
    "h h h"
    "a b c";
  opacity: 0.85;
}

.shot-wire i {
  display: block;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 18%, var(--border));
}

.shot-wire i:nth-child(1) { grid-area: n; }
.shot-wire i:nth-child(2) {
  grid-area: h;
  background: color-mix(in srgb, var(--tint) 16%, var(--surface));
}
.shot-wire i:nth-child(3) { grid-area: a; }
.shot-wire i:nth-child(4) { grid-area: b; }
.shot-wire i:nth-child(5) { grid-area: c; }

/* Desktop-app layout (sidebar + main) */
.shot-wire--desktop {
  grid-template-columns: 26% 1fr 1fr;
  grid-template-rows: 12% 1fr 26%;
  grid-template-areas:
    "s n n"
    "s h h"
    "s a b";
}

.shot-wire--desktop i:nth-child(1) { grid-area: s; }
.shot-wire--desktop i:nth-child(2) { grid-area: h; }
.shot-wire--desktop i:nth-child(3) { grid-area: n; }
.shot-wire--desktop i:nth-child(4) { grid-area: a; }
.shot-wire--desktop i:nth-child(5) { grid-area: b; }

/* Notebook layout (cells + chart) */
.shot-wire--notebook {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 18% 18% 1fr;
  grid-template-areas:
    "n n c"
    "a a c"
    "h h h";
}

.shot-wire--notebook i:nth-child(1) { grid-area: n; }
.shot-wire--notebook i:nth-child(2) {
  grid-area: h;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--tint) 30%, transparent) 0 40%, transparent 40%) 10% 100% / 9% 100% no-repeat,
    linear-gradient(to top, color-mix(in srgb, var(--tint) 30%, transparent) 0 65%, transparent 65%) 26% 100% / 9% 100% no-repeat,
    linear-gradient(to top, color-mix(in srgb, var(--tint) 30%, transparent) 0 52%, transparent 52%) 42% 100% / 9% 100% no-repeat,
    linear-gradient(to top, color-mix(in srgb, var(--tint) 30%, transparent) 0 80%, transparent 80%) 58% 100% / 9% 100% no-repeat,
    linear-gradient(to top, color-mix(in srgb, var(--tint) 30%, transparent) 0 70%, transparent 70%) 74% 100% / 9% 100% no-repeat,
    linear-gradient(to top, color-mix(in srgb, var(--tint) 30%, transparent) 0 90%, transparent 90%) 90% 100% / 9% 100% no-repeat,
    color-mix(in srgb, var(--surface) 75%, transparent);
}
.shot-wire--notebook i:nth-child(3) { grid-area: a; }
.shot-wire--notebook i:nth-child(4) { grid-area: c; }
.shot-wire--notebook i:nth-child(5) { display: none; }

.shot-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: calc(100% - 2rem);
  padding: 0.65rem 1rem 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.shot-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: var(--tint);
  background: color-mix(in srgb, var(--tint) 14%, transparent);
}

.shot-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}

.shot-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.shot-note {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.shot--lg {
  aspect-ratio: 16 / 9;
  box-shadow: var(--shadow-lg);
}

.shot--lg .shot-bar {
  height: 38px;
}

.shot--lg .shot-label {
  padding: 0.9rem 1.35rem 0.9rem 1rem;
}

.shot--lg .shot-name {
  font-size: 1.05rem;
}

/* Real screenshots, once added (see README) */
.shot-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  border-bottom: 1px solid var(--border);
}

.shot-img--lg {
  aspect-ratio: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.shot-hero {
  margin: 0;
}

.shot-hero figcaption,
.shot-gallery figcaption {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.shot-gallery {
  display: grid;
  gap: 1.15rem;
  margin-top: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .shot-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .shot-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.shot-gallery figure {
  margin: 0;
}

.shot-gallery img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

@media (max-width: 420px) {
  .shot-label {
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 0.55rem;
  }
  .shot-icon {
    width: 28px;
    height: 28px;
  }
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.skill-group {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.section-alt .skill-group {
  background: var(--bg);
}

.skill-group h3 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1rem;
  font-weight: 650;
  margin-bottom: 1rem;
}

.skill-group h3 svg {
  color: var(--accent);
}

.skill-group ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-group li {
  padding: 0.28rem 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.skill-group.is-list ul {
  display: block;
}

.skill-group.is-list li {
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.9rem;
}

.skill-group.is-list li + li {
  margin-top: 0.5rem;
}

/* ---------- Experience timeline ---------- */
.timeline-heading {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.timeline-heading.is-spaced {
  margin-top: 3.5rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 0.15rem 2rem;
  padding: 0 0 2rem 1.75rem;
  border-left: 2px solid var(--border);
  margin-left: 6px;
}

.timeline-item:last-child {
  padding-bottom: 0.25rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 0.35rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.section-alt .timeline-item::before {
  background: var(--surface);
}

.timeline.is-other .timeline-item::before {
  border-color: var(--border-strong);
}

@media (min-width: 760px) {
  .timeline-item {
    grid-template-columns: 150px minmax(0, 1fr);
  }
  .timeline-dates {
    grid-row: 1 / span 3;
  }
}

.timeline-dates {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
  padding-top: 0.15rem;
}

.timeline-role {
  margin: 0;
  font-size: 1.075rem;
  font-weight: 650;
}

.timeline-org {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.timeline-item ul {
  margin: 0.6rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.timeline-item li + li {
  margin-top: 0.3rem;
}

.timeline.is-other .timeline-role {
  font-size: 1rem;
}

/* ---------- Contact ---------- */
.contact-panel {
  display: grid;
  gap: 2rem;
  padding: 2rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
}

.section:not(.section-alt) .contact-panel {
  background: var(--surface);
}

.section:not(.section-alt) .contact-card {
  background: var(--bg);
}

@media (min-width: 900px) {
  .contact-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 3rem;
    padding: 2.75rem;
    align-items: center;
  }
}

.contact-intro h3 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.contact-intro p {
  color: var(--text-muted);
}

.contact-intro .hero-actions {
  margin-top: 1.5rem;
}

.contact-grid {
  display: grid;
  gap: 0.75rem;
}

/* Two-up only while the contact panel itself is a single column */
@media (min-width: 560px) and (max-width: 899px) {
  .contact-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.contact-card:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.contact-card .icon {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.contact-card .text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.contact-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}

.contact-card .value {
  font-size: 0.9rem;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (max-width: 559px) {
  .contact-card .value {
    font-size: 0.82rem;
  }
}

.availability {
  margin: 2rem 0 0;
  max-width: 48rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.availability strong {
  color: var(--text);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2.25rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-subtle);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.25rem 0;
}

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ---------- Project detail pages ---------- */
.project-hero {
  position: relative;
  overflow: hidden;
  padding: 3rem 0 3.25rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .project-hero {
    padding: 4rem 0 4.25rem;
  }
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--text-subtle);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.35rem;
  color: var(--border-strong);
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

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

.breadcrumb [aria-current="page"] {
  color: var(--text);
  font-weight: 500;
}

.project-hero h1 {
  font-size: clamp(2.1rem, 3vw + 1rem, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.85rem;
}

.project-hero .lede {
  max-width: 44rem;
  font-size: 1.125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.project-hero .tags {
  margin-bottom: 1.75rem;
}

.project-hero .hero-actions {
  align-items: center;
}

.detail-shot {
  margin: 0 0 3.5rem;
}

.detail-grid {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
    gap: 3.5rem;
    align-items: start;
  }
}

.detail-main section + section {
  margin-top: 2.5rem;
}

.detail-main h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.detail-main p {
  color: var(--text-muted);
  font-size: 1.025rem;
}

.feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.feature-list li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 1.2rem;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0.85;
}

.detail-aside {
  display: grid;
  gap: 1rem;
}

@media (min-width: 900px) {
  .detail-aside {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
  }
}

.aside-card {
  padding: 1.35rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.aside-card h3 {
  margin-bottom: 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

.aside-card p {
  margin: 0;
  font-size: 0.95rem;
}

.aside-card ul:not(.tags) {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.95rem;
}

.aside-card li + li {
  margin-top: 0.2rem;
}

.aside-card .tags {
  margin: 0;
}

.code-note {
  display: flex;
  gap: 0.9rem;
  margin-top: 2.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 0.95rem;
  color: var(--text-muted);
}

.code-note.is-public {
  border-left-color: var(--success);
}

.code-note svg {
  margin-top: 0.15rem;
  color: var(--accent);
}

.code-note.is-public svg {
  color: var(--success);
}

.code-note p {
  margin: 0;
  font-size: inherit;
}

.code-note strong {
  color: var(--text);
}

.more-projects {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.more-projects a {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1.1rem;
  min-width: min(100%, 240px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease;
}

.more-projects a:hover {
  border-color: var(--accent);
  color: var(--text);
}

.more-projects a span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.more-projects a.next {
  text-align: right;
  margin-left: auto;
}

@media (max-width: 560px) {
  .more-projects a,
  .more-projects a.next {
    flex: 1 1 100%;
    text-align: left;
  }
}

/* ---------- 404 ---------- */
.error-page {
  position: relative;
  overflow: hidden;
  min-height: calc(100vh - var(--header-h) - 90px);
  display: grid;
  place-items: center;
  padding: 5rem 0;
  text-align: center;
}

.error-page .code {
  display: block;
  margin-bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--accent);
  background: none;
  border: 0;
}

.error-page h1 {
  font-size: clamp(2rem, 3vw + 1rem, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.error-page p {
  max-width: 32rem;
  margin: 0 auto 2rem;
  color: var(--text-muted);
}

.error-page .hero-actions {
  justify-content: center;
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .skip-link,
  .hero-actions,
  .shot,
  .theme-toggle,
  .nav-toggle {
    display: none !important;
  }
  .section,
  .hero {
    padding: 1.5rem 0;
  }
  body {
    background: #fff;
    color: #000;
  }
}
