/* ================= Iklim sayfasi (/iklim, /iklim/<il>; public/js/iklim.js) ================= */
:root { --ik-land: #262b33; --ik-dry: #ea580c; --ik-wet: #3b82f6; }
:root[data-theme="light"] { --ik-land: #e5e7eb; }

.ik-h1 { margin: 12px 0 8px; font-size: clamp(1.7rem, 3.6vw, 2.6rem); line-height: 1.15; }
.ik-lead { max-width: 680px; }
.ik-pick { margin-top: 16px; max-width: 280px; }
.ik-pick select { width: 100%; }
.ik-stats { margin-top: 22px; }
.ik-stats dt { font-size: 1.35rem; }

/* segment dugmeleri */
.ik-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); }
.ik-seg:empty { display: none; }
.ik-seg button { border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 0.82rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.ik-seg button[aria-selected="true"] { background: var(--surface); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.ik-main .dash-head { flex-wrap: wrap; gap: 10px; }

/* isinma seridi */
.ik-stripes svg { display: block; width: 100%; height: 120px; border-radius: 10px; }
.ik-stripe-axis { position: relative; height: 22px; margin-top: 6px; font-size: 0.78rem; color: var(--text-muted); }
.ik-stripe-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.ik-stripe-axis span:first-child { transform: none; }
.ik-stripe-axis span:last-child { transform: translateX(-100%); }

/* degisen gunler */
.ik-days-def { margin: 12px 0 4px; }
.ik-bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding-top: 22px; }
.ik-bar { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.ik-bar span { width: 100%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--accent) 70%, transparent); }
.ik-bar b { font-size: 0.78rem; }
.ik-bar small { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
.ik-bar.is-fut span { background: repeating-linear-gradient(135deg, #ef4444 0 5px, color-mix(in srgb, #ef4444 45%, transparent) 5px 10px); }
.ik-bar.is-fut small { color: #ef4444; font-weight: 700; }

/* kuraklik */
.ik-dchips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ik-dchip { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 50%, var(--border)); background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
.ik-dchip small { color: var(--text-muted); font-size: 0.74rem; }
.ik-dchip b { font-size: 0.95rem; }
.ik-dchip span { color: var(--text-secondary); font-size: 0.74rem; }
.ik-facts { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ik-facts li { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.45; padding-left: 12px; border-left: 2px solid var(--border-strong); }
.ik-facts b { color: var(--text-primary); }
.ik-muted { color: var(--text-muted); font-size: 0.84em; }
.ik-wb { display: flex; gap: 2px; height: 110px; background: linear-gradient(var(--border-strong), var(--border-strong)) center / 100% 1px no-repeat; }
.ik-wb i { flex: 1; min-width: 2px; position: relative; }
.ik-wb span { position: absolute; left: 0; right: 0; border-radius: 2px; }
.ik-wb span.dry { top: 50%; background: var(--ik-dry); }
.ik-wb span.wet { bottom: 50%; background: var(--ik-wet); }
.ik-wb-axis { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--text-muted); margin-top: 4px; }

/* gelecek */
.ik-futs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ik-fut { padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-2); }
.ik-fut h3 { margin: 0 0 8px; font-size: 1rem; }
.ik-fut-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ik-fut-big b { font-size: 2rem; letter-spacing: -0.02em; color: #ef4444; }
.ik-fut-big > span { color: var(--text-secondary); font-size: 0.84rem; }
.ik-analog { margin: 0; font-size: 0.9rem; }
.ik-analog a { font-weight: 700; }

/* bugun normal mi */
.ik-today h2 { margin: 8px 0 6px; font-size: 1.25rem; }
.ik-today h2 b { color: var(--text-primary); }
.ik-today p { margin: 0; color: var(--text-secondary); line-height: 1.5; }
.ik-hot { color: #ef4444; }
.ik-cold { color: #3b82f6; }
.ik-range { position: relative; height: 14px; margin: 18px 0 6px; border-radius: 999px; background: linear-gradient(90deg, #3b82f6, #94a3b8 50%, #ef4444); opacity: 0.85; }
.ik-range-band { position: absolute; top: -3px; bottom: -3px; border-radius: 999px; border: 2px solid var(--text-primary); opacity: 0.55; }
.ik-range-mid { position: absolute; top: -5px; width: 2px; height: 24px; background: var(--text-primary); }
.ik-range-now { position: absolute; top: -6px; width: 14px; height: 26px; margin-left: -7px; border-radius: 6px; background: var(--surface); border: 3px solid var(--text-primary); }
.ik-range-axis { display: flex; justify-content: space-between; gap: 8px; font-size: 0.74rem; color: var(--text-muted); }

/* Turkiye haritasi */
.ik-map svg { display: block; width: 100%; height: auto; }
.ik-map path { stroke: var(--surface); stroke-width: 1.2; transition: opacity 0.15s ease; }
.ik-map a:hover path { opacity: 0.75; }
.ik-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; font-size: 0.78rem; color: var(--text-secondary); }
.ik-legend > i { display: inline-block; width: 160px; height: 10px; border-radius: 999px; }
.ik-lg { display: inline-flex; align-items: center; gap: 5px; }
.ik-lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ik-rank ol { margin: 14px 0 0; padding: 0; list-style: none; columns: 2; column-gap: 24px; counter-reset: r; }
.ik-rank li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 0.88rem; break-inside: avoid; counter-increment: r; }
.ik-rank li a::before { content: counter(r) ". "; color: var(--text-muted); }
.ik-rank li span { color: var(--text-secondary); }
.ik-note { line-height: 1.5; }

@media (max-width: 760px) {
  .ik-futs { grid-template-columns: 1fr; }
  .ik-rank ol { columns: 1; }
  .ik-stats { display: grid; grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .ik-stats > div:nth-child(3) { border-left: none; padding-left: 0; }
  .ik-stripes svg { height: 90px; }
  .ik-bar small { font-size: 0.62rem; }
}

/* ---------- grafikler ve animasyonlar ---------- */
.ik-year { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }
.ik-year small { display: block; font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); }
/* serit ve iklim halisi soldan saga acilir */
.ik-stripes svg, .ik-carpet-g svg { clip-path: inset(0 100% 0 0); transition: clip-path 2.6s cubic-bezier(.4, 0, .2, 1); }
.ik-stripes.ik-go svg, .ik-carpet.ik-go .ik-carpet-g svg { clip-path: inset(0 0 0 0); }

/* cizgi grafikler (svg) */
.ik-chart { position: relative; }
.ik-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.ik-grid { stroke: var(--border); stroke-width: 1; }
.ik-zero { stroke: var(--border-strong); stroke-width: 1.2; stroke-dasharray: 3 3; }
.ik-ax { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.ik-ax-p { fill: #60a5fa; }
.ik-lbl { font-size: 13px; font-weight: 800; font-family: inherit; }
.ik-now { stroke: var(--text-muted); stroke-dasharray: 4 4; }
.ik-dots circle { fill: var(--text-secondary); opacity: 0; transition: opacity 0.4s ease calc(var(--i) * 22ms); }
.ik-go .ik-dots circle { opacity: 0.55; }
.ik-ma { fill: none; stroke: #ef4444; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.ik-fan { opacity: 0; transition: opacity 0.9s ease var(--d); }
.ik-go .ik-fan { opacity: 1; }
.ik-hover-line { stroke: var(--text-primary); stroke-width: 1; opacity: 0.4; pointer-events: none; }
.ik-tip { position: absolute; top: 8px; min-width: 130px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-soft); font-size: 0.84rem; pointer-events: none; }
.ik-tip b { display: block; font-size: 0.8rem; color: var(--text-muted); }
.ik-tip small { display: block; font-size: 0.78rem; color: var(--text-secondary); }
.ik-chart-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 0.78rem; color: var(--text-secondary); }
.ik-chart-key span { display: inline-flex; align-items: center; gap: 6px; }
.ik-chart-key i { display: inline-block; width: 16px; height: 8px; border-radius: 3px; }
.ik-k-dot { width: 7px !important; height: 7px !important; border-radius: 50% !important; background: var(--text-secondary); opacity: 0.6; }
.ik-k-line { height: 3px !important; background: #ef4444; }
.ik-k-line.old { background: var(--text-muted); }
.ik-k-bar { background: #3b82f6; opacity: 0.75; }
.ik-k-bar.old { background: var(--text-muted); opacity: 0.45; }

/* iklim diyagrami */
.ik-tline { fill: none; stroke: #ef4444; stroke-width: 2.8; stroke-linejoin: round; }
.ik-tline.old { stroke: var(--text-muted); stroke-dasharray: 5 4; stroke-width: 2.2; }
.ik-tdot { fill: #ef4444; opacity: 0; transition: opacity 0.4s ease 1.6s; }
.ik-go .ik-tdot { opacity: 1; }
.ik-pbar { fill: #3b82f6; opacity: 0.75; transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform 0.7s cubic-bezier(.3, .8, .3, 1) calc(var(--i) * 45ms); }
.ik-pbar.old { fill: var(--text-muted); opacity: 0.45; }
.ik-go .ik-pbar { transform: scaleY(1); }
.ik-insights { margin-top: 12px; }

/* iklim halisi */
.ik-carpet { display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.ik-carpet-m { display: grid; grid-template-rows: repeat(12, 1fr); font-size: 0.68rem; color: var(--text-muted); height: 216px; }
.ik-carpet-m span { display: flex; align-items: center; }
.ik-carpet-g svg { display: block; width: 100%; height: 216px; border-radius: 8px; }
.ik-carpet-g .ik-stripe-axis span:last-child { transform: translateX(-100%); }

/* degisen gunler: sutunlar asagidan buyur */
.ik-bar span { transform-origin: bottom; transform: scaleY(0); transition: transform 0.8s cubic-bezier(.3, .8, .3, 1) calc(var(--i) * 70ms); }
.ik-bar b { opacity: 0; transition: opacity 0.4s ease calc(var(--i) * 70ms + 0.5s); }
.ik-go .ik-bar span { transform: scaleY(1); }
.ik-go .ik-bar b { opacity: 1; }

/* kuraklik sutunlari */
.ik-wb span { transform: scaleY(0); transition: transform 0.6s ease calc(var(--i) * 35ms); }
.ik-wb span.dry { transform-origin: top; }
.ik-wb span.wet { transform-origin: bottom; }
.ik-wb.ik-go span { transform: scaleY(1); }

/* bugun normal mi: isaret soldan yerine kayar */
.ik-range-now { left: 0; transition: left 1.4s cubic-bezier(.3, .8, .3, 1) 0.2s; }
.ik-today.ik-go .ik-range-now { left: var(--to); }

/* rekorlar */
.ik-recs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.ik-rec { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-top: 3px solid var(--c); }
.ik-rec.hot { --c: #ef4444; } .ik-rec.cold { --c: #3b82f6; } .ik-rec.wet { --c: #14b8a6; }
.ik-rec h3 { margin: 0 0 6px; font-size: 0.86rem; }
.ik-rec ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 5px; }
.ik-rec li { display: flex; flex-direction: column; }
.ik-rec li b { font-size: 0.95rem; color: var(--c); }
.ik-rec li span { font-size: 0.74rem; color: var(--text-muted); }

/* zaman makinesi */
.ik-player { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.ik-player input[type="range"] { flex: 1; min-width: 160px; accent-color: #ef4444; }
.ik-frame { display: flex; flex-direction: column; min-width: 190px; }
.ik-frame b { font-size: 1.05rem; }
.ik-frame span { font-size: 0.8rem; color: var(--text-secondary); }
.ik-map path { transition: fill 0.6s ease; }

/* iklim sarmali */
.ik-spiral svg { display: block; width: 100%; max-width: 440px; margin: 0 auto; height: auto; }
.ik-ring { fill: none; stroke: var(--border); stroke-width: 1; }
.ik-ring.zero { stroke: var(--border-strong); stroke-dasharray: 4 4; }
.ik-spiral-segs path { fill: none; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; opacity: 0; transition: opacity 0.25s ease; }
.ik-spiral-segs path.on { opacity: 0.85; }
.ik-spiral-year { font-size: 30px; font-weight: 800; fill: var(--text-primary); font-family: inherit; font-variant-numeric: tabular-nums; }

/* yaz gunleri dagilimi */
.ik-tail { fill: #ef4444; opacity: 0.07; }
.ik-bell { opacity: 0; transition: opacity 0.8s ease 0.9s; }
.ik-bell.old { fill: var(--text-muted); }
.ik-bell.new { fill: #ef4444; }
.ik-go .ik-bell.old { opacity: 0.25; }
.ik-go .ik-bell.new { opacity: 0.28; }
.ik-bell-l { fill: none; stroke-width: 2.5; }
.ik-bell-l.old { stroke: var(--text-muted); }
.ik-bell-l.new { stroke: #ef4444; }

/* son 12 ay gun gun */
.ik-band { fill: var(--text-muted); opacity: 0.16; }
.ik-med { fill: none; stroke: var(--text-muted); stroke-width: 1.2; stroke-dasharray: 4 4; }
.ik-rec-line { fill: none; stroke-width: 1; opacity: 0.55; }
.ik-rec-line.hot { stroke: #ef4444; }
.ik-rec-line.cold { stroke: #3b82f6; }
.ik-obs { fill: none; stroke: var(--text-primary); stroke-width: 1.6; stroke-linejoin: round; }
.ik-marks circle { opacity: 0; transition: opacity 0.3s ease calc(var(--i) * 6ms + 0.4s); }
.ik-marks circle.hot { fill: #ef4444; }
.ik-marks circle.cold { fill: #3b82f6; }
.ik-go .ik-marks circle { opacity: 1; }
.ik-k-band { background: var(--text-muted); opacity: 0.35; }
.ik-k-line.rec { background: linear-gradient(90deg, #ef4444 50%, #3b82f6 50%); height: 2px !important; }
.ik-k-dot.hot { background: #ef4444; opacity: 1; }
.ik-k-dot.cold { background: #3b82f6; opacity: 1; }

/* yaz uzuyor ve uc olaylar: cubuklar sirayla gelir */
.ik-sbars rect, .ik-ebars rect { transform-box: fill-box; transform: scaleY(0); transition: transform 0.6s cubic-bezier(.3, .8, .3, 1) calc(var(--i) * 12ms); }
.ik-sbars rect { transform-origin: center; opacity: 0.85; }
.ik-ebars rect { transform-origin: bottom; opacity: 0.75; }
.ik-go .ik-sbars rect, .ik-go .ik-ebars rect { transform: scaleY(1); }
.ik-sline { fill: none; stroke: var(--text-primary); stroke-width: 2.4; }
.ik-eline { fill: none; stroke: var(--text-primary); stroke-width: 2.4; }

@media (max-width: 760px) {
  .ik-recs { grid-template-columns: 1fr; }
  .ik-carpet-m, .ik-carpet-g svg { height: 168px; }
  .ik-year { font-size: 1.2rem; min-width: 70px; }
}
@media (prefers-reduced-motion: reduce) {
  .ik-stripes svg, .ik-carpet-g svg { clip-path: none; transition: none; }
  .ik-dots circle, .ik-fan, .ik-tdot, .ik-bar b { opacity: 1; transition: none; }
  .ik-dots circle { opacity: 0.55; }
  .ik-pbar, .ik-bar span, .ik-wb span, .ik-sbars rect, .ik-ebars rect { transform: none; transition: none; }
  .ik-marks circle, .ik-spiral-segs path { opacity: 1; transition: none; }
  .ik-bell.old, .ik-bell.new { opacity: 0.25; transition: none; }
  .ik-range-now { left: var(--to); transition: none; }
}
