/* ============================================================
   Onda — shell components: nav, footer, cta-final, language toggle.
   Reads only tier-2 --surface-* tokens (see tokens.css header).
   Page-specific component CSS (quiz, calculator, sphere styling, etc.)
   lands here too as each page is built — this file grows through the
   content phases, it isn't only "shell".
   ============================================================ */

/* ---- Nav (always .skin-tinta — see tokens.css / plan §"Direcció de
   disseny": one identical top edge across all 5 pages is what keeps a
   hybrid crema/tinta palette from reading as two different sites) ---- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--surface-hairline);
}
.site-nav-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: .9rem;
}
.nav-logo { color: var(--surface-text); flex-shrink: 0; }
.nav-logo svg { height: 22px; width: auto; display: block; }

.nav-links {
  display: flex;
  gap: 1.75rem;
  margin-inline-end: auto;
  font-family: var(--onda-mono);
  font-size: .78rem;
  text-transform: lowercase;
  letter-spacing: .02em;
}
.nav-links a { color: var(--surface-text-muted); }
.nav-links a:hover,
.nav-links a[aria-current="page"] { color: var(--surface-text); }

.nav-right { display: flex; align-items: center; gap: 1rem; margin-inline-start: auto; }
.nav-lang { font-family: var(--onda-mono); font-size: .72rem; color: var(--surface-text-faint); }
.nav-lang a { color: var(--surface-text-faint); }
.nav-lang a:hover { color: var(--surface-text); }
.nav-cta { padding: .55rem 1.15rem; font-size: .82rem; }

@media (max-width: 900px) {
  .nav-links { display: none; }
}

/* ---- Mobile drawer (<details>, works with zero JS) ---- */
.nav-drawer { display: none; position: relative; }
@media (max-width: 900px) {
  .nav-drawer { display: block; }
}
.nav-drawer summary {
  list-style: none;
  cursor: pointer;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.nav-drawer summary::-webkit-details-marker { display: none; }
.nav-drawer-icon,
.nav-drawer-icon::before,
.nav-drawer-icon::after {
  display: block;
  width: 18px; height: 2px;
  background: var(--surface-text);
  transition: transform .18s var(--onda-ease), opacity .18s var(--onda-ease);
}
.nav-drawer-icon::before,
.nav-drawer-icon::after { content: ''; position: relative; }
.nav-drawer-icon::before { top: -5px; }
.nav-drawer-icon::after { top: 3px; }
.nav-drawer[open] .nav-drawer-icon { background: transparent; }
.nav-drawer[open] .nav-drawer-icon::before { transform: translateY(5px) rotate(45deg); }
.nav-drawer[open] .nav-drawer-icon::after { transform: translateY(-3px) rotate(-45deg); }

.nav-drawer-panel {
  position: absolute;
  top: calc(100% + .75rem);
  right: 0;
  min-width: 14rem;
  background: var(--surface-bg-raised);
  border: 1px solid var(--surface-hairline);
  border-radius: var(--onda-radius-sm);
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}
.nav-drawer-panel a {
  padding: .6rem .5rem;
  border-radius: 6px;
  color: var(--surface-text);
}
.nav-drawer-panel a:hover { background: var(--surface-hairline); }
.nav-drawer-panel a[aria-current="page"] { color: var(--surface-accent-text); }
.nav-drawer-lang {
  margin-top: .4rem;
  padding: .5rem .5rem 0;
  border-top: 1px solid var(--surface-hairline);
  font-family: var(--onda-mono);
  font-size: .78rem;
  color: var(--surface-text-faint);
}
.nav-drawer-lang a { color: var(--surface-text-faint); }

/* ---- CTA final bookend ---- */
.cta-final h2 { max-width: 20ch; }
.cta-final .lede { max-width: 40ch; margin-inline: auto; }
.cta-final .wrap { align-items: center; text-align: center; }

/* ---- Footer ---- */
.site-footer { padding-block: var(--onda-section-y) 2rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2rem;
  padding-bottom: 2.5rem;
}
.footer-col { display: flex; flex-direction: column; gap: .6rem; font-size: .92rem; }
.footer-col a { color: var(--surface-text-muted); }
.footer-col a:hover { color: var(--surface-text); }
.footer-place { color: var(--surface-text-faint); font-family: var(--onda-mono); font-size: .8rem; }
.footer-lang a { color: var(--surface-text-faint); }
.footer-bottom { padding-top: 1.5rem; color: var(--surface-text-faint); font-size: .8rem; }
@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---- Home hero (sphere) ---- */
.hero-section { min-height: 88vh; display: flex; align-items: center; padding-block: 6rem; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; }
.hero-copy h1 { margin-top: 1rem; }
.hero-copy .lede { margin-top: 1.25rem; }
.hero-ctas { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-shape { position: relative; aspect-ratio: 1; width: min(100%, 640px); justify-self: center; }
.hero-shape canvas { width: 100%; height: 100%; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-shape { width: min(80%, 420px); order: -1; margin-inline: auto; }
  .hero-section { padding-block: 3rem; min-height: 0; }
}
@media (max-width: 480px) {
  .hero-shape { width: min(70%, 280px); }
}

/* ---- Calculator ---- */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: center; }
.calc-field { margin-bottom: 1.5rem; }
.calc-field label { display: flex; justify-content: space-between; font-size: .88rem; color: var(--surface-text-muted); margin-bottom: .4rem; }
.calc-field output { font-family: var(--onda-mono); color: var(--surface-accent-text); }
.calc-field input[type="range"] {
  width: 100%; appearance: none; height: 4px; border-radius: 2px;
  background: var(--surface-accent); outline: none;
}
.calc-field input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-text); border: 3px solid var(--surface-bg); cursor: pointer;
  box-shadow: 0 0 0 1px var(--surface-hairline-strong);
}
.calc-field input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--surface-bg);
  background: var(--surface-text); cursor: pointer;
}
.calc-field input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--surface-focus); outline-offset: 2px; }
.calc-out { border-left: 1px solid var(--surface-hairline); padding-left: 2.5rem; }
.calc-out-num { font-family: var(--onda-display); font-weight: 600; color: var(--surface-accent-text); font-size: clamp(2.2rem, 4.5vw, 3.4rem); }
.calc-out-row { display: flex; justify-content: space-between; border-top: 1px solid var(--surface-hairline); padding-block: .5rem; font-size: .88rem; color: var(--surface-text-muted); }
@media (max-width: 760px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-out { border-left: none; border-top: 1px solid var(--surface-hairline); padding-left: 0; padding-top: 1.5rem; }
}

/* ---- 6-layer diagnostic quiz (mechanism from the playbook, content is
   Onda's own methodology layers — see quiz.js header) ---- */
.q-grid { display: grid; grid-template-columns: .92fr 1.08fr; gap: 2rem; align-items: start; }
.q-layers { display: flex; flex-direction: column; }
.q-layer {
  display: flex; align-items: center; gap: 1rem;
  padding-block: 1rem; border-bottom: 1px solid var(--surface-hairline);
  opacity: .55; transition: opacity .2s var(--onda-ease), background .2s var(--onda-ease);
}
.q-layer.active { opacity: 1; }
.q-layer-dot {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px dashed var(--surface-hairline-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--onda-mono); font-size: .7rem;
}
.q-layer.yes { opacity: 1; }
.q-layer.yes .q-layer-dot { border-style: solid; border-color: var(--surface-accent); background: var(--surface-accent-wash); color: var(--surface-accent-text); }
.q-layer.no .q-layer-dot { border-style: solid; border-color: var(--surface-hairline-strong); background: var(--surface-bg-sunken); color: var(--surface-text-faint); }
.q-layer-name { font-family: var(--onda-display); }
.q-layer-sub { display: block; font-family: var(--onda-mono); font-size: .72rem; color: var(--surface-text-faint); }

.q-card { background: var(--surface-bg-raised); border: 1px solid var(--surface-hairline); border-radius: var(--onda-radius); padding: 2rem; }
.q-progress { height: 2px; background: var(--surface-hairline); margin-bottom: 1.5rem; }
.q-progress-bar { height: 100%; background: var(--surface-accent); transition: width .3s var(--onda-ease); }
.q-count { font-family: var(--onda-mono); font-size: .78rem; color: var(--surface-text-faint); }
.q-question h3 { margin-top: .75rem; }
.q-actions { display: flex; gap: 1rem; margin-top: 2rem; }
.q-actions button { flex: 1; }

.q-result { text-align: center; }
.q-ring-wrap { position: relative; width: 140px; height: 140px; margin-inline: auto; }
.q-ring-score { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--onda-display); font-size: 1.6rem; font-weight: 600; }
.q-ring-bg { stroke: var(--surface-hairline); fill: none; stroke-width: 6; }
.q-ring-fg { stroke: var(--surface-accent); fill: none; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 194.8; stroke-dashoffset: 194.8; transition: stroke-dashoffset .9s cubic-bezier(.16,1,.3,1); }
.q-stage-meter { display: flex; gap: .35rem; justify-content: center; margin-block: 1.25rem; }
.q-stage-seg { width: 2.25rem; height: 4px; border-radius: 2px; background: var(--surface-hairline); }
.q-stage-seg.filled { background: var(--surface-accent); }
.q-result-block { max-width: 42ch; margin-inline: auto; }
.q-restart { margin-top: 1.5rem; background: none; border: none; font-family: var(--onda-mono); font-size: .8rem; color: var(--surface-text-faint); cursor: pointer; text-decoration: underline; }
@media (max-width: 860px) {
  .q-grid { grid-template-columns: 1fr; }
  .q-layers { display: none; }
}

/* ---- Illustrative example cards (/casos "Tipus de projectes") ----
   Dashed border + a visible badge, deliberately different from
   .case-card's solid border: the visual language itself must mark
   these as NOT a verified real result, not just a caption someone
   can miss. */
.illustrative-card { border-style: dashed; }
.illustrative-badge {
  display: inline-block;
  font-family: var(--onda-mono);
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--surface-text-faint);
  border: 1px dashed var(--surface-hairline-strong);
  border-radius: 999px;
  padding: .25rem .65rem;
}
