:root,
html[data-theme="dark"] {
  --bg: #0b0d11;
  --bg-2: #0d1016;
  --blue: #2f6db8;
  --blue-bright: #4a8fd4;
  --silver: #d5dae2;
  --heading: #eef2f7;
  --muted: #8b93a1;
  --line: rgba(213, 218, 226, 0.12);
  --surface: rgba(18, 22, 30, 0.95);
  --bar: rgba(11, 13, 17, 0.92);
  --overlay: linear-gradient(180deg, rgba(11,13,17,0.45), rgba(11,13,17,0.9));
  --hero-overlay: linear-gradient(180deg, rgba(11,13,17,0.35), rgba(11,13,17,0.88));
  --body-wash: radial-gradient(ellipse 90% 50% at 50% -10%, rgba(47, 109, 184, 0.22), transparent 55%),
    linear-gradient(180deg, #090b0f 0%, #0d1016 50%, #0b0d11 100%);
  --glow: rgba(47, 109, 184, 0.28);
  --grain-opacity: 0.25;
  --input: rgba(18, 22, 30, 0.95);
  --slot-selected: rgba(47, 109, 184, 0.2);
  --wa-text: #b6f5cb;
  --font: "Outfit", system-ui, sans-serif;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f3f5f8;
  --bg-2: #ffffff;
  --blue: #2f6db8;
  --blue-bright: #1f5aa0;
  --silver: #1c2430;
  --heading: #121820;
  --muted: #5b6573;
  --line: rgba(18, 28, 42, 0.12);
  --surface: #ffffff;
  --bar: rgba(255, 255, 255, 0.94);
  --overlay: linear-gradient(180deg, rgba(243,245,248,0.55), rgba(243,245,248,0.92));
  --hero-overlay: linear-gradient(180deg, rgba(243,245,248,0.35), rgba(243,245,248,0.88));
  --body-wash: radial-gradient(ellipse 90% 50% at 50% -10%, rgba(47, 109, 184, 0.12), transparent 55%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 50%, #f3f5f8 100%);
  --glow: rgba(47, 109, 184, 0.16);
  --grain-opacity: 0.08;
  --input: #ffffff;
  --slot-selected: rgba(47, 109, 184, 0.16);
  --wa-text: #0d6b32;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--silver);
  line-height: 1.5;
  background-image: var(--body-wash);
  -webkit-tap-highlight-color: transparent;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

html[data-theme="light"] .grain {
  mix-blend-mode: multiply;
}

.app {
  height: 100dvh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "head"
    "main"
    "nav";
}

.topbar {
  display: contents;
}

.topbar-main {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem clamp(0.75rem, 2vw, 1.5rem);
  padding-top: max(0.55rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--bar);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.topbar-brand img { width: 2.7rem; }

.tabs {
  grid-area: nav;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  border-top: 1px solid var(--line);
  background: var(--bar);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs button {
  flex: 1 1 0;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0.65rem 0.2rem;
  min-height: 3rem;
  cursor: pointer;
  font-size: clamp(0.62rem, 2.8vw, 0.78rem);
  font-weight: 500;
  white-space: nowrap;
  border-top: 2px solid transparent;
}

.tabs button[aria-selected="true"] {
  color: var(--heading);
  border-top-color: var(--blue-bright);
}

.topbar-actions {
  display: flex;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.theme-toggle {
  min-width: 3.4rem;
  font-weight: 500;
}

.theme-when-light { display: none; }
html[data-theme="light"] .theme-when-dark { display: none; }
html[data-theme="light"] .theme-when-light { display: inline; }

.topbar-actions .btn {
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  min-height: 2.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  transition: background 0.2s, border-color 0.2s;
}

.btn-lg { padding: 0.85rem 1.2rem; font-size: 0.98rem; min-height: 2.85rem; }

.btn-primary {
  background: linear-gradient(135deg, var(--blue), #245a9a);
  color: #f2f6fc;
  border-color: rgba(74, 143, 212, 0.35);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--silver);
}

.btn-whatsapp {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.45);
  color: var(--wa-text);
}

.panels {
  grid-area: main;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.panel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  display: grid;
  grid-template: 1fr / 1fr;
}

.panel-bg {
  grid-area: 1 / 1;
  position: relative;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.35s ease;
}

.panel.has-panel-bg .panel-bg {
  opacity: 0.22;
}

.panel.has-panel-bg .panel-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.panel-scroll {
  grid-area: 1 / 1;
  z-index: 1;
  overflow: auto;
  height: 100%;
  padding: clamp(1rem, 3vw, 2rem);
}

.panel > .hero,
.panel > .panel-inner {
  grid-area: 1 / 1;
  z-index: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  padding: clamp(0.85rem, 3vw, 2rem);
  box-sizing: border-box;
}

.panel.is-active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.panel[hidden] { display: grid !important; }

.panel-inner {
  width: min(100%, 70rem);
  margin: 0 auto;
  padding-bottom: 2rem;
}

.panel-inner-narrow { width: min(100%, 36rem); }

.panel-head { margin-bottom: 1.5rem; }
.panel-head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--heading);
  font-weight: 600;
}
.panel-head p { margin-top: 0.4rem; color: var(--muted); font-weight: 300; }

.hero {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 1rem;
  position: relative;
  padding: 0.75rem 0 1.25rem;
}

.hero-banner {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

body.has-banner .hero-banner {
  opacity: 0.28;
}

body.has-banner .hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-overlay);
}

.hero-glow {
  position: absolute;
  width: min(40rem, 110vw);
  height: min(40rem, 110vw);
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 68%);
  filter: blur(8px);
  animation: drift 10s ease-in-out infinite alternate;
  pointer-events: none;
}

.hero-logo {
  position: relative;
  width: min(100%, 18rem);
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

html[data-theme="light"] .hero-logo {
  filter: drop-shadow(0 12px 24px rgba(18, 28, 42, 0.16));
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-lead {
  position: relative;
  color: var(--muted);
  font-weight: 300;
  max-width: 28rem;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.hero-cta {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 22rem);
  gap: 0.55rem;
  animation: rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
}

.hero-cta .btn {
  width: 100%;
}

.service-list {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
}

.service-list li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.service-list h3 { font-size: 1rem; color: var(--heading); margin-bottom: 0.25rem; }
.service-list p { color: var(--muted); font-weight: 300; font-size: 0.92rem; }

.brand-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.brand {
  background: var(--surface);
  min-height: 4.5rem;
  display: grid;
  place-items: center;
  gap: 0.45rem;
  padding: 1rem;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.brand.has-logo img {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: contain;
}

.map-embed {
  margin-top: 0.85rem;
  border: 1px solid var(--line);
  overflow: hidden;
  min-height: 12rem;
}

.map-embed iframe {
  display: block;
  width: 100%;
  min-height: 12rem;
  border: 0;
}

.brands-note { margin-top: 1rem; color: var(--muted); font-size: 0.9rem; font-weight: 300; }

.appt-form, .contact-form {
  display: grid;
  gap: 0.9rem;
}

.appt-form label, .contact-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.appt-form input,
.appt-form textarea,
.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: var(--input);
  border: 1px solid var(--line);
  outline: none;
  font-size: 16px;
  border-radius: 0;
}

.appt-form input:focus,
.appt-form textarea:focus,
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: rgba(74, 143, 212, 0.55);
}

.appt-form .btn-lg,
.contact-form .btn {
  width: 100%;
  min-height: 2.85rem;
}

.form-row.two {
  display: grid;
  gap: 0.9rem;
}

.slots-field {
  border: 0;
  min-width: 0;
}

.slots-field legend {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.slots {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.slot {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--silver);
  padding: 0.75rem 0.4rem;
  min-height: 3.1rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.9rem;
}

.slot small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.slot.is-selected {
  border-color: var(--blue-bright);
  background: var(--slot-selected);
}

.slot:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.slots-hint, .form-note {
  font-size: 0.88rem;
  color: var(--blue-bright);
  font-weight: 300;
  min-height: 1.25em;
}

.form-note.is-error, .slots-hint.is-error { color: #e08a8a; }

.contact-aside { margin-bottom: 1.25rem; }

.contact-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.contact-link strong {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-bright);
  font-weight: 500;
}

.contact-link span { font-size: 1.1rem; color: var(--heading); }

.muted-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.muted-block h3 {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-bright);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.muted-block p { color: var(--muted); font-weight: 300; font-size: 0.92rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  from { transform: translate(-3%, -2%) scale(1); }
  to { transform: translate(3%, 3%) scale(1.05); }
}

@media (min-width: 720px) {
  .app {
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "head"
      "main";
  }
  .topbar {
    display: flex;
    grid-area: head;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem clamp(0.75rem, 2vw, 1.5rem);
    padding-top: max(0.65rem, env(safe-area-inset-top));
    border-bottom: 1px solid var(--line);
    background: var(--bar);
    backdrop-filter: blur(12px);
    z-index: 20;
  }
  .topbar-main {
    display: contents;
  }
  .topbar-brand img { width: 3.1rem; }
  .tabs {
    grid-area: auto;
    flex: 1;
    order: 2;
    border-top: 0;
    background: transparent;
    padding-bottom: 0;
    gap: 0.15rem;
  }
  .topbar-actions { order: 3; }
  .tabs button {
    flex: 0 0 auto;
    padding: 0.55rem 0.7rem;
    min-height: 0;
    font-size: 0.86rem;
    border-top: 0;
    border-bottom: 2px solid transparent;
  }
  .tabs button[aria-selected="true"] {
    border-top-color: transparent;
    border-bottom-color: var(--blue-bright);
  }
  .topbar-actions .btn {
    padding: 0.55rem 1rem;
    font-size: inherit;
    min-height: 0;
  }
  .hero {
    gap: 1.25rem;
    padding: 1rem 0 2rem;
  }
  .hero-logo { width: min(100%, 26rem); }
  .hero-cta {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
  }
  .hero-cta .btn { width: auto; }
  .service-list { grid-template-columns: 1fr 1fr; column-gap: 2rem; }
  .brand-grid { grid-template-columns: repeat(4, 1fr); }
  .form-row.two { grid-template-columns: 1fr 1fr; }
  .slots { grid-template-columns: repeat(5, 1fr); }
}

@media (min-width: 960px) {
  .service-list { grid-template-columns: 1fr 1fr 1fr; }
  .brand-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
