/* SolarCalc shared styles: tokens, base, buttons, nav, theme switch, form controls, footer.
   Used by index.html and simulador.html. Page-specific styles stay inline in each page. */

/* Atkinson Hyperlegible Next, self-hosted (SIL Open Font License, fonts/OFL.txt). Latin subset covers pt-PT. */
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('fonts/atkinson-hyperlegible-next-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Lenis recommended styles (lenis@1.3.26, MIT), inlined to save a render-blocking request */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent], .lenis [data-lenis-prevent-wheel], .lenis [data-lenis-prevent-touch], .lenis [data-lenis-prevent-vertical], .lenis [data-lenis-prevent-horizontal] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }
.lenis.lenis-autoToggle { transition-property: overflow; transition-duration: 1ms; transition-behavior: allow-discrete; }

/* Tokens. Light is the base, dark follows the system or the manual choice. */
:root {
  color-scheme: light;
  --bg: #fafafa;
  --s1: #ffffff;
  --s2: #f4f4f5;
  --s3: #e4e4e7;
  --text: #18181b;
  --sec: #52525b;
  --muted: #6b6b74;
  --line: rgba(24, 24, 27, .09);
  --line-strong: rgba(24, 24, 27, .16);
  --accent: #9a5b14;
  --accent-fill: #e9a446;
  --accent-soft: rgba(233, 164, 70, .14);
  --ink: #18181b;
  --on-ink: #fafafa;
  --shadow: 0 1px 2px rgba(24, 24, 27, .05);
  --lh: 1.6;

  --sans: 'Atkinson Hyperlegible Next', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  /* Shape rule: interactive = pill, containers = 16px, inner blocks = 10px */
  --r-box: 16px;
  --r-inner: 10px;
  --nav-h: 64px;
  --section-y: clamp(5rem, 11vw, 8.5rem);
  /* z-index scale */
  --z-nav: 50;
  --z-skip: 70;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0b0c;
    --s1: #111113;
    --s2: #18181b;
    --s3: #27272a;
    --text: #f4f4f5;
    --sec: #a1a1aa;
    --muted: #8a8a93;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .15);
    --accent: #e9a446;
    --accent-soft: rgba(233, 164, 70, .10);
    --ink: #f4f4f5;
    --on-ink: #111113;
    --shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
    --lh: 1.68;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0b0c;
  --s1: #111113;
  --s2: #18181b;
  --s3: #27272a;
  --text: #f4f4f5;
  --sec: #a1a1aa;
  --muted: #8a8a93;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .15);
  --accent: #e9a446;
  --accent-soft: rgba(233, 164, 70, .10);
  --ink: #f4f4f5;
  --on-ink: #111113;
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  --lh: 1.68;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s, color .3s;
}
main { overflow-x: clip; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a, button, input { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
/* Phosphor icons as an inline SVG sprite (<use href="#i-name">), sized like the old icon font */
.ph { display: inline-block; width: 1em; height: 1em; font-size: 1.25em; fill: currentColor; flex-shrink: 0; vertical-align: -.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }

.skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: var(--z-skip);
  padding: .6rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .2s var(--ease);
}
.skip:focus { transform: none; }

.wrap { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  text-decoration: none;
  transition: transform .25s var(--ease), background-color .2s, border-color .2s, color .2s;
}
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--ink) 86%, var(--accent-fill)); }
.btn-primary .ph { transition: transform .25s var(--ease); }
.btn-primary:hover .ph { transform: translateX(2px); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--s2); }
.btn-soon { border: 1px dashed var(--line-strong); color: var(--muted); cursor: not-allowed; }
.btn-soon:active { transform: none; }

/* Nav */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-nav);
  height: var(--nav-h);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 650; font-size: 1rem; letter-spacing: -.03em; text-decoration: none; }
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  background: radial-gradient(circle at 32% 30%, #fde3b0, var(--accent-fill) 55%, #c9781f);
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .18);
}
.nav-links { display: flex; align-items: center; gap: .25rem; list-style: none; }
.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  white-space: nowrap;
  padding: 0 .8rem;
  border-radius: 999px;
  color: var(--sec);
  font-size: .88rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.nav-links a:hover { color: var(--text); background: var(--s2); }
.nav-links a[aria-current="true"], .nav-links a[aria-current="page"] { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: .6rem; }
.theme { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--s1); }
.theme button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: var(--muted);
  transition: color .2s, background-color .2s;
}
.theme button .ph { font-size: 1rem; }
.theme button:hover { color: var(--text); }
.theme button[aria-pressed="true"] { background: var(--s2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* Range inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin-top: .5rem;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--s3) var(--fill, 50%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--s1);
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: transform .2s var(--ease);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; background: var(--s3); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--s1); border: 2px solid var(--accent); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent); }
input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-soft), 0 0 0 6px var(--accent); }

/* Footer */
.footer { border-top: 1px solid var(--line); padding-block: 3.5rem 2rem; }
.footer-top { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2.5rem; }
.footer-brand p { max-width: 32ch; margin-top: .9rem; color: var(--muted); font-size: .9rem; }
.footer h2 { color: var(--text); font-size: .88rem; font-weight: 600; }
.footer ul { list-style: none; display: grid; gap: .55rem; margin-top: .9rem; }
.footer ul a { color: var(--sec); font-size: .9rem; text-decoration: none; transition: color .2s; }
.footer ul a:hover { color: var(--text); }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* Shared responsive rules */
@media (max-width: 1023px) {
  .nav-links { display: none; }
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 767px) {
  .footer-top { grid-template-columns: 1fr; }
}
@media (max-width: 479px) {
  .nav-cta { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
