/* Helyben tárolt betűtípusok (SIL Open Font License, lásd fonts/OFL-*.txt).
   A latin-ext kell az ő és ű betűkhöz. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-500-normal.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; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-ext-500-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-700-normal.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; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/bricolage-grotesque-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-400-normal.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; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-700-normal.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; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2") format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* =========================================================================
   PlantGuard – mobil felület
   Színek: ködös zsályaszürke alap, a talajnedvesség vízkék, a fény napsárga,
   a riasztás téglavörös. Egyetlen hangsúlyos elem: a cserép-nedvességjelző.
   ========================================================================= */
:root {
  --bg: #E6EDE8;
  --surface: #F6F9F7;
  --ink: #17241D;
  --muted: #56665C;
  --line: #CFDAD3;
  --leaf: #2C6A4C;
  --water: #2A78B5;
  --water-soft: #BFD9EC;
  --soil: #8A6A4F;
  --soil-soft: #D9C9B6;
  --sun: #C98A12;
  --alert: #B23E2B;
  --alert-soft: #F3D9D3;
  --warn: #9A6410;
  --warn-soft: #F1E3C6;
  --info-soft: #D6E6F1;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --r-lg: 22px;
  --r-sm: 10px;
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1613;
    --surface: #17201B;
    --ink: #E5EDE8;
    --muted: #95A59B;
    --line: #27342D;
    --leaf: #63BE90;
    --water: #5DA9E2;
    --water-soft: #1E3A51;
    --soil: #B08D6C;
    --soil-soft: #3A2F25;
    --sun: #F0B94A;
    --alert: #F07C64;
    --alert-soft: #3E1F19;
    --warn: #E9B45A;
    --warn-soft: #3A2D17;
    --info-soft: #1C2F3D;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; border-radius: 6px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: env(safe-area-inset-top) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 40px);
}

/* ---------------------------------------------------------------- fejléc */
.topbar { padding: 18px 0 10px; }
.plant { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plant-select {
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2356665C' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 4px center / 12px 8px;
  border: 0;
  padding: 2px 26px 2px 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.02em;
  min-width: 0;
  max-width: 62%;
  text-overflow: ellipsis;
  cursor: pointer;
}
.freshness {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 5px 12px;
  font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.freshness[data-state="live"] .dot { background: var(--leaf); }
.freshness[data-state="stale"] .dot { background: var(--alert); }
.freshness[data-state="loading"] .dot { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.banner {
  margin: 4px 0 12px; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--alert-soft); color: var(--alert); font-size: 15px;
}

/* ---------------------------------------------------------------- hero */
.hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px 20px;
  background: var(--surface);
  border-radius: var(--r-lg);
  margin-top: 6px;
}
.pot { width: 112px; height: auto; display: block; }
.pot-soil { fill: var(--soil-soft); }
.pot-water { fill: var(--water); opacity: .85; }
#pot-water { transition: transform .9s cubic-bezier(.2, .8, .2, 1); }
.pot-water { animation: wave 6s linear infinite; }
@keyframes wave { to { transform: translateX(60px); } }
.pot-outline { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.pot-rim { fill: var(--surface); stroke: var(--ink); stroke-width: 3; }
.pot-threshold { stroke: var(--alert); stroke-width: 2.5; stroke-dasharray: 5 4; }

.hero-text { min-width: 0; }
.hero-figure {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 64px;
  line-height: .95;
  letter-spacing: -0.04em;
  color: var(--water);
  font-variant-numeric: tabular-nums;
}
.hero-figure .unit { font-size: 28px; margin-left: 2px; letter-spacing: 0; }
.hero-caption { margin: 2px 0 12px; color: var(--muted); font-size: 15px; }
.verdict {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.verdict-detail { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.4; }

.hero[data-level="critical"] .verdict { color: var(--alert); }
.hero[data-level="critical"] .hero-figure { color: var(--alert); }
.hero[data-level="warn"] .verdict { color: var(--warn); }
.hero[data-level="offline"] .hero-figure,
.hero[data-level="offline"] .verdict { color: var(--muted); }
.hero[data-level="offline"] .pot-water { opacity: .3; }

/* ---------------------------------------------------------------- listák */
.section-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  margin: 28px 4px 8px;
}

.readings { list-style: none; margin: 0; padding: 0; }
.reading {
  display: grid;
  grid-template-columns: 1fr 88px auto;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
}
.reading:last-child { border-bottom: 0; }
.reading-label { min-width: 0; }
.reading-name { display: block; }
.reading-note { display: block; font-size: 14px; color: var(--muted); }
.reading-note[data-status="low"], .reading-note[data-status="high"] { color: var(--warn); }
.reading-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 82px;
}
.reading-value small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.spark { width: 88px; height: 30px; display: block; overflow: visible; }
.spark path { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark[data-metric="soil"] path { stroke: var(--water); }
.spark[data-metric="temp"] path { stroke: var(--leaf); }
.spark[data-metric="hum"] path { stroke: var(--muted); }
.spark[data-metric="light"] path { stroke: var(--sun); }

.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert {
  padding: 12px 14px 12px 16px;
  border-radius: var(--r-sm);
  border-left: 4px solid currentColor;
  font-size: 15px;
}
.alert[data-level="critical"] { background: var(--alert-soft); color: var(--alert); }
.alert[data-level="warn"] { background: var(--warn-soft); color: var(--warn); }
.alert[data-level="info"] { background: var(--info-soft); color: var(--water); }
.alert span { color: var(--ink); }

.facts {
  margin: 24px 4px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  font-size: 15px;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- előzmények */
.view-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 8px 0 14px;
}
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border-radius: 14px;
  margin-bottom: 10px;
}
.segmented button {
  border: 0;
  background: transparent;
  padding: 9px 4px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  min-height: 40px;
}
.segmented button[aria-checked="true"] { background: var(--ink); color: var(--surface); font-weight: 700; }
.segmented-quiet { background: transparent; padding: 0; }
.segmented-quiet button[aria-checked="true"] { background: var(--surface); color: var(--ink); }

.chart-card {
  margin: 8px 0 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 14px 10px 8px 4px;
}
.chart-readout {
  padding: 0 12px 6px;
  font-size: 15px;
  color: var(--muted);
  min-height: 1.5em;
  font-variant-numeric: tabular-nums;
}
.chart-readout b { color: var(--ink); font-family: var(--font-display); font-size: 20px; }
.chart { height: 240px; touch-action: pan-y; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; }
.chart .area { opacity: .14; }
.chart .band-bad { fill: var(--alert); opacity: .07; }
.chart .band-edge { stroke: var(--alert); stroke-width: 1.25; stroke-dasharray: 4 4; opacity: .6; }
.chart .cursor { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.chart .cursor-dot { stroke: var(--surface); stroke-width: 2.5; }
.chart[data-metric="soil"] { --c: var(--water); }
.chart[data-metric="temp"] { --c: var(--leaf); }
.chart[data-metric="hum"] { --c: var(--muted); }
.chart[data-metric="light"] { --c: var(--sun); }
.chart .line { stroke: var(--c); }
.chart .area, .chart .cursor-dot { fill: var(--c); }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 15px; text-align: center; padding: 0 24px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 0 0;
  text-align: center;
}
.stats div { padding: 4px 0; }
.stats div + div { border-left: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: 14px; }
.stats dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 18px 0 0; }

/* ---------------------------------------------------------------- beállítások */
.settings fieldset {
  border: 0;
  margin: 0 0 14px;
  padding: 4px 16px;
  background: var(--surface);
  border-radius: var(--r-lg);
}
.settings legend {
  float: left;
  width: 100%;
  padding: 12px 0 2px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  clear: both;
}
.field:first-of-type { border-top: 0; }
.field > span:first-child { font-size: 15px; color: var(--muted); }
.field-num { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; }
.num { display: inline-flex; align-items: baseline; gap: 4px; }
.num em { font-style: normal; color: var(--muted); width: 1.6em; }
.settings input {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--r-sm);
  padding: 9px 10px;
  min-height: 44px;
}
.settings input[type="number"] { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.settings input[aria-invalid="true"] { border-color: var(--alert); }
.form-error { color: var(--alert); margin: 4px 4px 12px; font-size: 15px; }
.primary {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  background: var(--leaf);
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
}
.primary:disabled { opacity: .6; }
.source-info { margin-top: 28px; }

/* ---------------------------------------------------------------- alsó menü */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  min-height: 52px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-radius: 12px;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab[aria-current="page"] svg { stroke: var(--leaf); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
}

@media (min-width: 600px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 560px; border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .pot-water, .freshness[data-state="loading"] .dot { animation: none; }
  #pot-water { transition: none; }
}
