/* ── Frostpunk palette ── */
:root {
  --fp-bg-deep: #070b10;
  --fp-bg: #0c1219;
  --fp-bg-raised: #121a24;
  --fp-bg-card: #161f2b;
  --fp-steel: #2a3544;
  --fp-steel-light: #3d4f63;
  --fp-ice: #8ec4d4;
  --fp-ice-bright: #b8dce8;
  --fp-ice-dim: #4a7080;
  --fp-frost: #dce8ef;
  --fp-text: #c5d4de;
  --fp-text-muted: #6b7d8c;
  --fp-heat: #e8943a;
  --fp-heat-bright: #ffb04a;
  --fp-heat-dim: #a85e20;
  --fp-glow-ice: rgba(142, 196, 212, 0.15);
  --fp-glow-heat: rgba(232, 148, 58, 0.25);
  --font-display: "Barlow Condensed", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --header-h: 72px;
  --radius: 6px;
  --transition: 0.22s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fp-text);
  background: var(--fp-bg-deep);
  overflow-x: hidden;
}

/* Frost / noise atmosphere */
.frost-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(142, 196, 212, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 50%, rgba(232, 148, 58, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 0% 80%, rgba(142, 196, 212, 0.05) 0%, transparent 45%),
    linear-gradient(180deg, var(--fp-bg-deep) 0%, var(--fp-bg) 40%, var(--fp-bg-deep) 100%);
}

.frost-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

a {
  color: var(--fp-ice);
  transition: color var(--transition);
}

a:hover,
a:focus-visible {
  color: var(--fp-ice-bright);
}

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(7, 11, 16, 0.88);
  border-bottom: 1px solid var(--fp-steel);
  backdrop-filter: blur(12px);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1140px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--fp-frost);
  text-decoration: none;
  text-transform: lowercase;
}

.nav {
  display: flex;
  gap: 2rem;
}

.nav a {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fp-text-muted);
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--fp-ice);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--fp-ice);
}

/* ── Layout helpers ── */
main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1.5rem;
  overflow-x: clip;
}

.section {
  padding: 5rem 0;
}

.section__head {
  max-width: 640px;
  margin-bottom: 2.5rem;
}

.section__head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fp-frost);
  margin-bottom: 0.75rem;
}

.section__head p {
  color: var(--fp-text-muted);
  font-size: 0.95rem;
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fp-ice-dim);
  margin-bottom: 1.25rem;
}

/* ── Hero ── */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  min-height: calc(100vh - var(--header-h));
  padding: 3rem 0 4rem;
  width: 100%;
  min-width: 0;
}

.hero__content {
  min-width: 0;
}

.hero__name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.03em;
  color: var(--fp-frost);
  margin-bottom: 0.5rem;
  overflow-wrap: break-word;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fp-heat);
  text-shadow: 0 0 32px var(--fp-glow-heat);
  margin-bottom: 2.5rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    color var(--transition);
}

.btn--heat {
  background: linear-gradient(180deg, var(--fp-heat-bright) 0%, var(--fp-heat) 50%, var(--fp-heat-dim) 100%);
  color: var(--fp-bg-deep);
  border-color: var(--fp-heat-bright);
  box-shadow: 0 0 24px var(--fp-glow-heat);
}

.btn--heat:hover,
.btn--heat:focus-visible {
  box-shadow: 0 0 36px rgba(232, 148, 58, 0.45);
  color: var(--fp-bg-deep);
}

.btn--ghost {
  background: transparent;
  color: var(--fp-ice);
  border-color: var(--fp-steel-light);
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  border-color: var(--fp-ice-dim);
  background: var(--fp-glow-ice);
  color: var(--fp-ice-bright);
}

/* ── Hero playground (matrix + terminal) ── */
.hero__visual {
  display: flex;
  justify-content: center;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.hero-playground {
  position: relative;
  width: 100%;
  max-width: 460px;
  min-width: 0;
  min-height: 340px;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--fp-steel-light);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--fp-bg-deep);
  box-shadow:
    0 0 48px var(--fp-glow-ice),
    inset 0 0 60px rgba(0, 0, 0, 0.35);
  cursor: crosshair;
  contain: layout paint;
}

.hero-playground__canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
  display: block;
}

.hero-terminal {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  max-width: calc(100% - 1.5rem);
  background: rgba(7, 11, 16, 0.82);
  border: 1px solid var(--fp-steel-light);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  pointer-events: none;
  overflow: hidden;
}

.hero-terminal__bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--fp-steel);
}

.hero-terminal__bar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fp-steel-light);
}

.hero-terminal__bar span:first-child {
  background: #c44;
}

.hero-terminal__bar span:nth-child(2) {
  background: var(--fp-heat);
}

.hero-terminal__bar span:nth-child(3) {
  background: #6a8;
}

.hero-terminal__bar p {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fp-text-muted);
}

.hero-terminal__code {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--fp-ice);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 7.5rem;
  max-height: 9rem;
  overflow: hidden;
}

.hero-terminal__code code {
  color: inherit;
}

.hero-terminal__cursor {
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--fp-heat-bright);
  animation: cursor-blink 1s step-end infinite;
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

.hero-playground::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 30%,
    rgba(7, 11, 16, 0.55) 100%
  );
  pointer-events: none;
}

/* ── Featured project ── */
.featured {
  padding: 0 0 4rem;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  align-items: stretch;
  padding: 2rem;
  background: var(--fp-bg-card);
  border: 1px solid var(--fp-steel-light);
  border-radius: var(--radius);
  box-shadow:
    0 0 40px rgba(106, 168, 136, 0.08),
    inset 0 1px 0 rgba(142, 196, 212, 0.08);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.featured-card:hover {
  border-color: rgba(106, 168, 136, 0.45);
  box-shadow:
    0 0 48px rgba(106, 168, 136, 0.14),
    0 0 32px var(--fp-glow-heat);
}

.featured-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.featured-card__category {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6aa888;
  margin-bottom: 0.75rem;
}

.featured-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fp-frost);
  margin-bottom: 0.85rem;
}

.featured-card__desc {
  font-size: 0.95rem;
  color: var(--fp-text-muted);
  max-width: 52ch;
  margin-bottom: 1.5rem;
}

.featured-card__links {
  margin-bottom: 1.5rem;
}

.featured-card__meta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--fp-steel);
}

.featured-card__visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 220px;
  border: 1px solid var(--fp-steel);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--fp-bg-deep);
}

.featured-map {
  position: absolute;
  inset: 0;
}

.featured-map__layer {
  position: absolute;
  inset: 0;
}

.featured-map__layer--green {
  background:
    radial-gradient(circle at 35% 45%, rgba(106, 168, 136, 0.55) 0%, transparent 42%),
    radial-gradient(circle at 62% 58%, rgba(74, 130, 96, 0.4) 0%, transparent 38%),
    radial-gradient(circle at 48% 72%, rgba(106, 168, 136, 0.25) 0%, transparent 35%);
}

.featured-map__layer--heat {
  background:
    radial-gradient(circle at 70% 35%, rgba(232, 148, 58, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 28% 68%, rgba(184, 220, 232, 0.2) 0%, transparent 45%);
  mix-blend-mode: screen;
}

.featured-map__pin {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: var(--fp-heat-bright);
  box-shadow:
    0 0 0 4px rgba(232, 148, 58, 0.25),
    0 0 20px var(--fp-glow-heat);
}

.featured-map__pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 18px;
  margin-left: -1px;
  background: linear-gradient(180deg, var(--fp-heat) 0%, transparent 100%);
}

.featured-map__label {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fp-text-muted);
  background: rgba(7, 11, 16, 0.82);
  border-top: 1px solid var(--fp-steel);
  backdrop-filter: blur(6px);
}

/* ── Projects ── */
.project-group + .project-group {
  margin-top: 3rem;
}

.project-group__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fp-ice-dim);
  margin-bottom: 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--fp-steel);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  background: var(--fp-bg-card);
  border: 1px solid var(--fp-steel);
  border-radius: var(--radius);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
}

.project-card:hover {
  border-color: var(--fp-ice-dim);
  box-shadow: 0 0 28px var(--fp-glow-ice);
}

.project-card__category {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fp-heat);
  margin-bottom: 0.75rem;
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fp-frost);
  margin-bottom: 0.75rem;
}

.project-card__desc {
  font-size: 0.9rem;
  color: var(--fp-text-muted);
  margin-bottom: 1rem;
  flex: 1;
}

.project-card__links {
  display: flex;
  gap: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--fp-steel);
}

.project-card__links a {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fp-ice);
}

.project-card__links a:hover {
  color: var(--fp-heat-bright);
}

.project-card__meta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}

.project-meta__label {
  display: block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fp-text-muted);
  margin-bottom: 0.5rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
}

.tag-list li {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  background: var(--fp-bg-raised);
  border: 1px solid var(--fp-steel);
  border-radius: 4px;
  color: var(--fp-text-muted);
}

.tag-list--skills li {
  border-color: rgba(142, 196, 212, 0.25);
  color: var(--fp-text);
}

/* ── Contact ── */
.section--contact {
  padding-bottom: 3rem;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--fp-ice);
  padding: 0.5rem 0;
  border-bottom: 2px solid var(--fp-steel-light);
  transition:
    color var(--transition),
    border-color var(--transition),
    text-shadow var(--transition);
}

.contact-email:hover,
.contact-email:focus-visible {
  color: var(--fp-heat-bright);
  border-color: var(--fp-heat);
  text-shadow: 0 0 24px var(--fp-glow-heat);
}

/* ── Footer ── */
.footer {
  margin-top: 2rem;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  border-top: 1px solid var(--fp-steel);
  background: rgba(7, 11, 16, 0.6);
}

.footer p {
  font-size: 0.82rem;
  color: var(--fp-text-muted);
}

.footer__sub {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.7;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 2rem;
    gap: 2rem;
  }

  .hero__visual {
    order: -1;
    width: 100%;
  }

  .hero-playground {
    max-width: 100%;
    width: 100%;
    min-height: 260px;
    box-shadow:
      0 0 28px var(--fp-glow-ice),
      inset 0 0 40px rgba(0, 0, 0, 0.35);
  }

  .featured-card {
    grid-template-columns: 1fr;
  }

  .featured-card__visual {
    min-height: 180px;
    order: -1;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  main {
    padding: 0 1rem;
  }

  .hero {
    padding-top: 1.5rem;
    gap: 1.5rem;
  }

  .hero__name {
    font-size: clamp(1.85rem, 8.5vw, 2.5rem);
  }

  .hero__title {
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    overflow-wrap: break-word;
  }

  .hero-playground {
    min-height: 220px;
    aspect-ratio: 16 / 11;
    box-shadow:
      0 0 20px var(--fp-glow-ice),
      inset 0 0 30px rgba(0, 0, 0, 0.35);
  }

  .hero-terminal {
    left: 0.5rem;
    right: 0.5rem;
    bottom: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .hero-terminal__bar p {
    display: none;
  }

  .hero-terminal__code {
    font-size: 0.62rem;
    padding: 0.6rem 0.65rem 0.75rem;
    min-height: 6rem;
    max-height: 7.5rem;
  }

  .nav-toggle {
    display: flex;
  }

  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(7, 11, 16, 0.98);
    border-bottom: 1px solid var(--fp-steel);
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition);
  }

  .nav.is-open {
    max-height: 280px;
  }

  .nav a {
    display: block;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--fp-steel);
  }

  .header__inner {
    position: relative;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-terminal__cursor {
    animation: none;
  }
}
