:root {
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5d6470;
  --border: #e2e3df;
  --accent: #0f766e;
  --accent-soft: #e3f3f1;
  --c-esp8266: #0f766e;
  --c-esp32: #7c3aed;
  --c-multi: #b45309;
  --led: #10b981;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #161a1f;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --border: #262b33;
    --accent: #2dd4bf;
    --accent-soft: #11302d;
    --c-esp8266: #2dd4bf;
    --c-esp32: #a78bfa;
    --c-multi: #fbbf24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #161a1f;
  --text: #e8eaed;
  --muted: #9aa3ae;
  --border: #262b33;
  --accent: #2dd4bf;
  --accent-soft: #11302d;
  --c-esp8266: #2dd4bf;
  --c-esp32: #a78bfa;
  --c-multi: #fbbf24;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.muted { color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-family: "IBM Plex Mono", monospace; }
.brand-mark { display: block; width: 32px; height: 32px; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--text); }
.theme-toggle {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
  color: var(--text); cursor: pointer;
}

/* Hero */
.hero { padding-top: 72px; padding-bottom: 40px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: center; }
.hero-photo { margin: 0; }
.lede .name { color: var(--text); font-weight: 600; }
.hero-photo figcaption { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.hero-photo figcaption .name { font-weight: 600; font-size: 17px; }
.hero-photo figcaption .mono { font-size: 12px; white-space: nowrap; }
.hero-photo figcaption .org { color: var(--accent); font-weight: 600; }
.hero-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 16px; border: 1px solid var(--border); }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.led {
  width: 8px; height: 8px; border-radius: 50%; background: var(--led);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--led) 25%, transparent);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .led { animation: none; } html { scroll-behavior: auto; } }
.hero h1 { font-size: clamp(32px, 6vw, 54px); font-weight: 700; letter-spacing: -0.02em; max-width: 16ch; }
.lede { font-size: 18px; color: var(--muted); max-width: 62ch; margin: 18px 0 32px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; min-width: 140px; }
.stats dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stats dd { margin: 2px 0 0; font: 600 20px "IBM Plex Mono", monospace; }

/* Sections */
.section { padding-top: 48px; padding-bottom: 24px; }
.section h2 { font-size: 26px; margin-bottom: 20px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  font: 500 14px "IBM Plex Sans", sans-serif; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* Project cards */
.show-more { margin-top: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px;
  border-top: 3px solid var(--c-esp8266);
}
.card[data-family="esp32"] { border-top-color: var(--c-esp32); }
.card[data-family="multi"] { border-top-color: var(--c-multi); }
.card h3 { font-size: 18px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.card-date { margin-left: auto; }
.badge { font-weight: 600; }
.badge-esp8266 { color: var(--c-esp8266); }
.badge-esp32 { color: var(--c-esp32); }
.badge-multi { color: var(--c-multi); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: auto 0 0; }
.tags li {
  font: 12px "IBM Plex Mono", monospace; padding: 3px 8px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
}

/* Stack */
.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.stack-col { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stack-col h3 { font-size: 15px; margin-bottom: 12px; }

/* Contact & footer */
.contact p { color: var(--muted); max-width: 60ch; }
.button {
  display: inline-block; padding: 10px 16px; border-radius: 8px; background: var(--accent);
  color: var(--bg); text-decoration: none; font-weight: 600; font-family: "IBM Plex Mono", monospace; font-size: 14px;
}
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { display: inline-flex; align-items: center; gap: 8px; }
.button-whatsapp { background: #25d366; color: #0b1f14; }
/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.shot { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.shot-wide { grid-column: 1 / -1; }
.shot img, .shot video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.shot-wide video { aspect-ratio: auto; max-height: 520px; object-fit: contain; }
.shot figcaption { padding: 12px 16px; font-size: 14px; color: var(--muted); }
/* Photo + phone screenshot side by side; column widths follow each image's aspect ratio so heights match */
.pair { display: grid; grid-template-columns: 3fr 2fr; }
.shot .pair img { aspect-ratio: auto; height: 100%; object-fit: cover; }
/* Phone mockup with the real alerts as text, so it stays readable at any size */
.phone-wrap { display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 120% at 0% 0%, #14b8a6, #0f766e 45%, #083b37); }
.phone { position: relative; width: 100%; max-width: 270px; padding: 30px 10px 14px; border-radius: 32px; background: #121418; border: 3px solid #2b3038; box-shadow: 0 16px 40px rgba(0,0,0,.35); color: #e8eaed; font-family: "IBM Plex Sans", system-ui, sans-serif; }
.phone-notch { position: absolute; top: 10px; left: 50%; width: 70px; height: 8px; margin-left: -35px; border-radius: 6px; background: #2b3038; }
.phone-bar { display: flex; align-items: center; gap: 8px; padding: 2px 6px 10px; font-size: 13px; color: #9aa3ae; }
.phone-app { padding: 1px 7px; border-radius: 6px; background: #317f6f; color: #fff; font-weight: 600; font-size: 12px; }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alerts li { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: #1e2329; font-size: 12.5px; line-height: 1.35; }
.alerts time { font-size: 11px; color: #9aa3ae; }
.alerts b { font-size: 13px; color: #fff; }
.alerts span { color: #c9ced6; }
.shot figcaption a { color: var(--accent); }

/* Websites */
.sites { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.site-card { display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: inherit; text-decoration: none; }
a.site-card:hover { border-color: var(--accent); }
.site-domain { font-weight: 600; color: var(--accent); overflow-wrap: anywhere; }
.site-desc { color: var(--muted); font-size: 15px; }
.site-visit { margin-top: auto; padding-top: 8px; font-size: 13px; color: var(--text); }
.site-more { border-style: dashed; }

/* Order */
.section-lede { color: var(--muted); max-width: 62ch; margin: -8px 0 24px; font-size: 17px; }
/* Order band: full-width spotlight, same teal look in light and dark */
.order-band {
  margin-top: 56px; padding: 64px 0;
  background: radial-gradient(120% 140% at 0% 0%, #14b8a6 0%, #0f766e 38%, #083b37 100%);
  color: #f0fdfa;
}
.order-kicker { display: inline-block; margin: 0 0 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.order-band h2 { font-size: clamp(28px, 4.5vw, 40px); letter-spacing: -0.01em; margin-bottom: 12px; }
.order-lede { max-width: 58ch; margin: 0 0 36px; font-size: 18px; color: rgba(240,253,250,.85); }
.steps { list-style: none; padding: 0; margin: 0 0 36px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; counter-reset: step; }
.step { position: relative; padding: 24px; border-radius: 16px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(4px); }
.step:not(:last-child)::after {
  content: ""; position: absolute; top: 50%; right: -22px; width: 16px; height: 16px; margin-top: -8px;
  border-top: 3px solid rgba(255,255,255,.6); border-right: 3px solid rgba(255,255,255,.6); transform: rotate(45deg);
}
.step-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.step-num { font-size: 40px; font-weight: 600; line-height: 1; color: #fff; }
.step-icon { width: 36px; height: 36px; color: #5eead4; }
.step h3 { font-size: 22px; margin-bottom: 8px; color: #fff; }
.step p { margin: 0; font-size: 15px; color: rgba(240,253,250,.82); }
.order-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: 40px; }
.button-lg { padding: 16px 26px; font-size: 17px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.button-lg svg { width: 22px; height: 22px; }
.order-note { font-size: 13px; color: rgba(240,253,250,.75); }
.order-ideas h3 { font-size: 15px; margin-bottom: 12px; color: #fff; }
.order-band .tags li { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); color: #f0fdfa; }
@media (max-width: 820px) {
  .order-band { padding: 48px 0; }
  .steps { grid-template-columns: 1fr; gap: 28px; }
  .step:not(:last-child)::after { top: auto; right: auto; bottom: -22px; left: 50%; margin: 0 0 0 -8px; transform: rotate(135deg); }
}

/* Hero buttons */
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.button-primary { background: var(--accent); color: var(--bg); }
.button-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.button:hover { filter: brightness(1.07); }

/* Floating WhatsApp order button */
.fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 20;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px 12px 14px;
  border-radius: 999px; background: #25d366; color: #0b1f14; text-decoration: none;
  font: 600 15px "IBM Plex Sans", sans-serif; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transition: opacity .2s, transform .2s;
}
.fab.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .fab { transition: none; } }

/* Accessibility */
.skip-link { position: absolute; left: 16px; top: -48px; z-index: 30; padding: 8px 12px; border-radius: 8px; background: var(--accent); color: var(--bg); font-weight: 600; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.order-band :focus-visible { outline-color: #fff; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 40px; padding-bottom: 88px; font-size: 13px; border-top: 1px solid var(--border); margin-top: 48px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-photo { order: -1; display: flex; align-items: center; gap: 16px; }
  .hero-photo img { width: 112px; flex: none; }
  .hero-photo figcaption { margin-top: 0; }
  .hero-photo img { border-radius: 50%; aspect-ratio: 1; object-position: center 25%; }
}
@media (max-width: 560px) {
  .nav { gap: 12px; }
  .nav-optional { display: none; }
  .nav a { font-size: 14px; }
  .hero { padding-top: 32px; }
  .brand > span:last-child .muted { display: none; }
}

/* Phones: keep the page short */
@media (max-width: 560px) {
  .gallery { grid-template-columns: 1fr; gap: 12px; }
  .pair { grid-template-columns: 1fr; }
  .shot .pair img { aspect-ratio: 16 / 9; }
  .shot figcaption { padding: 10px 12px; font-size: 13px; }
  .order-band { padding: 40px 0; }
  .order-lede { margin-bottom: 24px; font-size: 16px; }
  .steps { gap: 24px; margin-bottom: 28px; }
  .step { padding: 18px; }
  .step-head { margin-bottom: 10px; }
  .step-num { font-size: 30px; }
  .step-icon { width: 28px; height: 28px; }
  .step h3 { font-size: 19px; }
}
