/* ============ The Sprk Factory ============ */

:root {
  --paper: #ffffff;
  --paper-deep: #f3f5f4;
  --ink: #15181a;
  --ink-soft: #586059;
  --spark: #00ffae;        /* brand mint from the logo bolt — fills, LEDs, on-dark accents */
  --spark-deep: #07734e;   /* legible deep emerald — text, links & borders on white */
  --teal: #4e8a7a;
  --navy: #11151f;
  --red: #c94f4f;
  --card: #ffffff;
  --line: #e4e7e4;
  --mono: "Press Start 2P", monospace;
  --body: "Space Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
  transition: background 0.6s ease, color 0.6s ease;
}

/* night mode tints the whole page, not just the canvas */
body[data-mode="night"] {
  --paper: #0f1217;
  --paper-deep: #0a0c10;
  --ink: #e8efea;
  --ink-soft: #8b938d;
  --card: #161a20;
  --line: #2a2f37;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ============ top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: 0.7rem 1.2rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: var(--ink);
  font-family: var(--mono); font-size: 0.62rem;
  letter-spacing: 0.06em;
}
.brand-spark { width: 0.95rem; height: 0.95rem; fill: var(--spark); shape-rendering: crispEdges; }
.topnav { margin-left: auto; display: flex; gap: 1.1rem; }
.topnav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 0.92rem;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { color: var(--spark-deep); border-bottom-color: var(--spark); }

.mode-toggle {
  width: 44px; height: 26px; position: relative;
  border: 2px solid var(--line); border-radius: 2px;
  background: var(--card); cursor: pointer; flex: none;
}
.mode-icon { position: absolute; top: 50%; translate: 0 -50%; width: 12px; height: 12px; transition: opacity 0.3s; }
.mode-icon--sun {
  left: 5px;
  background:
    conic-gradient(var(--spark) 0 100%);
  clip-path: polygon(33% 0, 66% 0, 66% 33%, 100% 33%, 100% 66%, 66% 66%, 66% 100%, 33% 100%, 33% 66%, 0 66%, 0 33%, 33% 33%);
}
.mode-icon--moon {
  right: 5px; background: #8a93b8; opacity: 0.35;
  clip-path: polygon(40% 0, 100% 0, 100% 100%, 40% 100%, 70% 75%, 55% 50%, 70% 25%);
}
body[data-mode="night"] .mode-icon--sun { opacity: 0.3; }
body[data-mode="night"] .mode-icon--moon { opacity: 1; background: #cfd8ff; }

/* ============ hero ============ */
.hero {
  min-height: calc(100svh - 54px);
  display: flex; flex-direction: column; align-items: center;
  padding: 2.2rem 1rem 1rem;
  position: relative;
}
.hero-titles { width: min(960px, 96vw); text-align: left; }
.hero-kicker {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.22em;
  color: var(--spark-deep); margin: 0 0 0.9rem;
}
.hero-title {
  font-size: clamp(1.7rem, 4.5vw, 2.9rem);
  line-height: 1.15; margin: 0 0 0.7rem; font-weight: 700;
}
.hero-sub { color: var(--ink-soft); margin: 0; max-width: 560px; }

/* status pill — brand mint, with a square blinking LED dot */
.status {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin: 1.3rem 0 0; padding: 0;
  font-family: var(--mono); font-size: 0.5rem; line-height: 1.6; letter-spacing: 0.06em;
  color: var(--ink-soft);
}
/* a small status LED — square, hard blink, not the soft pulsing dot */
.status-dot {
  width: 7px; height: 7px; flex: none;
  background: var(--spark);
  animation: status-blink 1.4s steps(2) infinite;
}
@keyframes status-blink { 50% { opacity: 0.35; } }

.stage-wrap { width: min(960px, 96vw); margin-top: 1.6rem; }
/* the scene floats directly on the page — no frame, just a soft shadow.
   the canvas is a 480x360 buffer but only the central 480x270 is the "room box":
   pull the 90px of transparent headroom (9.375% of width per side) back out of
   layout so the room keeps its size + position while the roof/floor escape the
   frame instead of being clipped. % margins keep this correct at any width. */
.stage { position: relative; margin: -9.375% 0; }
.stage--hot { cursor: pointer; }
#scene3d, .scene-fallback {
  display: block; width: 100%; height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 14px 22px color-mix(in srgb, var(--ink) 28%, transparent));
}
/* static poster shows instantly; live canvas fades in over it on first frame.
   no drop-shadow here — the poster is an opaque rectangle, so a shadow would
   read as a box under the room; the canvas below already casts the right one. */
.scene-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  image-rendering: pixelated;
  transition: opacity 0.5s ease;
}
#scene3d { transition: opacity 0.5s ease; }
.stage:not(.stage--live) #scene3d { opacity: 0; }
.stage--live .scene-poster { opacity: 0; pointer-events: none; }

.stage-hint {
  text-align: center; font-family: var(--mono); font-size: 0.55rem;
  color: var(--ink-soft); margin-top: 0.9rem; letter-spacing: 0.08em;
  transition: opacity 0.5s;
}
.stage-hint .blink { color: var(--spark-deep); animation: blink 1.2s steps(2) infinite; }
.stage-hint.done { opacity: 0; }
@keyframes blink { 50% { opacity: 0; } }

.scroll-cue {
  margin-top: auto; padding: 0.8rem;
  color: var(--ink-soft); text-decoration: none; font-size: 0.8rem;
  animation: bob 1.6s ease-in-out infinite;
}
@keyframes bob { 50% { translate: 0 5px; } }

/* ---- hotspots ---- */
.hotspot-layer { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute; width: 38px; height: 38px;
  translate: -50% -50%;
  background: transparent; border: 0; cursor: pointer; padding: 0;
  pointer-events: auto;
  display: grid; place-items: center;
}
.hotspot-marker {
  width: 9px; height: 9px; pointer-events: none;
  background: var(--spark);
  clip-path: polygon(33% 0, 66% 0, 66% 33%, 100% 33%, 100% 66%, 66% 66%, 66% 100%, 33% 100%, 33% 66%, 0 66%, 0 33%, 33% 33%);
  animation: pulse 2s ease-in-out infinite;
  opacity: 0.85;
}
@keyframes pulse { 50% { scale: 1.5; opacity: 0.4; } }
.hotspot:hover .hotspot-marker, .hotspot:focus-visible .hotspot-marker { animation-duration: 0.7s; }
.hotspot:focus-visible { outline: 2px solid var(--spark); outline-offset: -2px; }

.tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  left: var(--x, 50%); top: var(--y, 0);
  translate: -50% calc(-100% - 10px);
  width: max-content; max-width: 230px;
  background: var(--navy); color: #eafff7;
  border: 2px solid var(--spark);
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem; line-height: 1.35;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.25);
}
.tooltip[data-pos="below"] { translate: -50% 10px; }
.tooltip strong {
  display: block; font-family: var(--mono); font-size: 0.55rem;
  color: var(--spark); margin-bottom: 0.3rem; letter-spacing: 0.05em;
}

.meow {
  position: absolute; left: 50%; top: -12px; translate: -50% -100%;
  background: #fff; color: #15181a; border: 2px solid #15181a;
  font-size: 0.72rem; padding: 2px 7px; white-space: nowrap;
  animation: meow-pop 1.4s ease forwards;
}
@keyframes meow-pop {
  0% { opacity: 0; scale: 0.6; } 12% { opacity: 1; scale: 1; }
  80% { opacity: 1; } 100% { opacity: 0; translate: -50% -130%; }
}

/* ============ sections ============ */
.section { padding: 5rem 1.4rem; }
.section--alt { background: var(--paper-deep); }
.section-inner { max-width: 1020px; margin: 0 auto; }
.section-title {
  font-size: clamp(1.4rem, 3vw, 2rem); margin: 0 0 2.2rem;
  display: flex; align-items: baseline; gap: 0.8rem;
}
.title-pixel {
  font-family: var(--mono); font-size: 0.85em; color: var(--spark-deep);
}
.section-note {
  font-family: var(--mono); font-size: 0.55rem; color: var(--ink-soft);
  margin: -1.6rem 0 1.8rem; letter-spacing: 0.05em;
}

/* about */
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2.5rem; align-items: start; }
.lead { font-size: 1.25rem; }
.about-text p { margin: 0 0 1rem; }
.about-facts { list-style: none; padding: 0; margin: 1.4rem 0 0; }
.about-facts li { padding: 0.35rem 0; }
.fact-icon { display: inline-flex; justify-content: flex-start; width: 1.8rem; vertical-align: -0.22em; }
.fact-icon svg { width: 17px; height: 17px; fill: var(--spark-deep); shape-rendering: crispEdges; }
body[data-mode="night"] .fact-icon svg { fill: var(--spark); }

/* how I work — a few working-style principles */
.principles { list-style: none; padding: 0; margin: 1.4rem 0 0; display: grid; gap: 0.7rem; }
.principles li { position: relative; padding-left: 1.4rem; color: var(--ink-soft); font-size: 0.95rem; }
.principles li::before { content: "▸"; position: absolute; left: 0; top: 0; color: var(--spark-deep); }
.principles strong { color: var(--ink); }

.about-card {
  background: var(--navy); color: #e8efea;
  border: 3px solid var(--spark); box-shadow: 5px 5px 0 rgba(0,0,0,0.35);
  padding: 1.2rem 1.3rem;
}
.about-card-header {
  font-family: var(--mono); font-size: 0.6rem; color: var(--spark);
  letter-spacing: 0.15em; margin-bottom: 1rem;
  border-bottom: 2px solid rgba(0,255,174,0.30); padding-bottom: 0.7rem;
}
.stat-list { margin: 0; }
.stat { display: flex; gap: 0.8rem; padding: 0.32rem 0; font-size: 0.9rem; }
.stat dt { font-family: var(--mono); font-size: 0.5rem; color: #8a93b8; width: 5.2rem; flex: none; padding-top: 0.25rem; }
.stat dd { margin: 0; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.card {
  background: var(--card); border: 2px solid var(--line);
  padding: 1.5rem 1.4rem; position: relative;
  transition: translate 0.15s ease, box-shadow 0.15s ease, border-color 0.15s;
}
.card:hover {
  translate: 0 -4px; border-color: var(--spark);
  box-shadow: 5px 7px 0 color-mix(in srgb, var(--spark) 35%, transparent);
}
.card-icon { margin-bottom: 0.8rem; line-height: 0; }
.pixicon { width: 30px; height: 30px; fill: var(--spark-deep); shape-rendering: crispEdges; }
body[data-mode="night"] .pixicon { fill: var(--spark); }
.card h3 { margin: 0 0 0.6rem; font-size: 1.12rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.card-tags {
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem;
  padding: 0; margin: 1.1rem 0 0;
}
.card-tags li {
  font-family: var(--mono); font-size: 0.48rem; letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--spark) 18%, transparent);
  color: var(--spark-deep); border: 1px solid color-mix(in srgb, var(--spark) 45%, transparent);
  padding: 4px 7px;
}
body[data-mode="night"] .card-tags li { color: var(--spark); }

/* case studies: problem → process → result inside a project card */
.case { margin: 0.2rem 0 0; }
.case-row { display: grid; grid-template-columns: 4.4rem 1fr; gap: 0.7rem; padding: 0.35rem 0; }
.case-row dt {
  font-family: var(--mono); font-size: 0.44rem; letter-spacing: 0.03em;
  color: var(--spark-deep); padding-top: 0.25rem; line-height: 1.5;
}
.case-row dd { margin: 0; color: var(--ink-soft); font-size: 0.92rem; line-height: 1.45; }
.case-metric { color: var(--ink); font-weight: 600; }
body[data-mode="night"] .case-row dt { color: var(--spark); }

/* ---- trophy shelf (downpage clients) ---- */
.trophy-shelf {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.4rem 2rem;
  margin: 1.6rem 0 0; padding: 1.2rem 1.6rem 1.1rem; position: relative;
}
.trophy-shelf::after {                 /* the ledge the logos stand on */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background: linear-gradient(#23272b, #15181a); border-radius: 3px;
  box-shadow: 0 6px 14px color-mix(in srgb, #000 22%, transparent);
}
.trophy {
  appearance: none; background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  padding: 0 0 12px;                   /* clears the ledge */
}
.trophy-frame {
  display: flex; align-items: center; justify-content: center;
  min-width: 104px; min-height: 70px; padding: 0.9rem 1.2rem;
  background: #f6f8f7; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 7px 10px color-mix(in srgb, #000 20%, transparent);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.trophy img { height: 42px; width: auto; max-width: 150px; display: block; }
.trophy-name {
  font-family: var(--mono); font-size: 0.5rem; letter-spacing: 0.08em;
  color: var(--ink-soft); transition: color .18s ease;
}
.trophy:hover .trophy-frame,
.trophy:focus-visible .trophy-frame,
.trophy.is-active .trophy-frame {
  transform: translateY(-10px); border-color: var(--spark);
  box-shadow: 0 16px 20px color-mix(in srgb, #000 26%, transparent);
}
.trophy:focus-visible { outline: none; }
.trophy:focus-visible .trophy-frame { outline: 2px solid var(--spark); outline-offset: 3px; }
.trophy:hover .trophy-name,
.trophy:focus-visible .trophy-name,
.trophy.is-active .trophy-name { color: var(--spark-deep); }
.trophy-detail {
  margin: 1.8rem 0 0; min-height: 3.2rem; max-width: 640px;
  color: var(--ink-soft); font-size: 1rem; line-height: 1.5;
}
.trophy-detail strong {
  font-family: var(--mono); font-size: 0.62rem; color: var(--ink); margin-right: 0.7rem;
}
.trophy-detail .trophy-meta { font-family: var(--mono); font-size: 0.5rem; color: var(--spark-deep); }
.trophy-detail .trophy-blurb { display: block; margin-top: 0.6rem; }

/* project thumbs: little CSS pixel scenes */
.project-thumb {
  height: 92px; margin: -0.4rem -0.3rem 1rem; border: 2px solid var(--line);
  background-color: var(--navy);
  image-rendering: pixelated;
  background-size: 14px 14px;
}
.project-thumb[data-thumb="sensor"] {
  background-image:
    linear-gradient(45deg, transparent 46%, #4dff7c 46% 54%, transparent 54%),
    radial-gradient(circle at 50% 50%, #2f7d4f 22%, transparent 23%),
    repeating-linear-gradient(0deg, #232a44 0 7px, #1d2233 7px 14px);
}
.project-thumb[data-thumb="wearable"] {
  background-image:
    radial-gradient(circle at 50% 50%, #58b7e8 16%, transparent 17%),
    repeating-radial-gradient(circle at 50% 50%, #232a44 0 9px, #1d2233 9px 18px);
  background-size: auto, auto;
}
.project-thumb[data-thumb="charger"] {
  background-image:
    linear-gradient(0deg, transparent 42%, #00ffae 42% 50%, transparent 50%),
    linear-gradient(90deg, transparent 46%, #00ffae 46% 54%, transparent 54%),
    repeating-linear-gradient(90deg, #232a44 0 7px, #1d2233 7px 14px);
}

/* testimonials */
.quotes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.4rem; margin-top: 1.6rem; }
.quotes:has(.quote:only-child) { grid-template-columns: 1fr; max-width: 640px; margin-inline: auto; }
.quote {
  margin: 0; background: var(--card); border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 color-mix(in srgb, var(--spark) 35%, transparent);
  padding: 1.4rem 1.5rem;
}
.quote blockquote { margin: 0; font-size: 1.05rem; line-height: 1.55; color: var(--ink); }
.quote blockquote::before {
  content: "\201C"; color: var(--spark-deep); font-size: 1.5em; line-height: 0;
  margin-right: 0.08em; vertical-align: -0.35em;
}
.quote-attr { display: block; margin-top: 1.1rem; }
.quote-name { display: block; font-weight: 600; color: var(--ink); }
.quote-role {
  display: block; font-family: var(--mono); font-size: 0.48rem; letter-spacing: 0.04em;
  color: var(--spark-deep); margin-top: 0.4rem;
}
body[data-mode="night"] .quote-role { color: var(--spark); }

/* contact */
.section--contact { text-align: center; padding-bottom: 6rem; }
.contact-lead { font-size: 1.15rem; color: var(--ink-soft); margin: 0 0 2rem; }
.contact-actions { display: flex; gap: 0.9rem; justify-content: center; flex-wrap: wrap; }
.btn {
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.04em;
  padding: 0.95rem 1.25rem; cursor: pointer; text-decoration: none;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  transition: translate 0.1s, box-shadow 0.1s;
}
.btn:hover { translate: 2px 2px; box-shadow: 2px 2px 0 var(--ink); }
.btn:active { translate: 4px 4px; box-shadow: 0 0 0 var(--ink); }
.btn--primary { background: var(--spark); color: #04231a; border-color: var(--ink); }
.btn--linkedin { background: #0a66c2; color: #fff; border-color: var(--ink); }
.btn-glyph { width: 0.8rem; height: 0.8rem; fill: currentColor; shape-rendering: crispEdges; vertical-align: -0.05em; margin-right: 0.15rem; }
.contact-socials { margin-top: 2.2rem; display: flex; gap: 1.6rem; justify-content: center; }
.contact-socials a { color: var(--ink-soft); font-weight: 500; }
.contact-socials a:hover { color: var(--spark-deep); }

/* footer */
.footer {
  border-top: 2px solid var(--line);
  padding: 1.6rem; text-align: center;
  font-size: 0.8rem; color: var(--ink-soft);
}

/* ============ responsive ============ */
@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .quotes { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .section { padding: 3.5rem 1.2rem; }
}
