/* ---------------------------------------------------------------------------
   Buddyl — warstwa wizualna strony.

   Jedno źródło prawdy to `app/lib/brand.dart`. Nazwy zmiennych poniżej celowo
   powtarzają tamte (leaf700, n500, ground…), żeby zmiana koloru w aplikacji
   dała się przenieść tu szukaniem po nazwie, a nie po wartości hex.
   --------------------------------------------------------------------------- */

/* ------------------------------------------------------------------ fonty */

@font-face {
  font-family: 'Manrope';
  src: url('../fonts/Manrope-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/Manrope-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('../fonts/Manrope-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

/* --------------------------------------------------------------- zmienne */

:root {
  --leaf700: #2E8214;
  --leaf500: #62B33A;
  --leaf300: #9AD97A;
  --leaf100: #F2FAE8;

  --accent: #8A5A34;
  --accent-container: #F6EDE3;
  --on-accent-container: #6E4526;

  --good: #62B33A;
  --attention: #E3A008;
  --problem: #C2354A;

  --primary: var(--leaf700);
  --on-primary: #ffffff;
  --surface: #ffffff;
  --surface-low: #FBFDF8;
  --surface-container: #F3F8EC;
  --surface-high: #E8F0DF;
  --on-surface: #1B2415;
  --on-surface-variant: #6C7A62;
  --outline: #D3E0C8;
  --outline-variant: #E8F0DF;

  --ground-top: #ECF6E0;
  --ground-bottom: #FDFEFA;

  --shadow-card: 0 2px 10px rgba(27, 42, 32, 0.08);
  --shadow-lift: 0 10px 30px rgba(27, 42, 32, 0.12);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-full: 999px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s6: 24px;
  --s8: 32px;
  --s12: 48px;
  --s16: 64px;

  --measure: 68ch;
  --page: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #9AD97A;
    --on-primary: #14300A;
    --accent: #E3BF96;
    --accent-container: #3A2A1C;
    --on-accent-container: #E3BF96;

    --surface: #26301D;
    --surface-low: #1E2618;
    --surface-container: #1E2618;
    --surface-high: #2C3622;
    --on-surface: #F0F5E9;
    --on-surface-variant: #A4B098;
    --outline: #3E4A34;
    --outline-variant: #2E3A26;

    --ground-top: #1A2312;
    --ground-bottom: #0F150A;

    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 10px 30px rgba(0, 0, 0, 0.55);
  }
}

/* ------------------------------------------------------------------ reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Kotwice w regulaminie lądowały pod przyklejonym nagłówkiem. */
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--on-surface);
  background: linear-gradient(
      180deg,
      var(--ground-top) 0%,
      var(--ground-bottom) 70%
    )
    no-repeat;
  background-attachment: fixed;
  background-color: var(--ground-bottom);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--leaf500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ------------------------------------------------------------ typografia */

h1,
h2,
h3,
h4 {
  line-height: 1.22;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s4);
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 5.2vw, 3.25rem);
}

h2 {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  margin-top: var(--s12);
}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: var(--s8);
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--s2);
}

p,
li {
  max-width: var(--measure);
}

p {
  margin: 0 0 var(--s4);
}

ul,
ol {
  padding-left: 1.3em;
  margin: 0 0 var(--s4);
}

li {
  margin-bottom: var(--s2);
}

strong {
  font-weight: 600;
}

small,
.small {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
}

.lead {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--on-surface-variant);
  line-height: 1.55;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--s3);
}

/* ------------------------------------------------------------- szkielet */

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--s6);
}

.wrap--narrow {
  max-width: 820px;
}

section {
  padding: var(--s12) 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: var(--on-primary);
  padding: var(--s3) var(--s4);
  border-radius: 0 0 var(--r-md) 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
}

/* -------------------------------------------------------------- nagłówek */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--ground-top) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--outline-variant);
}

.site-header__inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s3) var(--s6);
  display: flex;
  align-items: center;
  gap: var(--s4);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--on-surface);
  text-decoration: none;
  letter-spacing: -0.02em;
  margin-right: auto;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s1);
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--on-surface-variant);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-full);
}

.site-nav a:hover {
  color: var(--on-surface);
  background: var(--surface-high);
}

.site-nav a[aria-current='page'] {
  color: var(--primary);
  background: var(--surface-high);
}

/* ------------------------------------------------------ przełącznik PL/EN */

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--outline);
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--surface);
}

.lang-switch button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: var(--s2) var(--s3);
  border: 0;
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  line-height: 1;
}

.lang-switch button[aria-pressed='true'] {
  background: var(--primary);
  color: var(--on-primary);
}

/* Bez JS widać polski — i tylko polski. */
[data-lang='pl'] [data-i18n='en'],
[data-lang='en'] [data-i18n='pl'] {
  display: none !important;
}

/* ----------------------------------------------------------------- hero */

.hero {
  padding: var(--s16) 0 var(--s12);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: var(--s12);
  align-items: center;
}

@media (max-width: 860px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--s8);
    text-align: center;
  }
  .hero__grid p,
  .hero__grid li {
    margin-left: auto;
    margin-right: auto;
  }
  .hero__actions {
    justify-content: center;
  }
}

.hero__mascot {
  width: min(340px, 78%);
  margin: 0 auto;
  border-radius: 26%;
  box-shadow: var(--shadow-lift);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s6);
}

/* -------------------------------------------------------------- przyciski */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-weight: 600;
  font-size: 0.95rem;
  padding: var(--s3) var(--s6);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn--ghost {
  background: var(--surface);
  color: var(--on-surface);
  border-color: var(--outline);
}

/* Odznaki sklepów — aktywne linki do opublikowanych aplikacji. */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--on-surface-variant);
  font-size: 0.85rem;
  line-height: 1.25;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.store-badge:hover {
  border-color: var(--primary);
  color: var(--on-surface-variant);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.store-badge strong {
  display: block;
  color: var(--on-surface);
  font-size: 0.95rem;
}

.store-badge svg {
  width: 26px;
  height: 26px;
  flex: none;
  fill: currentColor;
}

/* ----------------------------------------------------------------- karty */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s4);
  margin-top: var(--s8);
}

.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-md);
  padding: var(--s6);
  box-shadow: var(--shadow-card);
}

.card h3 {
  margin-top: 0;
  margin-bottom: var(--s2);
  font-size: 1.05rem;
}

.card p {
  margin-bottom: 0;
  color: var(--on-surface-variant);
  font-size: 0.95rem;
}

.card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--leaf100);
  color: var(--leaf700);
  display: grid;
  place-items: center;
  margin-bottom: var(--s4);
  font-size: 1.35rem;
}

@media (prefers-color-scheme: dark) {
  .card__icon {
    background: #2A4419;
    color: var(--leaf300);
  }
}

/* Wyróżniona karta Buddyla — brąz łodygi, tak jak w aplikacji. */
.card--accent {
  background: var(--accent-container);
  border-color: transparent;
}

.card--accent h3,
.card--accent p {
  color: var(--on-accent-container);
}

/* ---------------------------------------------------------- kroki 1-2-3 */

.steps {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s6);
  margin-top: var(--s8);
  padding: 0;
  list-style: none;
}

.steps li {
  counter-increment: step;
  max-width: none;
  padding-top: var(--s12);
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  width: 38px;
  height: 38px;
  border-radius: var(--r-full);
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.steps h3 {
  margin: 0 0 var(--s2);
  font-size: 1.05rem;
}

.steps p {
  margin: 0;
  color: var(--on-surface-variant);
  font-size: 0.95rem;
}

/* ------------------------------------------------------- skala kondycji */

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s2);
  margin-top: var(--s8);
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-md);
  padding: var(--s6) var(--s4);
  box-shadow: var(--shadow-card);
}

.scale__step {
  text-align: center;
}

.scale__step img {
  height: 76px;
  width: auto;
  margin: 0 auto var(--s2);
}

.scale__step span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--on-surface-variant);
}

@media (max-width: 560px) {
  .scale {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--s1);
    padding: var(--s4) var(--s2);
  }
  .scale__step img {
    height: 48px;
  }
  .scale__step span {
    font-size: 0.65rem;
  }
}

/* ------------------------------------------------------ panel wyróżniony */

.panel {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-lg);
  padding: var(--s8);
  box-shadow: var(--shadow-card);
}

.panel--quiet {
  background: var(--surface-container);
  box-shadow: none;
}

/* Lista „czego nie robimy" — zielone ptaszki zamiast kropek. */
.checklist {
  list-style: none;
  padding: 0;
  margin-top: var(--s4);
}

.checklist li {
  position: relative;
  padding-left: 1.9em;
  max-width: var(--measure);
}

.checklist li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--leaf500);
  font-weight: 700;
}

/* -------------------------------------------------------------- tabele */

.table-scroll {
  overflow-x: auto;
  margin: var(--s4) 0 var(--s6);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-md);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 520px;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--outline-variant);
  vertical-align: top;
}

th {
  font-weight: 600;
  background: var(--surface-container);
  color: var(--on-surface);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* --------------------------------------------------------------- notki */

.note {
  border-left: 4px solid var(--leaf500);
  background: var(--surface-container);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s4) var(--s6);
  margin: var(--s6) 0;
}

.note p:last-child {
  margin-bottom: 0;
}

.note--warn {
  border-left-color: var(--attention);
}

.note--todo {
  border-left-color: var(--problem);
}

/* ------------------------------------------------------------------ FAQ */

details {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-md);
  padding: var(--s4) var(--s6);
  margin-bottom: var(--s3);
  box-shadow: var(--shadow-card);
}

details[open] {
  border-color: var(--outline);
}

summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s4);
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--primary);
  flex: none;
  line-height: 1;
}

details[open] summary::after {
  content: '−';
}

details > *:not(summary) {
  margin-top: var(--s3);
}

details p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------- dokumenty prawne */

.legal {
  padding-top: var(--s8);
}

.legal h2 {
  font-size: 1.35rem;
  padding-top: var(--s4);
  border-top: 1px solid var(--outline-variant);
}

.legal h2:first-of-type {
  border-top: 0;
}

.legal ol > li {
  margin-bottom: var(--s3);
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s6);
  font-size: 0.875rem;
  color: var(--on-surface-variant);
  padding: var(--s3) 0 var(--s6);
  border-bottom: 1px solid var(--outline-variant);
  margin-bottom: var(--s6);
}

/* Spis treści dokumentu. */
.toc {
  background: var(--surface-container);
  border-radius: var(--r-md);
  padding: var(--s6);
  margin-bottom: var(--s8);
}

.toc h2 {
  margin: 0 0 var(--s3);
  font-size: 1rem;
  border: 0;
  padding: 0;
}

.toc ol {
  margin: 0;
  columns: 2;
  column-gap: var(--s8);
  font-size: 0.92rem;
}

@media (max-width: 640px) {
  .toc ol {
    columns: 1;
  }
}

.toc li {
  margin-bottom: var(--s1);
  break-inside: avoid;
}

/* --------------------------------------------------------------- stopka */

.site-footer {
  margin-top: var(--s16);
  border-top: 1px solid var(--outline-variant);
  background: var(--surface-low);
  padding: var(--s12) 0 var(--s8);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--s8);
}

@media (max-width: 760px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: var(--s6);
  }
}

.site-footer h4 {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin-bottom: var(--s3);
}

.site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer li {
  margin-bottom: var(--s2);
}

.site-footer a {
  color: var(--on-surface);
  text-decoration: none;
  font-size: 0.92rem;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.site-footer__legal {
  margin-top: var(--s8);
  padding-top: var(--s6);
  border-top: 1px solid var(--outline-variant);
  font-size: 0.82rem;
  color: var(--on-surface-variant);
}

.site-footer__legal p {
  max-width: none;
}

/* ------------------------------------------------------------- pomocnicze */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.stack > * + * {
  margin-top: var(--s4);
}

.center {
  text-align: center;
}

.center p {
  margin-left: auto;
  margin-right: auto;
}

.mail {
  font-weight: 600;
  font-size: 1.05rem;
}
