/* ============== Pistler page-scoped styles ==============
 * Extracted from legacy/uludaginfocom-v1/pistler.html inline <style>
 * blocks. Loaded via apps/web/src/app/layout.tsx so V1's exact CSS
 * rules apply on /tr/pistler. *//* =========== Pistler page =========== */

  /* ===== Difficulty mix bar ===== */
  .diff-mix {
    background: #fff; border: 2px solid var(--u-black); border-radius: 18px;
    padding: 22px 24px; margin: -38px auto 0; max-width: 1320px; position: relative; z-index: 5;
    box-shadow: var(--u-shadow);
  }
  .diff-mix .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
  .diff-mix .top .ttl {
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 14px; letter-spacing: 0.16em; color: var(--u-black);
  }
  .diff-mix .top .ttl span { color: var(--u-fuchsia); }
  .diff-mix .top .tot {
    font-family: 'Mark Pro'; font-weight: 500; font-size: 11px;
    letter-spacing: 0.18em; text-transform: uppercase; color: var(--u-muted);
  }
  .diff-mix .bar {
    display: flex; height: 22px; border-radius: 999px; overflow: hidden;
    border: 2px solid var(--u-black);
  }
  .diff-mix .bar div {
    display: grid; place-items: center;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    /* madde 5 (02.06) — segment yazıları beyaz: renkli/siyah zorluk
       arkaplanları üstünde okunur (önceki siyah, diff-black'te görünmezdi). */
    font-size: 11px; letter-spacing: 0.06em; color: #fff;
  }
  .diff-mix .legend {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px;
  }
  .diff-mix .lg {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 14px; border: 1.5px solid #e5e7eb; border-radius: 12px;
  }
  .diff-mix .lg .swatch {
    width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--u-black);
  }
  .diff-mix .lg .nm { font-family: 'Mark Pro'; font-weight: 700; font-size: 13px; color: var(--u-black); }
  .diff-mix .lg .ct {
    font-family: 'Mark Pro'; font-weight: 900; font-size: 18px; margin-left: auto;
    color: var(--u-black);
  }
  .diff-mix .lg .ct small { font-size: 11px; color: var(--u-muted); font-weight: 500; margin-left: 4px; letter-spacing: 0.1em; }

  /* Difficulty colors */
  .diff-green  { background: #1B9E5A; color: #fff; }
  .diff-blue   { background: #2C8BB4; color: #fff; }
  .diff-red    { background: #E5126D; color: #fff; }
  .diff-black  { background: #0A0A0A; color: #fff; }

  /* ===== Filter bar ===== */
  .ph-filter {
    background: var(--u-snow); padding: 28px 0 18px;
  }
  .ph-filter .ctrls {
    display: flex; flex-wrap: wrap; gap: 22px; align-items: end;
    background: #fff; border: 2px solid var(--u-black); border-radius: 16px;
    padding: 18px 22px; box-shadow: var(--u-shadow);
  }
  .ph-filter .grp { display: flex; flex-direction: column; gap: 8px; }
  /* Bug Report 04.06 — ZORLUK/DURUM dropdown'ı yalnız mobilde (seg masaüstünde). */
  .ph-filter .ph-filter-dd { display: none; position: relative; }
  .ph-filter label {
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 10px; letter-spacing: 0.2em; color: var(--u-muted); text-transform: uppercase;
  }
  .ph-filter .seg {
    display: inline-flex; background: #f3f3ef; border: 2px solid var(--u-black); border-radius: 999px; padding: 3px;
  }
  .ph-filter .seg button {
    background: transparent; border: 0; cursor: pointer;
    padding: 7px 14px; border-radius: 999px;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 11px; letter-spacing: 0.1em; color: var(--u-slate);
    display: inline-flex; align-items: center; gap: 6px;
  }
  .ph-filter .seg button:hover { color: var(--u-fuchsia); }
  .ph-filter .seg button.on { background: var(--u-black); color: var(--u-yellow); }
  .ph-filter .seg button .sw { width: 9px; height: 9px; border-radius: 3px; border: 1.5px solid var(--u-black); }
  .ph-filter .seg button.on .sw { border-color: rgba(255,255,255,0.6); }

  .ph-filter .search {
    flex: 1; min-width: 220px; max-width: 360px;
    display: flex; align-items: center; gap: 8px;
    background: #f7f7f4; border: 1.5px solid #d8d6cf; border-radius: 12px;
    padding: 10px 14px;
  }
  .ph-filter .search input {
    border: 0; background: transparent; outline: none; flex: 1;
    font-family: 'Gotham'; font-size: 13.5px; color: var(--u-slate);
  }
  .ph-filter .right-side {
    margin-left: auto; display: flex; gap: 8px; align-items: center;
  }
  .ph-filter .view-toggle {
    display: inline-flex; background: var(--u-black); border-radius: 10px; padding: 3px;
    border: 2px solid var(--u-black);
  }
  .ph-filter .view-toggle button {
    background: transparent; border: 0; padding: 7px 10px; border-radius: 8px;
    color: rgba(255,255,255,0.65); cursor: pointer;
  }
  .ph-filter .view-toggle button.on { background: var(--u-yellow); color: var(--u-black); }

  /* ===== Piste cards (default view) ===== */
  .ph-list { padding: 16px 0 80px; background: var(--u-snow); }
  .pist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .pist-card {
    /* madde 6 (02.06, kök neden) — position:relative ŞART. has-night-lighting
       ::before (absolute; inset:0) bunsuz en yakın konumlu ataya (section)
       yayılıp tüm liste alanını navy/gri kaplıyordu; hover'daki transform
       containing-block oluşturunca ::before karta snap edip sayfa beyaza
       dönüyordu ("highlight edince düzeliyor"). relative ile ::before her
       zaman kart içinde kalır. */
    position: relative;
    background: #fff; border: 2px solid var(--u-black); border-radius: 18px;
    overflow: hidden; box-shadow: var(--u-shadow);
    display: flex; flex-direction: column;
    transition: transform 200ms ease, box-shadow 200ms ease;
  }
  .pist-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px -16px rgba(0,0,0,0.22); }

  .pist-card .topband {
    height: 8px;
  }
  .pist-card.diff-green .topband { background: #1B9E5A; }
  .pist-card.diff-blue  .topband { background: #2C8BB4; }
  .pist-card.diff-red   .topband { background: #E5126D; }
  .pist-card.diff-black .topband { background: #0A0A0A; }

  /* madde 6 (02.06) — kart kökü `diff-${p.diff}` class'ı taşıyor (sadece
     .topband rengi için hook). Global `.diff-*{ background; color:#fff }`
     kuralları kart kökünü boyayıp metni beyaza çeviriyordu (renkler
     bozuluyordu). Kart kökünü beyaz bg + siyah metne sabitle; renkli
     hook yalnızca .topband / .diff-pill gibi alt elemanlarda kalır. */
  .pist-card.diff-green,
  .pist-card.diff-blue,
  .pist-card.diff-red,
  .pist-card.diff-black {
    background: #fff;
    color: var(--u-black);
  }

  .pist-card .header {
    padding: 18px 18px 10px; display: flex; justify-content: space-between; gap: 14px; align-items: flex-start;
  }
  .pist-card .code-wrap {
    display: flex; align-items: center; gap: 10px;
  }
  .pist-card .code {
    background: var(--u-black); color: var(--u-yellow);
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 13px; letter-spacing: 0.06em;
    padding: 5px 10px; border-radius: 8px; border: 2px solid var(--u-black);
    flex-shrink: 0; min-width: 44px; text-align: center;
  }
  .pist-card .nm {
    font-family: 'Mark Pro'; font-weight: 900; font-size: 22px;
    color: var(--u-black); line-height: 1.08; letter-spacing: -0.01em; margin-top: 2px;
  }
  .pist-card .nm .sub {
    display: block;
    font-family: 'Gotham'; font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--u-muted); margin-top: 4px;
  }
  .pist-card .diff-pill {
    flex-shrink: 0;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 10px; letter-spacing: 0.16em;
    padding: 6px 10px; border-radius: 999px; border: 2px solid var(--u-black);
    text-transform: uppercase;
  }

  /* Mini elevation profile */
  .pist-card .elev {
    margin: 4px 18px 0; height: 56px;
    background: linear-gradient(180deg, #F4F4F0 0%, #ECECE6 100%);
    border-radius: 10px; position: relative; overflow: hidden;
    border: 1.5px solid #DDDDD4;
  }
  .pist-card .elev svg { width: 100%; height: 100%; display: block; }
  .pist-card .elev .endlabel {
    position: absolute; font-family: 'Mark Pro'; font-weight: 700; font-size: 9px;
    letter-spacing: 0.1em; color: var(--u-slate);
  }
  .pist-card .elev .endlabel.top { top: 6px; left: 8px; }
  .pist-card .elev .endlabel.bot { bottom: 6px; right: 8px; }

  /* Stats row */
  .pist-card .stats {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    margin: 14px 18px 0;
    padding: 10px;
    background: var(--u-snow); border-radius: 12px; border: 1.5px solid #ECEAE0;
  }
  .pist-card .st {
    text-align: center; padding: 2px;
  }
  .pist-card .st + .st { border-left: 1px dashed #DCD9CB; }
  .pist-card .st .v {
    font-family: 'Mark Pro'; font-weight: 900; font-size: 17px;
    color: var(--u-black); line-height: 1; letter-spacing: -0.01em;
  }
  .pist-card .st .v small { font-size: 10px; font-weight: 700; margin-left: 1px; color: var(--u-muted); }
  .pist-card .st .k {
    font-family: 'Mark Pro'; font-weight: 700; font-size: 9px;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--u-muted);
    margin-top: 4px;
  }

  /* Features chip row */
  .pist-card .feats {
    margin: 12px 18px 0; display: flex; flex-wrap: wrap; gap: 6px;
  }
  .pist-card .ft {
    background: #fff; border: 1.5px solid #d8d6cf;
    font-family: 'Mark Pro'; font-weight: 700; font-size: 10px; letter-spacing: 0.08em;
    color: var(--u-slate); text-transform: uppercase;
    padding: 4px 9px; border-radius: 999px;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .pist-card .ft.on  { background: var(--u-yellow); border-color: var(--u-black); color: var(--u-black); }
  .pist-card .ft.race { background: var(--u-fuchsia); border-color: var(--u-black); color: #fff; }
  .pist-card .ft.fis { background: var(--u-black); border-color: var(--u-black); color: var(--u-yellow); }

  /* Footer */
  .pist-card .foot {
    margin-top: auto;
    padding: 14px 18px 16px;
    display: flex; justify-content: space-between; gap: 8px; align-items: center;
  }
  .pist-card .status {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic; font-size: 11px;
    letter-spacing: 0.16em; text-transform: uppercase;
  }
  .pist-card .status .dot {
    width: 9px; height: 9px; border-radius: 50%;
  }
  .pist-card .status.open { color: #1B9E5A; }
  .pist-card .status.open .dot { background: #1B9E5A; box-shadow: 0 0 0 4px rgba(27,158,90,0.18); animation: pulse 1.6s infinite; }
  .pist-card .status.closed { color: var(--u-fuchsia); }
  .pist-card .status.closed .dot { background: var(--u-fuchsia); }
  .pist-card .lift-link {
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 11px; letter-spacing: 0.12em; color: var(--u-slate);
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
  }
  .pist-card .lift-link strong { color: var(--u-fuchsia); }

  /* ===== Table view ===== */
  .pist-table-wrap {
    background: #fff; border: 2px solid var(--u-black); border-radius: 18px; overflow: hidden;
    box-shadow: var(--u-shadow);
  }
  .pt { width: 100%; border-collapse: collapse; }
  .pt thead th {
    background: var(--u-black); color: #fff; text-align: left;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 11px; letter-spacing: 0.16em; padding: 14px 14px;
    border-right: 1px solid rgba(255,255,255,0.1);
  }
  .pt thead th:last-child { border-right: 0; }
  .pt tbody tr {
    border-bottom: 1px solid #ECECE6;
  }
  .pt tbody tr:nth-child(even) { background: #FAFAF6; }
  .pt tbody tr:hover { background: #FFF8E0; }
  .pt td {
    padding: 12px 14px;
    font-family: 'Gotham'; font-size: 13.5px; color: var(--u-slate);
    vertical-align: middle;
  }
  .pt td.code {
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    color: var(--u-black);
  }
  .pt td.nm {
    font-family: 'Mark Pro'; font-weight: 700; color: var(--u-black); font-size: 14px;
  }
  .pt td .difftag {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 11px; letter-spacing: 0.14em;
    padding: 4px 8px; border-radius: 999px; border: 1.5px solid var(--u-black);
  }
  .pt td .sw { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--u-black); }
  .pt td .num-cell {
    font-family: 'Mark Pro'; font-weight: 900; color: var(--u-black); font-size: 14px;
  }
  .pt td .num-cell small { font-size: 10px; color: var(--u-muted); margin-left: 2px; font-weight: 700; }
  .pt td .st-open  { color: #1B9E5A; font-family: 'Mark Pro'; font-weight: 900; font-style: italic; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
  .pt td .st-closed{ color: var(--u-fuchsia); font-family: 'Mark Pro'; font-weight: 900; font-style: italic; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
  /* 03.06 — Durum kolonu 2. satıra kaymasın (PLANLANIYOR/BEKLEMEDE tek satır);
     boşluğu açmak için Pist Adı kolonunu daralt. */
  .pt thead th:last-child, .pt td:last-child { white-space: nowrap; }
  .pt thead th:nth-child(2), .pt td.nm { width: 22%; max-width: 240px; }
  .pt td.nm { white-space: normal; }

  /* ===== Hidden states ===== */
  .pist-card.hidden, .pt tbody tr.hidden { display: none !important; }

  /* Result summary */
  .result-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 0 14px;
  }
  .result-bar .ct {
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 13px; letter-spacing: 0.14em; color: var(--u-black);
  }
  .result-bar .ct strong { color: var(--u-fuchsia); }
  .result-bar .ct .muted { color: var(--u-muted); font-weight: 500; }

  /* Empty state */
  .pist-empty {
    background: #fff; border: 2px dashed #c0c0c0; border-radius: 18px;
    padding: 60px 40px; text-align: center; color: var(--u-muted);
  }
  .pist-empty h3 {
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 24px; color: var(--u-black); margin-bottom: 8px;
  }

  /* =========================================================
   * Responsive overrides (Burak 2026-05-18)
   * - Drop "Kar" column at every viewport.
   * - Mobile: hide grid view + force list, trim columns, hide
   *   the 4-color difficulty legend (bar stays).
   * Table thead order (1-based):
   *   1: Kod  2: Pist Adı  3: Zorluk  4: Uzunluk  5: Düşey
   *   6: Kar  7: Bölge      8: Durum
   * ========================================================= */
  .pt thead th:nth-child(6), .pt tbody td:nth-child(6) { display: none; }

  /* Mobile: list-only — drop grid view toggle + force list rendering. */
  @media (max-width: 768px) {
    .ph-filter .view-toggle { display: none !important; }
    #pistGrid { display: none !important; }
    #pistTable { display: block !important; }

    /* Bug Report 04.06 — ZORLUK/DURUM mobilde dropdown (seg gizlenir). */
    .ph-filter .ctrls { flex-direction: column; align-items: stretch; gap: 14px; }
    .ph-filter .seg { display: none !important; }
    .ph-filter .ph-filter-dd { display: block; }
    .ph-filter .ph-filter-dd select {
      width: 100%; appearance: none; -webkit-appearance: none;
      background: #fff; border: 2px solid var(--u-black); border-radius: 999px;
      padding: 11px 38px 11px 16px;
      font-family: 'Mark Pro', sans-serif; font-weight: 700; font-size: 13px;
      color: var(--u-black); cursor: pointer;
    }
    .ph-filter .ph-filter-dd svg {
      position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
      pointer-events: none; color: var(--u-black);
    }

    /* Bug Report (2026-06-15): slope descriptions broke the mobile
       table — per-row sub text + the Uzunluk column made rows overflow
       and reflow with huge whitespace. On mobile keep only the tight
       Kod / Zorluk / Durum data columns (+ the name so rows are
       identifiable); hide Düşey(5), Kar(6), Bölge(7), Uzunluk(4) and
       the per-row description text. */
    .pt thead th:nth-child(4), .pt tbody td:nth-child(4),
    .pt thead th:nth-child(5), .pt tbody td:nth-child(5),
    .pt thead th:nth-child(7), .pt tbody td:nth-child(7) { display: none !important; }
    .pt .pt-row-desc { display: none !important; }

    /* Redistribute fixed-layout widths across the 4 visible columns
       (Kod, Pist Adı, Zorluk, Durum) so no horizontal overflow at 390px.
       table-layout:fixed otherwise keeps the hidden columns' width
       reservation. */
    .pt { table-layout: fixed; width: 100%; }
    .pt thead th:nth-child(1) { width: 16%; }
    .pt thead th:nth-child(2) { width: 38%; }
    .pt thead th:nth-child(3) { width: 22%; }
    .pt thead th:nth-child(8) { width: 24%; }
    .pt td.nm { white-space: normal; word-break: break-word; }

    /* Burak: zorluk dağılımı box kaldır mobile — hide the entire bar+legend block. */
    .diff-mix { display: none !important; }
    section[aria-labelledby="diff-mix-heading"] { display: none !important; }
  }
  @media (max-width: 480px) {
    .pt { font-size: 12.5px; }
    .pt td, .pt thead th { padding: 10px 8px; }
  }

/* ---- pist-scroll-bg + page-scoped overrides ---- */
  /* Scroll-bound snowtruck running across the bottom of the viewport */
  .pist-scroll-bg {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 5;
    opacity: 0.85;
  }
  .pist-scroll-bg .psb-snow {
    position: absolute; left: 0; right: 0; bottom: 0;
    width: 100%; height: 200px;
  }
  .pist-scroll-bg .psb-truck {
    position: absolute;
    width: 220px; height: 121px;
    bottom: 70px; right: 0;
    /* Travel right → left as scroll progresses */
    transform: translate3d(
      calc(var(--psb-t, 0) * (-100vw - 180px)),
      0,
      0
    );
    will-change: transform;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.20));
  }
  .pist-scroll-bg .psb-truck svg,
  .pist-scroll-bg .psb-truck img {
    width: 100%; height: 100%;
    display: block;
    animation: psb-bob 0.6s ease-in-out infinite alternate;
  }
  @keyframes psb-bob {
    from { transform: translateY(0); }
    to   { transform: translateY(-2px); }
  }
  /* Anchor real page content above the background */
  body[data-page="pistler"] > section,
  body[data-page="pistler"] > footer { position: relative; z-index: 1; }
  body[data-page="pistler"] .site-header { z-index: 60; }

  /* ===== New slope statuses (PLANNED_OPENING + PENDING, 2026-05-19) =====
   *
   * Two new operational states surface in the public list so the
   * "Açılması Planlanıyor" and "Beklemede" pists render correctly
   * instead of falling back to the Açık/Kapalı binary. Card foot uses
   * .status.<state>; table cell uses .st-<state>.
   *
   * Colour choices match the lift badges:
   *   planned → sky blue (var(--u-blue))
   *   pending → amber/yellow
   */
  .pist-card .status.planned { color: var(--u-blue); }
  .pist-card .status.planned .dot {
    background: var(--u-blue);
    box-shadow: 0 0 0 4px rgba(44, 139, 180, 0.18);
  }
  .pist-card .status.pending { color: #8a6a00; }
  .pist-card .status.pending .dot {
    background: #d4a800;
    box-shadow: 0 0 0 4px rgba(212, 168, 0, 0.22);
  }
  .pt td .st-planned {
    color: var(--u-blue);
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  }
  .pt td .st-pending {
    color: #8a6a00;
    font-family: 'Mark Pro'; font-weight: 900; font-style: italic;
    font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  }

  /* ===== Fix P2 (2026-05-21): stable column widths =====
   * `table-layout: fixed` locks columns to the header width
   * percentages, so filter changes (which expand/contract row
   * counts) no longer reflow column widths. 8 columns:
   *   Kod   8%
   *   Pist Adı  28%
   *   Zorluk    12%
   *   Uzunluk   10%
   *   Düşey     10%
   *   Kar        8%
   *   Bölge     12%
   *   Durum     12%  (total = 100)
   * The inline th `style={{ width: 60 }}` etc. set explicit px
   * widths in V1; with `table-layout: fixed` the percentages
   * below take precedence (more specific than inline px on the
   * `<table>` once the table-layout algorithm is fixed-mode). */
  .pt { table-layout: fixed; }
  .pt thead th:nth-child(1) { width: 8%; }
  .pt thead th:nth-child(2) { width: 28%; }
  .pt thead th:nth-child(3) { width: 12%; }
  .pt thead th:nth-child(4) { width: 10%; }
  .pt thead th:nth-child(5) { width: 10%; }
  .pt thead th:nth-child(6) { width: 8%; }
  .pt thead th:nth-child(7) { width: 12%; }
  .pt thead th:nth-child(8) { width: 12%; }
  .pt td, .pt th { overflow: hidden; text-overflow: ellipsis; }
  .pt td.nm { white-space: normal; }

/* ===== Night lighting atmosphere overlay (WEB-10) =====
 * Cards with hasNightLighting=true get a deep-navy glow overlay and
 * a subtle projector-light radial highlight. Text/layout unchanged.
 */
.pist-card.has-night-lighting { border-color: #1a3a5c; }
.pist-card.has-night-lighting::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(100, 180, 255, 0.12) 0%, transparent 70%),
    linear-gradient(170deg, rgba(1, 21, 40, 0.55) 0%, rgba(0, 10, 25, 0.30) 100%);
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
}
.pist-card.has-night-lighting > * { position: relative; z-index: 1; }
.pist-card.has-night-lighting .ft.on {
  background: rgba(44, 100, 180, 0.18);
  border: 1px solid rgba(100, 180, 255, 0.35);
  color: #93c5fd;
}
