/* krituliai.lt — Baltic weather utility look
   Display: Fraunces-like via Georgia/Iowan; UI: Avenir Next / Segoe UI (not Inter/Roboto).
   Palette: deep Baltic teal-blue on cool mist — no purple, no cream/terracotta. */
:root{
  --ink:#15202b;
  --muted:#4a5a6a;
  --line:#c9d5e1;
  --card:#ffffff;
  --bg0:#e8f1f6;
  --bg1:#f3f7fa;
  --blue:#0a5f8c;
  --blue-deep:#074a6e;
  --blue-soft:#d7ebf5;
  --dry:#1a7a3e;
  --dry-bg:#e5f5ea;
  --wet:#b23b1e;
  --wet-bg:#fde8e4;
  --mixed:#806500;
  --mixed-bg:#fff4d6;
  --radius:14px;
  --tap:44px;
  --font-ui:"Avenir Next","Segoe UI","Helvetica Neue",sans-serif;
  --font-display:Iowan Old Style,"Palatino Linotype",Palatino,Georgia,"Times New Roman",serif;
  --shadow:0 1px 0 rgba(7,74,110,.04), 0 8px 24px rgba(7,74,110,.06);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
html,body{max-width:100%;overflow-x:hidden}
body{
  margin:0;
  font:16px/1.5 var(--font-ui);
  color:var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #cfe6f2 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #d9ebe3 0%, transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 28%, var(--bg1));
  min-height:100vh;
}
a{color:var(--blue); text-underline-offset:2px}
a:hover{color:var(--blue-deep)}

/* Header */
header.site{
  position:sticky; top:0; z-index:40;
  display:flex; flex-wrap:wrap; align-items:center; gap:.65rem 1.1rem;
  padding:.7rem 1rem;
  background:rgba(7,74,110,.96);
  color:#fff;
  backdrop-filter:blur(8px);
  border-bottom:1px solid rgba(255,255,255,.08);
}
header.site .logo{
  font-family:var(--font-display);
  font-weight:700; font-size:1.45rem; letter-spacing:.01em;
  color:#fff; text-decoration:none; line-height:1;
  min-height:var(--tap); display:inline-flex; align-items:center;
}
header.site nav{display:flex; flex-wrap:wrap; gap:.15rem .1rem; align-items:center}
header.site nav a{
  color:#d7ebf5; text-decoration:none;
  min-height:var(--tap); min-width:var(--tap);
  padding:.55rem .7rem; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  font-weight:600; font-size:.92rem;
}
header.site nav a:hover{background:rgba(255,255,255,.1); color:#fff}
header.site nav a.active{
  background:#fff; color:var(--blue-deep);
}

main{max-width:1120px; margin:0 auto; padding:1rem 1rem 2.5rem}

/* Hero / tool */
.hero-tool{margin:0 0 1.25rem; padding:.4rem 0 1rem}
.hero-compact{padding-bottom:.4rem}
.brand-kicker{
  font-family:var(--font-display);
  font-size:clamp(1.8rem, 5vw, 2.6rem);
  font-weight:700; margin:0 0 .15rem; color:var(--blue-deep);
  letter-spacing:-.02em; line-height:1.05;
}
.hero-tool h1{
  margin:0 0 .45rem;
  font-family:var(--font-display);
  font-size:clamp(1.55rem, 4.2vw, 2.15rem);
  font-weight:700; letter-spacing:-.02em; color:var(--ink);
}
.lead{color:var(--muted); margin:0 0 1rem; max-width:52rem; font-size:1.02rem}
.lead a{font-weight:600}

/* Date chips */
.picker-label{font-family:var(--font-display); font-size:1.15rem; margin:0 0 .55rem}
.date-chips{
  display:flex; flex-wrap:wrap; gap:.5rem;
  margin:0 0 .85rem;
}
.date-chips--lg .chip{
  min-width:5.2rem; min-height:3.4rem; padding:.55rem .8rem;
}
.chip{
  appearance:none; border:1px solid var(--line); background:var(--card);
  border-radius:12px; cursor:pointer;
  min-height:var(--tap); min-width:4.4rem;
  padding:.45rem .7rem; display:flex; flex-direction:column; align-items:flex-start; justify-content:center;
  gap:.05rem; color:var(--ink); box-shadow:var(--shadow);
  font:inherit; text-align:left; text-decoration:none;
}
a.chip:hover{border-color:var(--blue); background:#f4fafd; color:var(--ink)}
.chip:hover:not(:disabled){border-color:var(--blue); background:#f4fafd}
.chip.is-active{
  border-color:var(--blue-deep); background:var(--blue-deep); color:#fff;
  box-shadow:none;
}
.chip.is-disabled,.chip:disabled{opacity:.42; cursor:not-allowed; box-shadow:none}
.chip-label{font-weight:700; font-size:.95rem; line-height:1.1}
.chip-sub{font-size:.72rem; opacity:.8}
.chip-weekend{border-style:dashed; min-width:8.5rem}
.chip--caution{border-color:#d2b56a}
.chip-caution{margin-left:.2rem; font-weight:800; opacity:.85}
.reliability-note{
  display:flex; flex-wrap:wrap; align-items:center; gap:.45rem .65rem;
  margin:0 0 1rem; padding:.65rem .8rem; border-radius:12px;
  background:var(--mixed-bg); color:var(--mixed); font-size:.9rem;
}
.reliability-note[hidden]{display:none!important}
.badge-caution{background:#fff; color:var(--mixed); border:1px solid #e0c56a}

.tool-controls{
  display:grid; grid-template-columns:repeat(3, minmax(0,1fr));
  gap:.65rem; margin:0 0 .2rem;
}
.field{display:flex; flex-direction:column; gap:.3rem; font-size:.82rem; color:var(--muted); font-weight:600}
.field select, select, button.map-load-btn, .map-load-btn{
  font:inherit; color:var(--ink); font-weight:500;
  min-height:var(--tap); padding:.55rem .7rem;
  border:1px solid var(--line); border-radius:10px; background:var(--card);
  width:100%;
}
button, .card-cta, .map-load-btn{cursor:pointer}

/* Results: chips → top10 carousel → map → list */
.top-carousel-section,.top3-section,.ranking-section,.map-section{margin:0 0 1.5rem}
.section-head{margin:0 0 .7rem}
.section-head h2{margin:0 0 .2rem; font-size:1.25rem; font-family:var(--font-display)}
.top-carousel-head{
  display:flex; align-items:flex-end; justify-content:space-between; gap:.75rem;
}
.top-carousel-nav{display:none; gap:.35rem; flex-shrink:0}
.carousel-btn{
  width:2.4rem; height:2.4rem; border-radius:999px; border:1px solid var(--line);
  background:var(--card); color:var(--ink); font-size:1.35rem; line-height:1;
  display:inline-flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow);
}
.carousel-btn:hover:not(:disabled){background:var(--blue-soft); border-color:var(--blue)}
.carousel-btn:disabled{opacity:.35; cursor:default; visibility:hidden}
.top-carousel-track{
  --carousel-gap:.75rem;
  display:flex; gap:var(--carousel-gap);
  overflow-x:auto; overflow-y:hidden;
  scroll-snap-type:x mandatory;
  scroll-padding-inline:0;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
  padding:0 0 .55rem;
  min-height:9.5rem; /* CLS reserve for pre-rendered hero cards */
  max-width:100%;
  /* thin visible scrollbar */
  scrollbar-width:thin;
  scrollbar-color:rgba(7,74,110,.45) rgba(7,74,110,.08);
}
.top-carousel-track::-webkit-scrollbar{height:6px}
.top-carousel-track::-webkit-scrollbar-track{background:rgba(7,74,110,.08); border-radius:999px}
.top-carousel-track::-webkit-scrollbar-thumb{background:rgba(7,74,110,.4); border-radius:999px}
.top-carousel-track > .result-card{
  /* ~1.2 cards visible on narrow viewports */
  flex:0 0 calc((100% - var(--carousel-gap) * 0.2) / 1.2);
  max-width:calc((100% - var(--carousel-gap) * 0.2) / 1.2);
  scroll-snap-align:start;
  scroll-snap-stop:normal;
  box-sizing:border-box;
  min-width:0;
}
@media(min-width:900px){
  .top-carousel-nav{display:inline-flex}
  .top-carousel-track > .result-card{
    /* ~3.5 cards visible on desktop */
    flex:0 0 calc((100% - var(--carousel-gap) * 2.5) / 3.5);
    max-width:calc((100% - var(--carousel-gap) * 2.5) / 3.5);
  }
}
.top3-grid{display:none} /* legacy */
.result-list{
  display:flex; flex-direction:column; gap:.65rem;
  min-height:200px; /* CLS guard while JS hydrates */
}
.result-card{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:.85rem 1rem .85rem .9rem; box-shadow:var(--shadow);
  border-left:5px solid var(--bar, var(--blue));
  cursor:pointer; transition:transform .15s ease, box-shadow .15s ease;
}
.result-card--hero{
  padding:1.1rem 1.15rem;
  min-height:8.5rem;
}
.result-card--hero .place-link{font-size:1.15rem}
.result-card--hero .result-icon{font-size:1.55rem}
.result-card--hero .result-rank{font-size:1.05rem}
.result-card:hover{transform:translateY(-1px); box-shadow:0 10px 28px rgba(7,74,110,.1)}
.map-section #map-wrap{max-width:100%; margin-top:.35rem}
.map-col{display:none} /* legacy */
.result-top{display:flex; align-items:center; gap:.55rem; flex-wrap:wrap}
.result-rank{
  font-weight:800; color:var(--muted); font-size:.85rem; min-width:1.4rem;
}
.result-icon{font-size:1.35rem; line-height:1}
.result-title{flex:1 1 auto; min-width:0; display:flex; flex-wrap:wrap; align-items:center; gap:.35rem}
.place-link{font-weight:750; font-size:1.05rem; color:var(--ink); text-decoration:none}
a.place-link{color:var(--blue-deep)}
a.place-link:hover{text-decoration:underline}
.result-metrics{
  display:flex; flex-wrap:wrap; gap:.25rem .85rem;
  margin:.55rem 0 0; color:var(--muted); font-size:.86rem;
}
.result-metrics strong{color:var(--ink); font-weight:700}
.card-cta{
  display:inline-flex; align-items:center; justify-content:center;
  margin-top:.65rem; min-height:var(--tap); padding:0 .9rem;
  border-radius:999px; background:var(--blue-soft); color:var(--blue-deep);
  font-weight:700; text-decoration:none; font-size:.9rem;
}
.card-cta:hover{background:#c5e3f2}
.badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-height:1.7rem; padding:.2rem .55rem; border-radius:999px;
  font-size:.75rem; font-weight:800; letter-spacing:.02em; text-transform:uppercase;
}
.badge-dry{background:var(--dry-bg); color:var(--dry)}
.badge-wet{background:var(--wet-bg); color:var(--wet)}
.badge-mixed{background:var(--mixed-bg); color:var(--mixed)}
.pill{
  display:inline-block; padding:.15rem .45rem; border-radius:999px;
  background:#eef3f7; font-size:.72rem; color:var(--muted); font-weight:600;
}
.pill.reklama{background:#1b2430; color:#fff; font-weight:700; letter-spacing:.02em}
.footnote,.empty{color:var(--muted)}
.related-block{margin:1.6rem 0 0; padding-top:1rem; border-top:1px solid var(--line)}
.related-block h2{font-family:var(--font-display); font-size:1.15rem; margin:0 0 .35rem}

/* Map — fixed-size slot (CLS≈0); MapLibre injected on near-viewport */
.map-slot,#map-wrap{
  aspect-ratio:16/9; min-height:260px; max-height:480px; width:100%; max-width:100%;
  contain:layout style; position:relative; z-index:1;
}
#map,#map-wrap{width:100%; max-width:100%}
#map{
  height:100%; min-height:260px; border-radius:var(--radius); border:1px solid var(--line);
  position:relative; background:linear-gradient(160deg,#d9e8f2,#eef5f8);
  overflow:hidden;
}
.map-section .maplibregl-ctrl-attrib{
  max-width:min(100%, 22rem); background:rgba(255,255,255,.88);
  font-size:10px; line-height:1.25; margin:0; border-radius:6px 0 0;
}
.map-section{margin-bottom:1.75rem}
#map.map-lazy{
  display:flex; align-items:center; justify-content:center;
  background:
    linear-gradient(110deg, transparent 40%, rgba(255,255,255,.45) 50%, transparent 60%),
    linear-gradient(160deg,#d9e8f2,#eef5f8);
  background-size:200% 100%, auto;
}
#map.is-loading::after{
  content:"Kraunamas žemėlapis…";
  font-size:.88rem; font-weight:600; color:var(--muted);
}
#map.map-error{background:#f4f7fa}
.map-fallback{margin:0; padding:1rem; text-align:center}
.legend{margin-top:.45rem; color:var(--muted)}
.legend span{margin-right:.65rem; white-space:nowrap}
.dot{display:inline-block; width:.75rem; height:.75rem; border-radius:50%; margin-right:.3rem; vertical-align:-1px; border:1px solid rgba(0,0,0,.2)}

/* Shared cards / content */
.card,.stats{
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  padding:.9rem 1rem; box-shadow:var(--shadow);
}
.small{font-size:.82rem; color:var(--muted)}
.breadcrumb a{color:var(--blue)}
h1,h2,h3{font-family:var(--font-display); letter-spacing:-.015em}
h2{font-size:1.2rem}
.ad-slot,.ad-slot[data-placeholder]{display:none}
.verdict-block{font-weight:750; font-size:1.15rem; margin:1rem 0; padding:.75rem .9rem; border-radius:12px}
.verdict-block.wet{background:var(--wet-bg); color:var(--wet)}
.verdict-block.dry{background:var(--dry-bg); color:var(--dry)}
.faq details{margin:.4rem 0; padding:.65rem .8rem; background:var(--card); border:1px solid var(--line); border-radius:12px}
.faq summary{cursor:pointer; font-weight:700; min-height:var(--tap); display:flex; align-items:center}
.season{margin:1.5rem 0}
.related{margin:1rem 0}
.intro-links{margin:0 0 1rem}
.banner{background:var(--mixed-bg); border:1px solid #e6d18a; padding:.55rem .8rem; border-radius:10px; font-size:.88rem; margin:.6rem 0}
.days{display:grid; grid-template-columns:1fr 1fr; gap:1rem}
.day h3{margin:.1rem 0 .3rem}
.verdict{font-weight:750; font-size:1.05rem; margin:.3rem 0}
.verdict.wet{color:var(--wet)} .verdict.dry{color:var(--dry)}
.steps{display:flex; gap:.4rem; overflow-x:auto; padding:.3rem 0}
.step{min-width:66px; text-align:center; background:#f3f7fa; border-radius:10px; padding:.35rem; font-size:.8rem}
.step b{display:block; font-size:1rem}
.venues{display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:.8rem}
.venue{min-height:4rem}
.venue h3,.venue h4{margin:0 0 .2rem; font-size:1.05rem}
.venue .type{font-size:.75rem; text-transform:uppercase; letter-spacing:.04em; color:var(--muted)}
.aff{font-size:.72rem; color:#8a6d00}
.towns-panel{margin:.5rem 0 1rem}
.towns-panel > summary{
  cursor:pointer; font-weight:700; font-size:1.15rem; font-family:var(--font-display);
  list-style:none; min-height:var(--tap); display:flex; align-items:center;
}
.towns-panel > summary::-webkit-details-marker{display:none}
.towns{columns:2; list-style:none; padding:0; margin:.45rem 0 0}
.towns li{padding:.35rem 0; break-inside:avoid}
@media(min-width:641px){
  .towns{columns:3}
}
.maplibregl-popup-content{font-size:.88rem; line-height:1.35}
.maplibregl-ctrl-attrib{font-size:10px}
.aff-disclosure{font-size:.78rem; color:var(--muted); margin:.35rem 0 .25rem; line-height:1.35}
.venue-sponsored{border-color:#1b2430; box-shadow:inset 3px 0 0 #1b2430}
.legal section{margin:1.4rem 0}
.legal h2{font-size:1.15rem; margin:0 0 .4rem}
.legal ul{padding-left:1.2rem}

/* Ranking tables (region pages) */
table.rank{width:100%; border-collapse:collapse; font-size:.92rem}
table.rank th,table.rank td{padding:.45rem .4rem; border-bottom:1px solid var(--line); text-align:left; vertical-align:top}
table.rank th{font-size:.78rem; color:var(--muted); font-weight:700}
table.rank tr:hover{background:#f0f7fb; cursor:pointer}

/* Watering */
.watering .verdict-block{font-size:1.45rem; text-align:center; padding:1rem}
.watering .verdict-block.laistyti{background:var(--dry-bg); color:var(--dry)}
.watering .verdict-block.palaukti{background:var(--mixed-bg); color:var(--mixed)}
.watering .verdict-block.nelaistyti_lietus,
.watering .verdict-block.nelaistyti_salna{background:var(--wet-bg); color:var(--wet)}
.watering .verdict-block.ne_sezonas{background:#eef2f8; color:var(--muted)}
.water-stats{list-style:none; padding:0; margin:.4rem 0}
.water-stats li{padding:.35rem 0; border-bottom:1px solid var(--line)}
.rain-chart{width:100%; max-width:720px; height:140px; display:block}
.rain-chart .bar{fill:var(--blue)} .rain-chart .bar.wet{fill:var(--dry)}
.water-note{margin:.5rem 0; padding:.55rem .75rem; border-radius:10px; background:#eef2f8; font-size:.9rem}
#garden-aff[hidden]{display:none!important}
#garden-aff{margin:1rem 0; padding:.85rem; border:1px dashed var(--line); border-radius:12px}

/* Footer */
.site-footer{
  max-width:1120px; margin:0 auto; padding:1.5rem 1rem 2.5rem;
  color:var(--muted); font-size:.82rem;
  border-top:1px solid var(--line);
}
.footer-nav{
  display:flex; flex-wrap:wrap; gap:.35rem .15rem; margin:0 0 1rem;
}
.footer-nav a{
  color:var(--blue); text-decoration:none; font-weight:600;
  min-height:var(--tap); padding:.55rem .65rem; display:inline-flex; align-items:center;
  border-radius:999px;
}
.footer-nav a:hover{background:rgba(10,95,140,.08)}
.credits{margin:.35rem 0; max-width:70rem; line-height:1.45}
footer a[data-cc]{background:none; border:0; padding:0; font:inherit; color:var(--blue); cursor:pointer; text-decoration:underline}

/* Mobile */
@media(max-width:900px){
  .tool-controls{grid-template-columns:1fr}
  .days{grid-template-columns:1fr}
  .map-slot,#map-wrap{
    aspect-ratio:auto; height:360px; min-height:360px; max-height:360px;
  }
  #map{height:360px; min-height:360px}
  .top-carousel-section{max-width:100%; overflow:hidden}
}
@media(max-width:640px){
  main{padding:.85rem .85rem 3.5rem} /* room above cookie / credits chrome */
  .brand-kicker{font-size:1.7rem}
  .towns-panel{margin:.4rem 0 1rem}
  .towns-panel > summary{
    cursor:pointer; font-weight:700; list-style:none;
    min-height:var(--tap); display:flex; align-items:center;
    padding:.35rem 0; color:var(--blue-deep);
  }
  .towns-panel > summary::-webkit-details-marker{display:none}
  .towns-panel > summary::before{content:"▸ ";}
  .towns-panel[open] > summary::before{content:"▾ ";}
  .towns{
    columns:2; column-gap:1rem; margin:.5rem 0 0; padding:0; list-style:none;
  }
  .towns li{break-inside:avoid; margin:0 0 .35rem; padding:0}
  .towns a{display:inline-block; padding:.2rem 0; min-height:auto}
  .map-section{margin-bottom:2rem}
  .site-footer .credits{position:relative; z-index:0}
  header.site{padding:.55rem .75rem}
  header.site nav a{padding:.5rem .6rem; font-size:.88rem}
  table.rank{display:block; width:100%; max-width:100%; min-width:0; table-layout:fixed}
  table.rank thead{display:none}
  table.rank tbody{display:block; width:100%}
  table.rank tr{
    display:flex; flex-wrap:wrap; align-items:baseline; gap:.2rem .45rem;
    margin:0 0 .65rem; padding:.7rem .8rem; background:var(--card);
    border:1px solid var(--line); border-radius:var(--radius); max-width:100%;
    box-shadow:var(--shadow);
  }
  table.rank td{border:0; padding:0; min-width:0}
  table.rank td:nth-child(1){display:none}
  table.rank td:nth-child(2){flex:1 1 auto; font-size:1.02rem; overflow-wrap:anywhere}
  table.rank td:nth-child(3){flex:0 0 auto; font-weight:700}
  table.rank td:nth-child(n+4){flex:0 1 auto; font-size:.78rem; color:var(--muted)}
  table.rank td:nth-child(4)::before{content:"Krituliai "; font-weight:600}
  table.rank td:nth-child(5)::before{content:"Debes. "}
  table.rank td:nth-child(6)::before{content:"Temp. "}
  table.rank td:nth-child(7)::before{content:" "}
  table.rank td:nth-child(n+4):not(:last-child)::after{content:" · "}
  .cm--box,.cm--wide{
    max-width:calc(100vw - 1.2rem)!important; width:auto!important;
    left:50%!important; right:auto!important; transform:translateX(-50%)!important;
    box-sizing:border-box;
  }
}
@media(prefers-reduced-motion:reduce){
  .result-card{transition:none}
  html{scroll-behavior:auto}
}
