/* DriveDry - style.css
   This file controls how the page looks. It is plain CSS, no frameworks. */

/* ---------- Colors and basic settings ---------- */
:root {
  --background: #07111a;   /* page background */
  --card: #0c1a26;         /* card background */
  --card-light: #12273a;   /* lighter boxes */
  --border: #24435e;
  --text: #ecf4f9;         /* main text */
  --text-soft: #b4c7d5;    /* smaller, softer text */
  --green: #34d57f;
  --yellow: #ffc933;
  --red: #ff5c52;
  --blue: #52d3ff;
  --glow: 147, 168, 188;   /* page glow color, changes with the status */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

/* ---------- The page ---------- */
/* max-width keeps it phone-sized, even on a big screen */
.page {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  /* env(safe-area-...) keeps content away from the iPhone notch and home bar */
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: radial-gradient(120% 40% at 50% 0%, rgba(var(--glow), 0.22), transparent 70%);
  transition: background 0.8s;
}

/* The glow color changes with the status. app.js sets data-status. */
.page[data-status="green"]  { --glow: 52, 213, 127; }
.page[data-status="yellow"] { --glow: 255, 201, 51; }
.page[data-status="red"]    { --glow: 255, 92, 82; }

h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
h1 span {
  color: var(--blue);
}

h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

p {
  margin: 0;
}

a {
  color: var(--blue);
}

/* ---------- Top bar ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tagline {
  font-size: 13px;
  color: var(--text-soft);
}

button {
  font: inherit;
  cursor: pointer;
}

#refreshButton {
  min-height: 44px;            /* 44px is the recommended minimum tap size */
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
}
#refreshButton:disabled {
  opacity: 0.6;
}

/* ---------- Disclaimer ---------- */
.disclaimer-bar {
  margin-bottom: 14px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 201, 51, 0.45);
  border-radius: 20px;
  background: rgba(255, 201, 51, 0.1);
  font-size: 13px;
  font-weight: 600;
}
.disclaimer-bar a,
.disclaimer-card a {
  color: var(--yellow);
}

.disclaimer-card {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid rgba(255, 201, 51, 0.45);
  border-radius: 16px;
  background: rgba(255, 201, 51, 0.1);
  font-size: 14px;
}
.disclaimer-card p + p {
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 13px;
}

/* ---------- Route picker ---------- */
.small-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-soft);
}

select {
  display: block;
  width: 100%;
  height: 54px;
  margin-top: 6px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;            /* 16px or bigger stops iPhone from zooming in */
  font-weight: 600;
}

.small-text {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-soft);
}
.warning-text {
  color: var(--yellow);
}
.center {
  text-align: center;
}

/* ---------- Status card ---------- */
.card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--card);
}

.status-card {
  display: flex;
  gap: 16px;
  padding: 20px;
  transition: border-color 0.5s;
}
.page[data-status="green"]  .status-card { border-color: rgba(52, 213, 127, 0.5); }
.page[data-status="yellow"] .status-card { border-color: rgba(255, 201, 51, 0.5); }
.page[data-status="red"]    .status-card { border-color: rgba(255, 92, 82, 0.6); }

/* The traffic light */
.signal {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: flex-start;
  padding: 12px 8px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: #050c13;
}
.lamp {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #07111a;
  font-size: 24px;
  font-weight: 900;
  opacity: 0.2;               /* dim when off */
  transition: opacity 0.4s;
}
.lamp-red    { background: var(--red); }
.lamp-yellow { background: var(--yellow); }
.lamp-green  { background: var(--green); }

/* app.js adds the class "on" to the lamp that matches the status */
.lamp.on {
  opacity: 1;
}
.lamp-red.on    { box-shadow: 0 0 28px 6px rgba(255, 92, 82, 0.55);  animation: pulse 1.6s infinite; }
.lamp-yellow.on { box-shadow: 0 0 28px 6px rgba(255, 201, 51, 0.45); }
.lamp-green.on  { box-shadow: 0 0 28px 6px rgba(52, 213, 127, 0.45); }

@keyframes pulse {
  50% { filter: brightness(1.3); }
}

.status-text {
  flex: 1;
  min-width: 0;
}

#statusWord {
  margin: 2px 0 6px;
  font-size: 50px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}
.page[data-status="green"]  #statusWord { color: var(--green); }
.page[data-status="yellow"] #statusWord { color: var(--yellow); }
.page[data-status="red"]    #statusWord { color: var(--red); }

/* ---------- Info boxes ---------- */
.two-boxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.box {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
}
.two-boxes .box {
  margin-top: 0;
  min-width: 0;
}

.big {
  margin-top: 4px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}
.big small {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-soft);
}

.countdown {
  margin-top: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 20px;
  color: var(--blue);
}

/* extra space above a second label inside the same box */
.gap-top {
  margin-top: 12px;
}

#outlook:empty {
  display: none;
}

.notice {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 201, 51, 0.45);
  border-radius: 12px;
  background: rgba(255, 201, 51, 0.1);
  font-size: 13px;
}

/* ---------- Chart ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--text-soft);
}
.legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.swatch {
  display: inline-block;
  width: 26px;
  height: 0;
}
/* solid, dashed and dotted, so the lines differ by shape and not only by color */
.swatch-observed  { border-top: 3px solid var(--blue); }
.swatch-predicted { border-top: 2px dashed var(--text-soft); }
.swatch-estimate  { border-top: 3px dotted var(--blue); }

#chart {
  display: block;
  width: 100%;
  height: auto;
  touch-action: pan-y;        /* lets you scroll the page up and down while scrubbing sideways */
  user-select: none;
}

/* ---------- Lists ---------- */
.route-list,
.stage-list,
.how-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.route-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 1px solid var(--card-light);
  background: none;
  color: var(--text);
  text-align: left;
}
.route-button.selected {
  background: var(--card-light);
  border-radius: 12px;
}
.route-dot {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #07111a;
  font-weight: 900;
}
.route-dot.green  { background: var(--green); }
.route-dot.yellow { background: var(--yellow); }
.route-dot.red    { background: var(--red); }
.route-info {
  flex: 1;
  min-width: 0;
}
.route-info strong {
  display: block;
  font-size: 15px;
}
.route-info span {
  font-size: 12px;
  color: var(--text-soft);
}
.route-word {
  font-weight: 700;
  font-size: 14px;
}
.route-word.green  { color: var(--green); }
.route-word.yellow { color: var(--yellow); }
.route-word.red    { color: var(--red); }

.stage-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stage-list li {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #09151f;
  font-size: 12px;
  color: var(--text-soft);
}
.stage-list li.reached {
  border-color: var(--red);
  background: rgba(255, 92, 82, 0.1);
}
.stage-list strong {
  display: block;
  font-size: 24px;
  color: var(--text);
}

.how-list li {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--text-soft);
}
.how-list strong {
  color: var(--text);
}

footer {
  margin-top: 24px;
}

/* ---------- Bigger screens ---------- */
/* On tablets and computers, give the page a little more room */
@media (min-width: 700px) {
  .page {
    max-width: 600px;
  }
}

/* Respect people who turn off animations in their phone settings */
@media (prefers-reduced-motion: reduce) {
  .lamp-red.on {
    animation: none;
  }
}
