/* ===== Tokens ===== */
:root {
  --bg: #f2f4f6;
  --bg-alt: #e8ecef;
  --surface: rgba(255, 255, 255, 0.55);
  --text: #1b1f24;
  --text-muted: #5a6570;
  --accent: #0a6b6b;
  --accent-hover: #085858;
  --accent-soft: rgba(10, 107, 107, 0.12);
  --line: rgba(27, 31, 36, 0.12);
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Source Sans 3", system-ui, sans-serif;
  --container: 1140px;
  --narrow: 720px;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3.5rem;
  --space-xl: 6rem;
  --radius: 4px;
  --header-h: 4rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Reset / base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.75rem);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(10, 107, 107, 0.09), transparent 55%),
    radial-gradient(ellipse 60% 40% at 95% 15%, rgba(45, 80, 120, 0.07), transparent 50%),
    linear-gradient(rgba(27, 31, 36, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 31, 36, 0.03) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.2s var(--ease), text-underline-offset 0.2s var(--ease);
}

a:hover {
  color: var(--accent-hover);
  text-underline-offset: 0.28em;
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
.nav-burger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

p {
  margin: 0 0 1rem;
}

ul, ol {
  margin: 0 0 1rem;
  padding: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  padding: 0.6rem 1rem;
  background: var(--text);
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.container.narrow {
  width: min(100% - 2.5rem, var(--narrow));
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  backdrop-filter: blur(12px);
  background: rgba(242, 244, 246, 0.82);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1.5rem;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.2rem;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}

.nav a:hover {
  color: var(--text);
}

.nav a:hover::after {
  transform: scaleX(1);
}

.nav-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.nav-burger {
  display: none;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.nav-burger span {
  display: block;
  width: 1.1rem;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.25s var(--ease), opacity 0.2s;
}

.nav-burger span + span {
  margin-top: 0.35rem;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  padding: var(--space-xl) 0 var(--space-lg);
  overflow: hidden;
}

.hero-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 70% at 85% 40%, rgba(10, 107, 107, 0.14), transparent 65%),
    linear-gradient(180deg, transparent 60%, var(--bg) 100%);
}

.hero-atmosphere::before {
  content: "";
  position: absolute;
  right: -8%;
  top: 10%;
  width: min(52vw, 560px);
  height: min(52vw, 560px);
  border: 1px solid rgba(10, 107, 107, 0.22);
  border-radius: 50%;
  opacity: 0.7;
}

.hero-atmosphere::after {
  content: "";
  position: absolute;
  right: 4%;
  top: 22%;
  width: min(36vw, 380px);
  height: min(36vw, 380px);
  border: 1px dashed rgba(27, 31, 36, 0.12);
  border-radius: 50%;
}

.hero-inner {
  position: relative;
  max-width: 820px;
}

.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0 0 1.25rem;
  color: var(--text);
}

.hero-title {
  font-size: clamp(1.45rem, 2.8vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 18ch;
  margin-bottom: 1.25rem;
}

.hero-lead {
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: rgba(27, 31, 36, 0.28);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Sections ===== */
.section {
  padding: var(--space-xl) 0;
}

.section-alt {
  background: linear-gradient(180deg, rgba(232, 236, 239, 0.65), rgba(232, 236, 239, 0.35));
  border-block: 1px solid var(--line);
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  letter-spacing: -0.03em;
  margin-bottom: var(--space-md);
}

.section-title::after {
  content: "";
  display: block;
  width: 2.5rem;
  height: 3px;
  margin-top: 0.75rem;
  background: var(--accent);
}

.prose p:last-child {
  margin-bottom: 0;
}

/* ===== Metrics ===== */
.metrics {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.metrics-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem 2rem;
  margin: 0;
}

.metric {
  padding-top: 1rem;
  border-top: 2px solid var(--accent);
}

.metric strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.metric span {
  display: block;
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

/* ===== Services ===== */
.service {
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--line);
}

.service:first-of-type {
  padding-top: 0;
}

.service:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.service h3 {
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.service-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.dash-list {
  list-style: none;
  columns: 2;
  column-gap: 2.5rem;
}

.dash-list li {
  break-inside: avoid;
  padding-left: 1.1rem;
  position: relative;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
}

.dash-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ===== Projects ===== */
.project {
  padding: var(--space-lg) 0;
  border-bottom: 1px solid var(--line);
}

.project:first-of-type {
  padding-top: 0;
}

.project:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.project h3 {
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  letter-spacing: -0.025em;
}

.project-lead {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1rem;
}

.project h4 {
  font-size: 1.05rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.project-compact {
  padding: var(--space-md) 0;
}

.project-details {
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-details summary {
  cursor: pointer;
  padding: 0.85rem 1.1rem;
  font-family: var(--font-display);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-details summary::-webkit-details-marker {
  display: none;
}

.project-details summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent);
  line-height: 1;
}

.project-details[open] summary::after {
  content: "−";
}

.project-details .dash-list {
  padding: 0 1.1rem 1rem;
  margin-bottom: 0;
}

.tech-line {
  margin-top: 1.25rem;
  color: var(--text-muted);
  font-size: 0.98rem;
}

.tech-line span {
  font-weight: 600;
  color: var(--text);
}

.materials {
  margin-top: 1.5rem;
}

.materials-label {
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.store-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.store-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem 0.55rem 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.store-link:hover {
  border-color: rgba(10, 107, 107, 0.45);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27, 31, 36, 0.08);
  text-underline-offset: unset;
}

.store-icon {
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  border-radius: 4px;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 1rem;
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 6px,
      rgba(10, 107, 107, 0.04) 6px,
      rgba(10, 107, 107, 0.04) 12px
    ),
    #eef1f3;
  border: 1px dashed rgba(10, 107, 107, 0.35);
  border-radius: var(--radius);
  text-decoration: none;
}

a.media-placeholder {
  color: var(--accent);
  font-weight: 600;
}

a.media-placeholder:hover {
  background-color: var(--accent-soft);
  border-style: solid;
}

.media-thumb {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  color: var(--text-muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.media-thumb:hover {
  border-color: rgba(10, 107, 107, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(27, 31, 36, 0.08);
  color: var(--text);
}

.media-thumb img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top center;
  display: block;
  background: #eef1f3;
  transition: transform 0.35s var(--ease);
}

.lightbox-dialog img[src*="mcpe-ui"] {
  width: auto;
  max-width: 100%;
  margin-inline: auto;
}

.media-thumb:hover img {
  transform: scale(1.04);
}

.media-thumb span {
  display: block;
  padding: 0.7rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-top: 1px solid var(--line);
  line-height: 1.3;
}

/* ===== Lightbox (checkbox, no hash scroll) ===== */
.media-item {
  min-width: 0;
}

/* Keep toggle in viewport — label focus must not scroll the page */
.lightbox-toggle {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  border: 0;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.lightbox-toggle:checked ~ .lightbox {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body:has(.lightbox-toggle:checked) {
  overflow: hidden;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 31, 36, 0.82);
  cursor: zoom-out;
}

.lightbox-dialog {
  position: relative;
  z-index: 1;
  margin: 0;
  max-width: min(96vw, 1100px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s var(--ease);
}

.lightbox-toggle:checked ~ .lightbox .lightbox-dialog {
  transform: none;
}

.lightbox-dialog img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(92vh - 3.5rem);
  object-fit: contain;
  background: #111;
}

.lightbox-dialog figcaption {
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: #fff;
}

.lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(27, 31, 36, 0.7);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.lightbox-close:hover {
  background: var(--accent);
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .media-thumb:hover,
  .media-thumb:hover img,
  .lightbox-dialog {
    transform: none;
  }
}

/* ===== Tech tags ===== */
.tech-group {
  margin-bottom: var(--space-md);
}

.tech-group:last-child {
  margin-bottom: 0;
}

.tech-group h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.tech-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  margin: 0;
}

.tech-tags li {
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--line);
}

/* ===== Process ===== */
.process-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem 2rem;
  counter-reset: none;
  margin: 0;
}

.process-list li {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.process-num {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}

.process-list h3 {
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.process-list p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* ===== Education ===== */
.edu-title {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

/* ===== Contact ===== */
.contact {
  background:
    radial-gradient(ellipse 70% 80% at 50% 100%, rgba(10, 107, 107, 0.12), transparent 60%),
    linear-gradient(180deg, transparent, rgba(232, 236, 239, 0.5));
}

.contact-lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.contact-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.contact-list {
  list-style: none;
  margin: 0 0 1.25rem;
}

.contact-list li {
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.contact-list a {
  font-weight: 600;
}

.contact-note {
  color: var(--text-muted);
  margin: 0;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  background: rgba(232, 236, 239, 0.5);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.footer-inner p {
  margin: 0;
}

/* ===== Motion ===== */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  animation: fade-up 0.8s var(--ease) both;
}

.reveal-delay-1 { animation-delay: 0.1s; }
.reveal-delay-2 { animation-delay: 0.22s; }
.reveal-delay-3 { animation-delay: 0.34s; }

@supports (animation-timeline: view()) {
  .reveal-on-view {
    animation: fade-up 0.7s var(--ease) both;
    animation-timeline: view();
    animation-range: entry 0% entry 40%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal,
  .reveal-on-view {
    animation: none !important;
  }

  .btn:hover {
    transform: none;
  }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .process-list {
    grid-template-columns: 1fr 1fr;
  }

  .dash-list {
    columns: 1;
  }

  .hero-atmosphere::before,
  .hero-atmosphere::after {
    opacity: 0.45;
  }
}

@media (max-width: 720px) {
  :root {
    --space-xl: 4rem;
    --space-lg: 2.5rem;
  }

  .nav-burger {
    display: grid;
  }

  .nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1.25rem 1rem;
    background: rgba(242, 244, 246, 0.96);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.25s var(--ease);
  }

  .nav a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--line);
  }

  .nav a:last-child {
    border-bottom: 0;
  }

  .nav-toggle:checked ~ .nav {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-toggle:checked + .nav-burger span:first-child {
    transform: translateY(3.5px) rotate(45deg);
  }

  .nav-toggle:checked + .nav-burger span:last-child {
    transform: translateY(-3.5px) rotate(-45deg);
  }

  .hero {
    min-height: auto;
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
  }

  .hero-brand {
    font-size: clamp(2rem, 10vw, 2.75rem);
  }

  .metrics-grid,
  .process-list {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
  }
}
