/* ============================================================
   HAYDEN EALES — Product Engineer Portfolio
   Design system: "signal / systems" aesthetic
   ============================================================ */

:root {
  /* --- Color: dark theme (default) — deep circuit-board green --- */
  --bg: #0A100C;
  --bg-elevated: #10180F;
  --surface: #131F19;
  --surface-hover: #182A21;
  --border: #223229;
  --border-strong: #34493D;

  --text: #EFF5F1;
  --text-secondary: #93A69B;
  --text-tertiary: #57685D;

  --mint: #5EEBB0;
  --mint-dim: rgba(94, 235, 176, 0.13);
  --amber: #F2A93B;
  --amber-dim: rgba(242, 169, 59, 0.13);
  --blue: #6FA0FF;
  --blue-dim: rgba(111, 160, 255, 0.13);
  --violet: #B999F5;
  --violet-dim: rgba(185, 153, 245, 0.14);
  --red-dim: rgba(239, 108, 108, 0.13);
  --red: #EF6C6C;
  --selection-text: #06170F;
  --nav-bg-channels: 10, 16, 12;

  /* --- Type --- */
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* --- Layout --- */
  --max-width: 1180px;
  --gutter: clamp(20px, 5vw, 64px);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F6F8F4;
  --bg-elevated: #EEF2EA;
  --surface: #FFFFFF;
  --surface-hover: #F0F4EC;
  --border: #DCE4D9;
  --border-strong: #C1CDBD;

  --text: #10190F;
  --text-secondary: #56654E;
  --text-tertiary: #8A9982;

  --mint: #1F9D63;
  --mint-dim: rgba(31, 157, 99, 0.11);
  --amber: #A96A0C;
  --amber-dim: rgba(169, 106, 12, 0.11);
  --blue: #2C58C7;
  --blue-dim: rgba(44, 88, 199, 0.11);
  --violet: #7C4DDB;
  --violet-dim: rgba(124, 77, 219, 0.11);
  --red-dim: rgba(200, 74, 74, 0.11);
  --red: #C84A4A;
  --selection-text: #F6F8F4;
  --nav-bg-channels: 246, 248, 244;

  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

@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;
    scroll-behavior: auto !important;
  }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--mint); color: var(--selection-text); }

body, .nav, .card, .surface, .status, .tag, .btn, .feed, .feed__row {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }

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

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

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

/* ---------------- Typography ---------------- */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(2.5rem, 5.4vw, 4.6rem); font-weight: 700; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }
h3 { font-size: clamp(1.3rem, 2vw, 1.6rem); }
h4 { font-size: 1.05rem; }

p { color: var(--text-secondary); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.eyebrow::before {
  content: '';
  width: 14px;
  height: 1px;
  background: var(--border-strong);
}

.lede {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 60ch;
  line-height: 1.65;
}

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

/* ---------------- Status pill (signature element) ---------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 10px 5px 8px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}

.status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status--live { color: var(--mint); border-color: rgba(110,231,183,0.3); background: var(--mint-dim); }
.status--live .dot { background: var(--mint); box-shadow: 0 0 0 0 rgba(110,231,183,0.5); animation: pulse 2s infinite; }

.status--build { color: var(--blue); border-color: rgba(91,141,239,0.3); background: var(--blue-dim); }
.status--build .dot { background: var(--blue); }

.status--checklist { color: var(--violet); border-color: rgba(185,153,245,0.35); background: var(--violet-dim); }
.status--checklist .dot { background: var(--violet); }

.status--research { color: var(--amber); border-color: rgba(245,166,35,0.3); background: var(--amber-dim); }
.status--research .dot { background: var(--amber); }

.status--concept { color: var(--text-tertiary); border-color: var(--border); }
.status--concept .dot { background: var(--text-tertiary); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(110,231,183,0.45); }
  70% { box-shadow: 0 0 0 6px rgba(110,231,183,0); }
  100% { box-shadow: 0 0 0 0 rgba(110,231,183,0); }
}

@keyframes circuitDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes circuitFlow {
  to { stroke-dashoffset: -168; }
}

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.94rem;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn--primary {
  background: var(--text);
  color: var(--bg);
}
.btn--primary:hover { background: var(--mint); }

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

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover { color: var(--text); }

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

/* ---------------- Nav ---------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(var(--nav-bg-channels), 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.nav__logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.nav__logo .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(110,231,183,0.5);
  animation: pulse 2.4s infinite;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 13px;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav__links a {
  color: var(--text-secondary);
  position: relative;
  padding: 4px 0;
  transition: color 0.15s ease;
}
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); }
.nav__links a[aria-current="page"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 2px;
  background: var(--mint);
  border-radius: 2px;
}

.nav__cta { display: flex; align-items: center; gap: 18px; }

.nav__toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
}
.nav__toggle svg { width: 22px; height: 22px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }

.nav__mobile {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0 22px;
  border-top: 1px solid var(--border);
}
.nav__mobile a {
  padding: 12px 0;
  color: var(--text-secondary);
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
}
.nav__mobile a[aria-current="page"] { color: var(--mint); }
.nav.is-open .nav__mobile { display: flex; }

@media (max-width: 960px) {
  .nav__cta .btn--secondary { display: none; }
}

@media (max-width: 860px) {
  .nav__links { display: none; }
  .nav__toggle { display: inline-flex; }
}

/* ---------------- Sections ---------------- */

section { position: relative; }

.section {
  padding: clamp(64px, 10vw, 120px) 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type { border-bottom: none; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

/* ---------------- Hero ---------------- */

.hero {
  padding: clamp(80px, 14vw, 160px) 0 clamp(60px, 8vw, 100px);
  position: relative;
  overflow: hidden;
}

.hero__grid {
  position: absolute;
  inset: 0;
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(ellipse 75% 100% at 50% 0%, #000 0%, transparent 58%);
  mask-image: radial-gradient(ellipse 75% 100% at 50% 0%, #000 0%, transparent 58%);
  pointer-events: none;
}
.hero__grid svg { width: 100%; height: 100%; }

.hero__content { position: relative; max-width: 780px; }

.hero h1 { margin-bottom: 22px; }

.hero .lede { margin-bottom: 34px; }

.hero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 40px;
}

/* ---------------- Cards ---------------- */

.card-grid {
  display: grid;
  gap: 20px;
}

.card-grid--2 { grid-template-columns: repeat(2, 1fr); }
.card-grid--3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 860px) {
  .card-grid--2, .card-grid--3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 30px;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

a.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.card__icon {
  width: 42px; height: 42px;
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card__icon svg { width: 22px; height: 22px; }

.card h3 { margin-bottom: 10px; }
.card p { font-size: 0.96rem; margin-bottom: 18px; flex-grow: 1; }

.card__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.card__link {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}
.card__link svg { width: 14px; height: 14px; transition: transform 0.15s ease; }
a.card:hover .card__link svg { transform: translateX(3px); }

/* small experiment card */
.card--sm { padding: 22px; }
.card--sm h4 { margin-bottom: 8px; }
.card--sm p { font-size: 0.88rem; margin-bottom: 0; }

/* ---------------- Feed (What I'm building) ---------------- */

.feed {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
}

.feed__row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.feed__row:last-child { border-bottom: none; }

.feed__name { font-weight: 600; font-size: 0.95rem; flex-shrink: 0; width: 190px; }
.feed__desc { color: var(--text-secondary); font-size: 0.9rem; flex-grow: 1; }
.feed__updated { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-tertiary); flex-shrink: 0; }

@media (max-width: 700px) {
  .feed__row { flex-wrap: wrap; }
  .feed__name { width: 100%; }
  .feed__updated { width: 100%; }
}

/* ---------------- Philosophy / three-column ---------------- */

.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}
@media (max-width: 760px) { .trio { grid-template-columns: 1fr; gap: 32px; } }

.trio__item .eyebrow { margin-bottom: 12px; }
.trio__item h3 { margin-bottom: 10px; }
.trio__item p { font-size: 0.95rem; }

/* ---------------- Case study page ---------------- */

.cs-hero {
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--border);
}

.cs-hero__back {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 30px;
}
.cs-hero__back:hover { color: var(--text-secondary); }

.cs-hero__meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }

.cs-visual {
  margin: 48px 0 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
  aspect-ratio: 16/8;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cs-visual svg { width: 100%; height: 100%; }

.cs-body {
  padding: clamp(56px, 8vw, 90px) 0;
}

.cs-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 64px;
}
@media (max-width: 860px) {
  .cs-layout { grid-template-columns: 1fr; gap: 32px; }
}

.cs-side {
  position: sticky;
  top: 100px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.cs-side__block .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  display: block;
}
.cs-side__block .value { font-size: 0.92rem; color: var(--text); }

.avatar-placeholder {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 22px;
}
.avatar-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.avatar-placeholder__empty {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
}
.avatar-placeholder__empty span {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.cs-main section.cs-block {
  margin-bottom: 52px;
}
.cs-main section.cs-block:last-child { margin-bottom: 0; }

.cs-block .eyebrow { margin-bottom: 14px; }
.cs-block p { font-size: 1.02rem; max-width: 66ch; margin-bottom: 14px; }
.cs-block p:last-child { margin-bottom: 0; }
.cs-block ul { margin: 14px 0 0 0; padding-left: 20px; }
.cs-block li { color: var(--text-secondary); font-size: 1.02rem; margin-bottom: 10px; max-width: 62ch; }

.cs-nav-between {
  display: flex;
  justify-content: space-between;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  font-weight: 600;
}
.cs-nav-between a { color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.cs-nav-between a:hover { color: var(--text); }

/* ---------------- Footer ---------------- */

.footer {
  padding: 56px 0 40px;
}
.footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}
.footer__brand h3 { margin-bottom: 10px; }
.footer__brand p { max-width: 38ch; font-size: 0.92rem; }
.footer__links {
  display: flex;
  gap: 56px;
  flex-wrap: wrap;
}
.footer__col { display: flex; flex-direction: column; gap: 10px; }
.footer__col .label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.footer__col a { color: var(--text-secondary); font-size: 0.92rem; }
.footer__col a:hover { color: var(--text); }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------------- Page header (non-home pages) ---------------- */

.page-head {
  padding: clamp(64px, 10vw, 96px) 0 56px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.page-head .lede { margin-top: 18px; }
.page-head .container { position: relative; }

.page-head__grid {
  position: absolute;
  inset: 0;
  opacity: 0.32;
  -webkit-mask-image: radial-gradient(ellipse 60% 90% at 100% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse 60% 90% at 100% 0%, #000 0%, transparent 70%);
  pointer-events: none;
}
.page-head__grid svg { width: 100%; height: 100%; }

.cs-hero { position: relative; overflow: hidden; }
.cs-hero .container { position: relative; }
.cs-hero__grid {
  position: absolute;
  inset: 0;
  opacity: 0.26;
  -webkit-mask-image: radial-gradient(ellipse 55% 85% at 100% 0%, #000 0%, transparent 70%);
  mask-image: radial-gradient(ellipse 55% 85% at 100% 0%, #000 0%, transparent 70%);
  pointer-events: none;
}
.cs-hero__grid svg { width: 100%; height: 100%; }

/* ---------------- Utility ---------------- */

.mt-0 { margin-top: 0; }
.text-center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 0;
}

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Toolkit / skills ---------------- */

.toolkit { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }
@media (max-width: 700px) { .toolkit { grid-template-columns: 1fr; } }

.toolkit__group .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 12px;
}

.tag--lg {
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
}

.tag-cluster { display: flex; flex-wrap: wrap; gap: 8px; }
