/* Copyright (c) 2016-2026 Juan Rios III d/b/a J3D Solutions. All rights reserved. */
/*
 * 2026 look (same family as jriosiii.com and the Reporte de Puentes start page): a dark hero with two soft
 * glows and drifting points (assets/fondo.js) that holds the live wait times on glass cards, and a calmer
 * section below for the ad spot and notes (light, or dark when the phone is in dark mode).
 */
:root {
  /* hero */
  --bg: #0a0f1c;
  --bg-2: #111a2e;
  --glow-1: rgba(56, 189, 248, .28);
  --glow-2: rgba(167, 139, 250, .22);
  --accent: #38bdf8;
  --accent-ink: #04121f;
  --accent-2: #fbbf24;
  --text: #e6ebf5;
  --text-soft: rgba(230, 235, 245, .72);
  --line: rgba(230, 235, 245, .14);
  --glass: rgba(255, 255, 255, .05);
  --glass-2: rgba(255, 255, 255, .09);
  /* section below the hero */
  --page: #f5f7fb;
  --ink: #141a26;
  --ink-soft: #4d5668;
  --card: #fff;
  --card-line: #e3e7ef;
  --link: #0284c7;
  /* wait levels: 0-14, 15-29, 30-44, 45-59, 60-74, 75+ minutes (same steps as the 2016 site) */
  --lv0: #22c55e; --lv1: #a3d635; --lv2: #facc15; --lv3: #fb923c; --lv4: #ef4444; --lv5: #be123c;
  --radius: 16px;
  --display: "Space Grotesk", Inter, system-ui, sans-serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --page: #0b1120; --ink: #e6ebf5; --ink-soft: #9aa6ba; --card: #111a2e; --card-line: #1f2a40; --link: #7dd3fc; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--page); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 3px solid rgba(56, 189, 248, .55); outline-offset: 2px; }

/* ---------- top bar (sits on the hero) ---------- */
.top { position: absolute; top: 0; left: 0; right: 0; z-index: 10; color: var(--text); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 500 18px/1 var(--display); letter-spacing: -.01em; }
.brand b { font-weight: 700; margin-left: 4px; }
.brand small { color: var(--accent-2); font-weight: 700; font-size: 14px; }
.brand-mark { width: 40px; height: 40px; padding: 8px 6px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 24px rgba(56, 189, 248, .35); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--glass); backdrop-filter: blur(6px); }
.lang button { border: 0; background: none; color: var(--text-soft); padding: 6px 11px; font-size: 12px; font-weight: 600; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.install { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--accent-2); color: #1f1300; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.install svg { width: 16px; height: 16px; }
@media (max-width: 480px) {
  .brand { font-size: 16px; gap: 8px; } .brand small { display: none; } .brand-mark { width: 34px; height: 34px; }
  .install { padding: 6px 8px; } .install span { display: none; }
}
@media (max-width: 340px) { .brand b { display: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate; color: var(--text);
  background:
    radial-gradient(900px 560px at 10% 0%, var(--glow-1), transparent 60%),
    radial-gradient(800px 560px at 95% 25%, var(--glow-2), transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  padding: 104px 0 56px;
}
.particles { position: absolute; inset: 0; z-index: 0; }
.particles canvas { display: block; }
.hero > .wrap { position: relative; z-index: 1; }

.ios-hint { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 10px 14px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.ios-hint p { margin: 0; flex: 1; font-size: 14px; }
.ios-hint button { border: 0; background: transparent; color: var(--text-soft); font-size: 22px; line-height: 1; }

.eyebrow { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); }
h1 { font: 700 clamp(34px, 6vw, 60px)/1.04 var(--display); letter-spacing: -.03em; margin: 12px 0 14px; max-width: 15em; }
.hl { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { font-size: 18px; color: var(--text-soft); max-width: 36em; margin: 0 0 24px; }

.status-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-soft); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--lv0); box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); animation: pulse 2s infinite; }
.live.is-stale i { background: var(--lv2); box-shadow: 0 0 0 4px rgba(250, 204, 21, .2); animation: none; }
.live.is-offline i { background: var(--text-soft); box-shadow: none; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } }
.refresh { margin-left: auto; border: 1px solid var(--line); background: var(--glass); color: var(--text); border-radius: 12px; padding: 8px 16px; font-size: 14px; font-weight: 600; backdrop-filter: blur(6px); }
.refresh:hover { border-color: rgba(230, 235, 245, .4); }
.refresh:disabled { opacity: .5; cursor: progress; }

.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: 0 0 auto; border: 1px solid var(--line); background: var(--glass); color: var(--text-soft); border-radius: 999px; padding: 8px 18px; font-weight: 600; font-size: 14px; backdrop-filter: blur(6px); }
.filters button:hover { color: var(--text); }
.filters button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: transparent; }

.legend { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 16px 0 14px; font-size: 12px; color: var(--text-soft); }
.legend span { padding: 2px 8px; border-radius: 6px; color: #06120a; font-weight: 700; }
.legend em { font-style: normal; }
.legend .lv0, .wait.lv0 { background: var(--lv0); }
.legend .lv1, .wait.lv1 { background: var(--lv1); }
.legend .lv2, .wait.lv2 { background: var(--lv2); }
.legend .lv3, .wait.lv3 { background: var(--lv3); }
.legend .lv4, .wait.lv4 { background: var(--lv4); }
.legend .lv5, .wait.lv5 { background: var(--lv5); }
.legend .lv4, .legend .lv5 { color: #fff; }

/* ---------- bridge cards (glass, on the hero) ---------- */
.bridges { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(10px); padding: 18px; min-width: 0; color: var(--text); }
.card.skeleton { min-height: 200px; background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.09), rgba(255,255,255,.04)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { font: 700 18px/1.2 var(--display); margin: 0; letter-spacing: -.01em; }
.hours { font-size: 12px; color: var(--text-soft); white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }
.hours:empty { display: none; }
.lanes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lane { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px 9px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.lane.empty { color: var(--text-soft); font-size: 14px; }
.lane-label { display: flex; flex-direction: column; min-width: 0; }
.lane-name { font-weight: 600; font-size: 15px; }
.lane-meta { font-size: 12px; color: var(--text-soft); }
.wait { flex: 0 0 auto; min-width: 70px; text-align: center; color: #06120a; border-radius: 10px; padding: 6px 10px; line-height: 1.1; }
.wait b { display: block; font: 700 22px/1 var(--display); }
.wait small { font-size: 11px; font-weight: 600; opacity: .85; }
.wait.lv4, .wait.lv5 { color: #fff; }
.wait.muted { background: rgba(255, 255, 255, .1); color: var(--text-soft); font-size: 13px; font-weight: 600; padding: 10px; }
.notice { margin-top: 10px; font-size: 13px; color: var(--text-soft); }
.notice summary { cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: .04em; }
.notice p { margin: 6px 0 0; }

/* live cameras (one panel per bridge; the video loads only while the panel is open) */
.cams { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.cams summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--accent); padding: 4px 0; }
.cams summary::-webkit-details-marker { display: none; }
.cams summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.cams summary small { color: var(--text-soft); font-weight: 400; }
.cams[open] summary { margin-bottom: 8px; }
.cam-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.cam-tabs button { border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text-soft); font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 999px; }
.cam-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.error { margin: 16px 0 0; padding: 12px 16px; border-radius: 12px; background: rgba(239, 68, 68, .15); color: #fecaca; border: 1px solid rgba(239, 68, 68, .35); }

/* ---------- below the hero ---------- */
.below { padding: 8px 16px 0; }
.ad {
  margin: 32px 0; border-radius: var(--radius); padding: 26px 22px; text-align: center; color: var(--text);
  background: radial-gradient(500px 200px at 15% 0%, rgba(56, 189, 248, .25), transparent 70%), radial-gradient(500px 220px at 90% 100%, rgba(251, 191, 36, .18), transparent 70%), var(--bg-2);
  border: 1px solid var(--line);
}
.ad-tag { margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; }
.ad-text { margin: 8px 0 14px; font: 600 19px/1.3 var(--display); }
.ad-cta { display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none; padding: 10px 20px; border-radius: 12px; font-weight: 700; font-size: 14px; }
.ad-cta:hover { filter: brightness(1.08); }

.notes { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 22px 24px; box-shadow: 0 1px 2px rgba(15, 20, 30, .04), 0 10px 30px rgba(15, 20, 30, .06); }
.notes h2 { font: 700 20px/1.2 var(--display); margin: 0 0 10px; }
.notes ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.notes li { margin-bottom: 6px; }

.foot { margin-top: 40px; padding: 24px 0 32px; border-top: 1px solid var(--card-line); font-size: 13px; color: var(--ink-soft); }
.foot p { margin: 4px 0; }
.foot a { color: var(--link); }

@media (max-width: 480px) {
  .hero { padding: 92px 0 40px; }
  .sub { font-size: 16px; }
  .card { padding: 14px; }
  .refresh { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .live i, .card.skeleton { animation: none; }
}

/* installed app: room for the phone status bar and home indicator (kept last so it wins) */
@media (display-mode: standalone) {
  .top { padding-top: env(safe-area-inset-top); }
  .hero { padding-top: calc(104px + env(safe-area-inset-top)); }
  .foot { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
