/* ============================================================
   Wattly — Tesla software updates (/tesla-updates)
   Builds on home.css + subpages.css. Flat surfaces, mono labels.
   ============================================================ */

.tu-shell { padding-top: 144px; padding-bottom: 24px; }
.tu-wrap {
  max-width: 1060px; margin: 0 auto;
  /* Map share steps: flat accent mixes, no gradients */
  --s0: color-mix(in oklab, var(--accent) 14%, var(--surface-2));
  --s1: color-mix(in oklab, var(--accent) 34%, var(--surface-2));
  --s2: color-mix(in oklab, var(--accent) 56%, var(--surface-2));
  --s3: color-mix(in oklab, var(--accent) 78%, var(--surface-2));
  --s4: var(--accent);
}

/* Back link (release pages only) */
.tu-back {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 28px;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--tx-3); transition: color .18s ease;
}
.tu-back:hover { color: var(--accent); }
.tu-back svg { width: 15px; height: 15px; }
.tu-back[hidden] { display: none; }

/* Header */
.tu-head { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; margin-bottom: 48px; }
.tu-head h1 {
  font-size: clamp(2.6rem, 5vw, 4.4rem); font-weight: 500; letter-spacing: -.045em; line-height: 1.08;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.tu-lede { color: var(--tx-2); font-size: 1.12rem; max-width: 60ch; }
.tu-lede[hidden], .tu-facts[hidden], .tu-actions[hidden] { display: none; }

/* Instrument facts: label over value */
.tu-facts { display: flex; flex-wrap: wrap; gap: 14px 44px; margin-top: 8px; }
.tu-fact { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tu-fact em {
  font-style: normal; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--tx-3);
}
.tu-fact b { font-weight: 500; font-size: 1.12rem; letter-spacing: -0.015em; color: var(--tx); font-variant-numeric: tabular-nums; }
.tu-fact small { font-size: 0.86rem; color: var(--accent); }

/* Share actions */
.tu-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.tu-action {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px;
  border: 1px solid var(--hair-2); border-radius: 8px; background: transparent;
  color: var(--tx); font-family: var(--sans); font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: border-color .18s ease, background .18s ease;
}
.tu-action:hover { border-color: var(--tx-3); background: var(--surface); }
.tu-action svg { width: 15px; height: 15px; }

/* Latest release */
.tu-lead {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px 48px; align-items: start;
  padding: 32px; margin-bottom: 64px;
  border: 1px solid var(--hair); border-radius: 14px; background: var(--surface);
  transition: border-color .2s ease;
}
.tu-lead:hover { border-color: var(--accent-line); }
.tu-lead-label {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
}
.tu-lead-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tu-lead-version { font-size: clamp(2.2rem, 4.4vw, 3.4rem); font-weight: 500; letter-spacing: -.04em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tu-lead-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.tu-lead-list li { color: var(--tx-2); font-size: 1.02rem; padding-left: 18px; position: relative; }
.tu-lead-list li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 8px; height: 1px; background: var(--tx-3); }
.tu-lead-side { display: flex; flex-direction: column; gap: 22px; min-width: 200px; }
.tu-lead.has-map { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr) auto; }
.tu-lead-where { min-width: 0; }
.tu-lead-where-label {
  display: block; margin-bottom: 10px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tx-3);
}
.tu-lead-map { border: 1px solid var(--hair); border-radius: 12px; background: var(--bg-2); padding: 8px; overflow: hidden; }
.tu-lead-more {
  grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 7px;
  color: var(--accent); font-weight: 600; font-size: 0.95rem;
}
.tu-lead-more svg { width: 16px; height: 16px; transition: transform .18s ease; }
.tu-lead:hover .tu-lead-more svg { transform: translateX(3px); }

/* Branches */
.tu-branch { margin-bottom: 48px; }
.tu-branch-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--hair);
}
.tu-branch-head h2 { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.12em; color: var(--tx-2); }
.tu-branch-head span { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tx-3); }

.tu-row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr) 96px 150px; gap: 24px; align-items: center;
  padding: 18px 4px; border-bottom: 1px solid var(--hair);
  transition: background .15s ease;
}
.tu-row:hover { background: var(--surface); }
.tu-row-version {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}

/* Rolling out: two chevrons rising in turn, still when motion is reduced */
.tu-rolling {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 0.64rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
}
.tu-rolling svg { width: 12px; height: 12px; overflow: visible; flex: none; }
.tu-rolling path { animation: tu-rise 1.4s ease-in-out infinite; }
.tu-rolling path:nth-child(2) { animation-delay: 0.18s; }
@keyframes tu-rise {
  0% { transform: translateY(2.5px); opacity: 0.25; }
  45% { opacity: 1; }
  100% { transform: translateY(-2.5px); opacity: 0.25; }
}
.tu-fact .tu-rolling { font-size: 0.86rem; letter-spacing: 0.06em; padding-top: 3px; }
.tu-fact .tu-rolling svg { width: 15px; height: 15px; }
.tu-row-notes { color: var(--tx-2); font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tu-row-notes.muted { color: var(--tx-3); }
.tu-row-date { font-family: var(--mono); font-size: 0.78rem; color: var(--tx-3); text-align: right; }

/* Fleet share bar */
.tu-share { display: flex; align-items: center; gap: 10px; }
.tu-share-track { flex: 1; height: 4px; border-radius: 2px; background: var(--hair); overflow: hidden; }
.tu-share-track i { display: block; height: 100%; width: var(--w, 0%); min-width: 2px; border-radius: 2px; background: var(--accent); }
.tu-share-track.empty i { display: none; }
.tu-share b { font-family: var(--mono); font-size: 0.78rem; font-weight: 500; color: var(--tx-2); min-width: 46px; text-align: right; }

/* Release notes */
.tu-notes { list-style: none; border-top: 1px solid var(--hair); }
.tu-note {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px 48px;
  padding: 32px 0; border-bottom: 1px solid var(--hair);
}
.tu-note h3 { font-size: 1.4rem; font-weight: 500; letter-spacing: -0.025em; line-height: 1.25; }
.tu-note-sub { margin-top: 6px; font-size: 0.95rem; color: var(--tx-3); }
.tu-note-body { color: var(--tx-2); font-size: 1.04rem; line-height: 1.75; white-space: pre-line; max-width: 68ch; }
.tu-note-img {
  display: block; width: 100%; max-width: 620px; height: auto; margin-bottom: 20px;
  border: 1px solid var(--hair); border-radius: 12px; background: var(--surface);
}

/* Section heads (map, notes) */
.tu-section-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.tu-section-head h2 { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.025em; }
.tu-section-head p { color: var(--tx-3); font-size: 0.92rem; max-width: 70ch; }

/* Where it's been spotted */
.tu-where { margin-bottom: 64px; }
.tu-where-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(250px, 1fr); gap: 28px 44px; align-items: start; }
.tu-map { border: 1px solid var(--hair); border-radius: 14px; background: var(--bg-2); padding: 10px; overflow: hidden; }
.tu-map-svg { display: block; width: 100%; height: auto; }
.tu-land { fill: var(--surface-2); stroke: var(--bg-2); stroke-width: 0.6px; vector-effect: non-scaling-stroke; }
.tu-land.s0 { fill: var(--s0); } .tu-land.s1 { fill: var(--s1); } .tu-land.s2 { fill: var(--s2); }
.tu-land.s3 { fill: var(--s3); } .tu-land.s4 { fill: var(--s4); }
.tu-land[class*=" s"]:hover { stroke: var(--tx); stroke-width: 1.2px; }
.tu-legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tx-3);
}
.tu-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tu-legend i { width: 10px; height: 10px; border-radius: 2px; }
.tu-legend i.s0 { background: var(--s0); } .tu-legend i.s1 { background: var(--s1); } .tu-legend i.s2 { background: var(--s2); }
.tu-legend i.s3 { background: var(--s3); } .tu-legend i.s4 { background: var(--s4); }
.tu-countries { list-style: none; border-top: 1px solid var(--hair); }
.tu-country {
  display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 4px 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--hair);
}
.tu-country-name { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; min-width: 0; }
.tu-country small { grid-column: 1 / -1; color: var(--tx-3); font-size: 0.8rem; }

/* Newer / older */
.tu-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }
.tu-pager a {
  display: flex; flex-direction: column; gap: 6px; padding: 20px 22px;
  border: 1px solid var(--hair); border-radius: 14px; transition: border-color .18s ease, background .18s ease;
}
.tu-pager a:hover { border-color: var(--hair-2); background: var(--surface); }
.tu-pager a.older { grid-column: 2; text-align: right; }
.tu-pager em { font-style: normal; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--tx-3); }
.tu-pager b { font-weight: 500; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* States */
.tu-message { color: var(--tx-2); font-size: 1.05rem; padding: 32px 0; max-width: 60ch; }
.tu-message a, .tu-message button {
  color: var(--accent); font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer;
}
.tu-skeleton { display: flex; flex-direction: column; gap: 14px; }
.tu-skeleton i {
  display: block; height: 64px; border-radius: 14px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%; animation: tu-shimmer 1.4s ease-in-out infinite;
}
.tu-skeleton i:first-child { height: 180px; margin-bottom: 36px; }
@keyframes tu-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .tu-skeleton i, .tu-rolling path { animation: none; } .tu-rolling path { opacity: 1; } }

.tu-footnote { margin-top: 56px; color: var(--tx-3); font-size: 0.86rem; line-height: 1.7; max-width: 80ch; }

/* CTA: flat, like the rest of the subpages */
.tu-cta .cta-card { background: var(--surface); }
.tu-cta .cta-card::before { display: none; }

@media (max-width: 860px) {
  .tu-lead, .tu-lead.has-map { grid-template-columns: 1fr; padding: 24px; }
  .tu-lead-side { flex-direction: row; flex-wrap: wrap; gap: 14px 36px; min-width: 0; }
  .tu-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .tu-row-version { grid-column: 1; }
  .tu-row-date { grid-column: 2; grid-row: 1; }
  .tu-row-notes { grid-column: 1 / -1; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tu-row .tu-share { grid-column: 1 / -1; }
  .tu-note { grid-template-columns: 1fr; padding: 26px 0; }
  .tu-where-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .tu-shell { padding-top: 116px; }
  .tu-facts { gap: 14px 28px; }
  .tu-pager { grid-template-columns: 1fr; }
  .tu-pager a.older { grid-column: 1; text-align: left; }
}
