:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --text: #101112;
  --muted: #696a6b;
  --line: rgba(16, 17, 18, 0.15);
  --accent: #101112;
  --project: #eea51b;
  --project-rgb: 238, 165, 27;
  --project-ink: #17120a;
  --radius: 18px;
  --max: 1180px;
}

html[data-theme="dark"] {
  --bg: #101214;
  --surface: #181b1e;
  --text: #f3f3ef;
  --muted: #aeb0b1;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #f3f3ef;
}

body[data-project="boraso"] {
  --project: #344679;
  --project-rgb: 52, 70, 121;
  --project-ink: #f6f1e8;
}

body[data-project="zwave"] {
  --project: #d914f4;
  --project-rgb: 217, 20, 244;
  --project-ink: #080411;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  line-height: 1.55;
}
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, transparent calc(50% - .5px), color-mix(in srgb, var(--line) 45%, transparent) 50%, transparent calc(50% + .5px)),
    radial-gradient(circle at 12% 0%, rgba(var(--project-rgb), .11), transparent 30rem);
}
a { color: inherit; }
.container { width: min(100% - 2.5rem, var(--max)); margin-inline: auto; }
.scroll-progress { position: fixed; inset: 0 0 auto; z-index: 80; height: 3px; }
.scroll-progress span { display: block; width: 0; height: 100%; background: var(--project); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
}
.header-row { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.site-logo { display: block; width: 58px; height: auto; aspect-ratio: 232 / 199; }
.site-nav { display: flex; align-items: center; gap: 1.2rem; }
.site-nav a, .mobile-menu a { color: var(--muted); font-size: .9rem; text-decoration: none; }
.site-nav a:hover, .site-nav a.current { color: var(--text); }
.site-nav a.current::after { display: block; width: 100%; height: 2px; margin-top: .3rem; background: var(--project); content: ""; }
.header-actions { display: flex; align-items: center; gap: .45rem; }
.icon-btn {
  min-width: 40px;
  padding: .48rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  cursor: pointer;
}
.mobile-only, .mobile-menu { display: none; }

.case-hero { padding: clamp(3.5rem, 8vw, 7.5rem) 0 2rem; }
.case-topline { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: clamp(3rem, 8vw, 6rem); }
.case-back {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--muted);
  font-size: .88rem;
  text-decoration: none;
}
.case-back::before { content: "\2190"; color: var(--project); font-size: 1.2rem; }
.case-number { color: var(--muted); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(250px, .45fr); align-items: end; gap: clamp(2rem, 7vw, 7rem); }
.eyebrow {
  margin: 0 0 .8rem;
  color: var(--project);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
  max-width: 11ch;
  margin-bottom: 0;
  font-size: clamp(3.9rem, 11vw, 9rem);
  font-weight: 620;
  letter-spacing: -.07em;
  line-height: .82;
}
.hero-side { padding-bottom: .4rem; }
.lead { margin-bottom: 1.5rem; color: var(--muted); font-size: clamp(1.05rem, 1.7vw, 1.28rem); }
.live-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: .72rem 1.05rem;
  border: 1px solid var(--text);
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .9rem;
  text-decoration: none;
  transition: transform .2s ease, background .2s ease;
}
.live-link:hover { transform: translateY(-2px); background: var(--project); border-color: var(--project); color: var(--project-ink); }

.showcase { padding: clamp(2rem, 5vw, 4rem) 0 clamp(4rem, 9vw, 8rem); }
.browser-shell {
  position: relative;
  padding: clamp(.65rem, 1.3vw, 1rem);
  border: 1px solid rgba(var(--project-rgb), .38);
  border-radius: clamp(18px, 3vw, 32px);
  background:
    linear-gradient(145deg, rgba(var(--project-rgb), .95), rgba(var(--project-rgb), .52)),
    var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .14);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: .4rem;
  height: 42px;
  padding: 0 .75rem;
  border-radius: 14px 14px 0 0;
  background: rgba(10, 10, 10, .88);
}
.browser-bar i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .46); }
.browser-address { margin-left: .55rem; color: rgba(255, 255, 255, .66); font-size: .72rem; letter-spacing: .03em; }
.browser-viewport {
  height: clamp(340px, 60vw, 690px);
  overflow: hidden;
  border-radius: 0 0 16px 16px;
  background: #0d0e10;
}
.browser-viewport img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
body[data-project="facciobuono"] .browser-viewport img { width: min(100%, 760px); margin-inline: auto; object-fit: cover; }
.showcase-note {
  position: absolute;
  right: clamp(1.2rem, 3vw, 2.5rem);
  bottom: clamp(1.2rem, 3vw, 2.5rem);
  max-width: 230px;
  padding: .8rem 1rem;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 12px;
  background: rgba(10, 10, 10, .82);
  color: #fff;
  font-size: .78rem;
  backdrop-filter: blur(12px);
}

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact { min-height: 145px; padding: 1.4rem 1.2rem 1.2rem 0; }
.fact + .fact { padding-left: 1.2rem; border-left: 1px solid var(--line); }
.fact span { display: block; margin-bottom: 2rem; color: var(--muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.fact strong { display: block; font-size: clamp(1rem, 1.8vw, 1.3rem); font-weight: 520; }

.story-section { padding: clamp(5rem, 11vw, 10rem) 0; border-bottom: 1px solid var(--line); }
.story-grid { display: grid; grid-template-columns: minmax(0, .42fr) minmax(0, 1fr); gap: clamp(3rem, 10vw, 9rem); }
.section-label { display: flex; gap: .7rem; color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.section-label b { color: var(--project); }
.story-content h2 {
  max-width: 17ch;
  margin-bottom: 2rem;
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 560;
  letter-spacing: -.055em;
  line-height: .98;
}
.story-content > p { max-width: 680px; color: var(--muted); font-size: clamp(1.08rem, 2vw, 1.35rem); }

.principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 3.5rem; }
.principle {
  position: relative;
  min-height: 290px;
  padding: 1.3rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.principle::after {
  position: absolute;
  right: -55px;
  bottom: -70px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(var(--project-rgb), .13);
  content: "";
}
.principle-index { display: block; margin-bottom: 5rem; color: var(--project); font-size: .74rem; }
.principle h3 { margin-bottom: .7rem; font-size: 1.25rem; }
.principle p { margin-bottom: 0; color: var(--muted); font-size: .94rem; }

.impact-band { background: var(--project); color: var(--project-ink); }
.impact-inner { display: grid; grid-template-columns: .45fr 1fr; gap: 3rem; padding: clamp(4rem, 9vw, 8rem) 0; }
.impact-inner .section-label, .impact-inner .section-label b { color: currentColor; opacity: .7; }
.impact-quote { max-width: 18ch; margin: 0; font-size: clamp(2.2rem, 6vw, 5.2rem); font-weight: 570; letter-spacing: -.055em; line-height: .98; }

.project-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: clamp(.8rem, 2vw, 1.4rem);
  padding: clamp(4rem, 9vw, 7rem) 0;
}

.project-nav-link,
.project-nav-all {
  color: var(--text);
  text-decoration: none;
}

.project-nav-link {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 150px;
  padding: 1.4rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: transform .22s ease, border-color .22s ease, background .22s ease;
}

.project-nav-link::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--project) 10%, transparent), transparent 58%);
  opacity: 0;
  content: "";
  transition: opacity .22s ease;
  pointer-events: none;
}

.project-nav-link:hover,
.project-nav-link:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--project) 50%, var(--line));
}

.project-nav-link:hover::before,
.project-nav-link:focus-visible::before { opacity: 1; }

.project-nav-link small {
  position: relative;
  display: block;
  margin-bottom: .75rem;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.project-nav-title {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.project-nav-title strong {
  font-size: clamp(1.45rem, 3vw, 2.7rem);
  font-weight: 560;
  letter-spacing: -.045em;
  line-height: .95;
}

.project-nav-arrow {
  color: var(--project);
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: .8;
  transition: transform .22s ease;
}

.project-nav-prev:hover .project-nav-arrow,
.project-nav-prev:focus-visible .project-nav-arrow { transform: translateX(-.3rem); }
.project-nav-next:hover .project-nav-arrow,
.project-nav-next:focus-visible .project-nav-arrow { transform: translateX(.3rem); }

.project-nav-next { text-align: right; }

.project-nav-all {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  white-space: nowrap;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.project-nav-all:hover,
.project-nav-all:focus-visible {
  border-color: color-mix(in srgb, var(--text) 38%, var(--line));
  background: var(--surface);
  color: var(--text);
}

.project-nav-contact { display: none; }

@media (max-width: 800px) {
  .container { width: min(100% - 1.4rem, var(--max)); }
  .site-nav { display: none; }
  .mobile-only { display: inline-flex; }
  .mobile-menu.open { display: block; padding: 1rem; border-top: 1px solid var(--line); }
  .mobile-menu-links { display: flex; flex-direction: column; gap: .8rem; }
  .hero-grid, .story-grid, .impact-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  h1 { font-size: clamp(3.8rem, 19vw, 7rem); }
  .hero-side { max-width: 550px; }
  .browser-viewport { height: 62vw; min-height: 320px; }
  .showcase-note { display: none; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .fact:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .fact:nth-child(4) { border-top: 1px solid var(--line); }
  .principles { grid-template-columns: 1fr; }
  .principle { min-height: auto; }
  .principle-index { margin-bottom: 3rem; }
  .project-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: .55rem;
    padding: 2.75rem 0;
  }
  .project-nav-link,
  .project-nav-all,
  .project-nav-contact {
    width: 100%;
    min-height: 62px;
    margin: 0;
    padding: .55rem .65rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    color: var(--text);
    text-decoration: none;
  }
  .project-nav-link {
    display: grid;
    align-content: center;
  }
  .project-nav-link::before { display: none; }
  .project-nav-link:hover,
  .project-nav-link:focus-visible {
    transform: none;
    border-color: var(--project);
    background: var(--surface);
  }
  .project-nav-link small {
    display: block;
    margin-bottom: .18rem;
    font-size: .56rem;
  }
  .project-nav-title {
    align-items: center;
    gap: .35rem;
  }
  .project-nav-title strong {
    display: block;
    overflow: hidden;
    font-size: .82rem;
    letter-spacing: -.015em;
    line-height: 1.1;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .project-nav-arrow {
    color: var(--project);
    font-size: .82rem;
    line-height: 1;
  }
  .project-nav-all,
  .project-nav-contact {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    align-self: stretch;
    justify-self: stretch;
    font-size: .76rem;
    letter-spacing: 0;
    text-transform: none;
  }
  .project-nav-all::after {
    color: var(--project);
    content: "\2197";
    font-size: .76rem;
  }
  .project-nav-contact::after {
    color: var(--project);
    content: "\2192";
    font-size: .76rem;
  }
  .project-nav-all:hover,
  .project-nav-all:focus-visible,
  .project-nav-contact:hover,
  .project-nav-contact:focus-visible {
    border-color: var(--project);
    background: var(--surface);
    color: var(--text);
  }
  .project-nav-prev {
    grid-column: 1;
    grid-row: 1;
  }
  .project-nav-next {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  .project-nav-all {
    grid-column: 1;
    grid-row: 2;
  }
  .project-nav-contact {
    grid-column: 2;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Alignment with the main portfolio */
:root {
  --max: 1080px;
  --radius: 12px;
}
body::before { display: none; }
.container { width: min(100% - 2rem, var(--max)); }
.site-header {
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(8px);
}
.header-row { min-height: 72px; gap: 1rem; }
.site-nav { gap: .95rem; }
.site-nav a, .mobile-menu a { font-size: .95rem; }
.site-nav a.current::after { display: none; }
.site-nav a.current { color: var(--text); }
.icon-btn {
  min-width: 0;
  padding: .45rem .7rem;
  border-radius: 9px;
  background: var(--surface);
}
.case-hero { padding: clamp(3.5rem, 7vw, 6rem) 0 1.5rem; }
.case-topline { margin-bottom: clamp(2.5rem, 6vw, 4.5rem); }
.hero-grid { grid-template-columns: minmax(0, 1.35fr) minmax(240px, .65fr); gap: clamp(2rem, 6vw, 5rem); }
h1 {
  max-width: 12ch;
  font-size: clamp(3.5rem, 8vw, 6.6rem);
  font-weight: 580;
  line-height: .9;
}
.lead { font-size: clamp(1rem, 1.55vw, 1.18rem); }
.live-link { min-height: 44px; padding: .62rem .95rem; }
.showcase { padding: 1.5rem 0 clamp(4rem, 8vw, 6rem); }
.browser-shell {
  padding: .7rem;
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .1);
}
.browser-bar {
  height: 38px;
  border-radius: 8px 8px 0 0;
}
.browser-viewport {
  height: clamp(320px, 54vw, 600px);
  border-radius: 0 0 8px 8px;
  background: color-mix(in srgb, var(--surface) 88%, #000);
}
.browser-viewport-product img {
  width: min(92%, 980px);
  height: 100%;
  margin-inline: auto;
  object-fit: contain;
}
.browser-viewport-photo img { object-position: center 34%; }
body[data-project="facciobuono"] .browser-viewport img {
  width: min(92%, 980px);
  object-fit: contain;
}
body[data-project="facciobuono"] .browser-viewport-product img {
  width: 100%;
  margin-inline: 0;
  object-fit: cover;
  object-position: top center;
}
.showcase-note {
  right: 1.6rem;
  bottom: 1.6rem;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  border-color: var(--line);
}
.facts { border-color: var(--line); }
.fact { min-height: 130px; }
.story-section { padding: clamp(4.5rem, 9vw, 7rem) 0; }
.story-grid { grid-template-columns: minmax(0, .35fr) minmax(0, 1fr); gap: clamp(2rem, 8vw, 7rem); }
.story-content h2 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 540;
  line-height: 1.02;
}
.principle { min-height: 250px; border-radius: var(--radius); }
.principle::after { opacity: .55; }
.impact-band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.impact-inner .section-label { color: var(--muted); opacity: 1; }
.impact-inner .section-label b { color: var(--project); opacity: 1; }
.impact-quote {
  max-width: 22ch;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 530;
  line-height: 1.03;
}

.media-section { padding: clamp(4.5rem, 9vw, 7rem) 0; }
.media-landscape, .media-wide, .media-duo figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.media-landscape {
  display: grid;
  place-items: center;
  min-height: clamp(330px, 54vw, 580px);
  padding: clamp(1rem, 4vw, 3rem);
}
.media-landscape img { display: block; width: min(100%, 980px); height: auto; }
.media-wide img { display: block; width: 100%; height: auto; }
.media-duo { display: grid; grid-template-columns: .8fr 1.2fr; gap: 1rem; height: clamp(440px, 62vw, 720px); }
.media-duo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-duo figure:first-child img { object-position: center; }
.media-duo figure:last-child img { object-position: center 35%; }
.media-caption { display: grid; grid-template-columns: .35fr 1fr; gap: 2rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.media-caption span { color: var(--project); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.media-caption p { max-width: 640px; margin-bottom: 0; color: var(--muted); }

@media (max-width: 800px) {
  .hero-grid, .story-grid, .impact-inner, .media-caption { grid-template-columns: 1fr; }
  .media-duo { grid-template-columns: 1fr 1fr; height: 480px; }
}
@media (max-width: 560px) {
  .media-duo { grid-template-columns: 1fr; height: auto; }
  .media-duo figure { aspect-ratio: 4 / 3; }
}

.browser-viewport.has-hotspots {
  position: relative;
}

.case-hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.case-hotspot {
  position: absolute;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  background: color-mix(in srgb, var(--project) 82%, #111);
  color: var(--project-ink);
  font: inherit;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 0 rgba(var(--project-rgb), .38), 0 10px 28px rgba(0, 0, 0, .28);
  animation: hotspotPulse 2.6s ease-in-out infinite;
}

.case-hotspot:nth-child(2) { animation-delay: .45s; }
.case-hotspot:nth-child(3) { animation-delay: .9s; }

.case-hotspot:hover,
.case-hotspot:focus-visible,
.case-hotspot.is-active {
  z-index: 2;
  transform: translate(-50%, -50%) scale(1.15) !important;
  box-shadow: 0 0 0 8px rgba(var(--project-rgb), .18), 0 12px 30px rgba(0, 0, 0, .3) !important;
}

.case-hotspot-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .8rem;
  align-items: start;
  margin-top: .7rem;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.case-hotspot-index {
  color: var(--project);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
}

.case-hotspot-panel h3,
.case-hotspot-panel p {
  margin: 0;
}

.case-hotspot-panel h3 {
  margin-bottom: .16rem;
  font-size: 1rem;
}

.case-hotspot-panel p {
  max-width: 68ch;
  color: var(--muted);
  font-size: .9rem;
}

@keyframes hotspotPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--project-rgb), .34), 0 10px 28px rgba(0, 0, 0, .28); }
  50% { box-shadow: 0 0 0 9px rgba(var(--project-rgb), 0), 0 10px 28px rgba(0, 0, 0, .28); }
}

@media (max-width: 620px) {
  .case-hotspot {
    width: 2.45rem;
    height: 2.45rem;
    min-width: 2.45rem;
  }

  .case-hotspot-panel {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .case-hotspot {
    animation: none;
  }
}
