/* ═══════════════════════════════════════════════════
   CityTime — clock.css
   Clock grid, tiles, digital/analog display, hero,
   facts cards — shared across all clock pages
   ═══════════════════════════════════════════════════ */

/* ── Clock grid ───────────────────────────────────── */
.clock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 12px;
  padding: calc(var(--toolbar-h) + 14px) 14px 14px;
  min-height: 100vh;
  align-content: start;
  transition: padding var(--t-med);
}
.clock-grid.edit-active { padding-bottom: calc(var(--edit-bar-h) + 14px); }

/* ── Clock tile ───────────────────────────────────── */
.clock-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: background var(--t-med), border-color var(--t-med),
              border-top-color var(--t-med), box-shadow var(--t-fast), transform var(--t-fast);
  cursor: default;
  overflow: hidden;
  min-height: 130px;
}
.clock-tile.is-day   { box-shadow: inset 0 0 0 200px var(--day-tint); }
.clock-tile.is-night { box-shadow: inset 0 0 0 200px var(--night-tint); }
.clock-tile.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.clock-tile.dragging  { opacity: .45; transform: scale(.97); }

.edit-active .clock-tile        { cursor: grab; }
.edit-active .clock-tile:active { cursor: grabbing; }

/* ── Tile header ──────────────────────────────────── */
.tile-header {
  width: 100%; display: flex; flex-direction: column;
  align-items: center; gap: 1px; text-align: center;
}
.city-name {
  font-size: .8rem; font-weight: 600; color: var(--text-pri);
  line-height: 1.2; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 100%;
}
.country-name {
  font-size: .68rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; max-width: 100%;
}

/* ── Digital display ──────────────────────────────── */
.digital-display { display: flex; align-items: baseline; gap: 4px; line-height: 1; }
.digital-time {
  font-family: var(--font-num);
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  font-weight: 300; color: var(--text-pri);
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}
.digital-ampm {
  font-family: var(--font-num); font-size: .7rem; font-weight: 500;
  color: var(--text-sec); letter-spacing: .04em;
  align-self: flex-end; margin-bottom: .2em;
}
.digital-seconds { color: var(--accent); opacity: .9; }

/* ── Analog SVG ───────────────────────────────────── */
.analog-svg { width: min(120px, 75%); aspect-ratio: 1; overflow: visible; }

.clock-face      { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.clock-tick      { stroke: var(--text-muted); stroke-width: 1; }
.clock-tick-hour { stroke: var(--text-sec); stroke-width: 2; }
.clock-number    { font-family: var(--font-num); font-size: 14px; fill: var(--text-sec); }
.hand-hour       { stroke: var(--text-pri); stroke-width: 4; stroke-linecap: round; fill: none; }
.hand-minute     { stroke: var(--text-pri); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.hand-second     { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.hand-center     { fill: var(--text-pri); }
.hand-center-dot { fill: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .hand-second { transition: none !important; }
  .clock-tile  { transition: none !important; }
}

/* ── Tile footer ──────────────────────────────────── */
.tile-footer {
  width: 100%; display: flex; flex-direction: column;
  align-items: center; gap: 3px; margin-top: auto;
}
.tile-date { font-size: .7rem; color: var(--text-sec); font-variant-numeric: tabular-nums; }
.tile-tz-row {
  display: flex; align-items: center; gap: 5px;
  flex-wrap: wrap; justify-content: center;
}
.tile-tz {
  font-family: var(--font-num); font-size: .65rem; font-weight: 600;
  color: var(--text-muted); letter-spacing: .04em;
}
.badge {
  font-size: .58rem; font-weight: 700; letter-spacing: .05em;
  padding: 1px 5px; border-radius: 4px; line-height: 1.5;
}
.badge-dst { background: var(--badge-dst); color: var(--badge-dst-txt); }
.badge-wkd { background: var(--badge-wkd); color: var(--badge-wkd-txt); }

/* ── Remove button (edit mode) ────────────────────── */
.remove-btn {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  border-radius: 50%; border: none;
  background: rgba(220,60,60,.8); color: #fff;
  font-size: 1rem; line-height: 1; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  font-weight: 700; transition: background var(--t-fast); z-index: 10;
}
.remove-btn:hover          { background: rgba(220,60,60,1); }
.edit-active .remove-btn   { display: flex; }

/* ── Add city tile ────────────────────────────────── */
.add-tile {
  background: transparent; border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; color: var(--text-muted);
  font-size: .85rem; min-height: 130px;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.add-tile:hover, .add-tile:focus-visible {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent); outline: none;
}
.add-tile svg { width: 28px; height: 28px; }

/* ════════════════════════════════════════════════════
   HERO CLOCK  (homepage + city pages)
   ════════════════════════════════════════════════════ */

.city-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* Breadcrumb */
.breadcrumb {
  padding: 16px 0 0;
  font-size: .8rem; color: var(--text-sec);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-sec); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumb-sep { opacity: .4; }

.section-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* Hero section */
.hero { text-align: center; padding: 44px 0 36px; }
.hero h1 {
  font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 700;
  color: var(--text-pri); margin: 0 0 28px; letter-spacing: -.02em;
}

/* Digital clock */
.hero-digital {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 2px; margin-bottom: 14px; line-height: 1;
}
.hero-hhmm {
  font-family: var(--font-num);
  font-size: clamp(4.5rem, 18vw, 7.5rem);
  font-weight: 300; color: var(--text-pri); letter-spacing: -.03em;
}
.hero-seconds {
  font-family: var(--font-num);
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 300; color: var(--accent); padding-bottom: .14em;
}
.hero-ampm {
  font-family: var(--font-num);
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  font-weight: 400; color: var(--text-sec); padding-bottom: .22em; margin-left: 6px;
}

/* Analog clock */
.hero-analog { display: none; justify-content: center; margin-bottom: 14px; }
.hero-analog .analog-svg { width: min(230px, 58vw); height: min(230px, 58vw); }
.hero.show-analog .hero-digital { display: none; }
.hero.show-analog .hero-analog  { display: flex; }

.hero-date { font-size: .98rem; color: var(--text-sec); margin-bottom: 18px; }
.hero-tz   { font-family: var(--font-num); font-size: .88rem; color: var(--text-muted); margin-bottom: 18px; letter-spacing: .02em; }

/* Day/night label — plain text, sits under the H1 */
.hero-daynight {
  font-size: .82rem;
  color: var(--text-sec);
  margin: -18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.hero-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap;
}

/* Day/night badge */
.daynight-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .82rem; padding: 5px 12px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-sec);
  border: 1px solid var(--border);
  transition: background var(--t-fast), color var(--t-fast);
}
.daynight-badge.is-day {
  background: color-mix(in srgb, #fbbf24 14%, var(--surface-2));
  color: #d97706;
  border-color: color-mix(in srgb, #fbbf24 25%, var(--border));
}
.daynight-badge.is-night {
  background: color-mix(in srgb, #818cf8 10%, var(--surface-2));
  color: var(--text-sec);
}

/* Toggle digital/analog button */
.hero-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-sec);
  font-size: .82rem; font-family: var(--font-ui); cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.hero-toggle-btn:hover { background: var(--surface); color: var(--text-pri); border-color: var(--accent); }
.hero-toggle-btn svg   { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Facts strip ──────────────────────────────────── */
.facts-strip {
  display: flex; flex-wrap: wrap; gap: 12px; padding: 28px 0;
}
.fact-card {
  flex: 1; min-width: 130px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px 16px;
  transition: border-top-color var(--t-med);
}
.fact-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-sec); margin-bottom: 8px;
}
.fact-value {
  font-family: var(--font-num); font-size: 1.3rem; font-weight: 600;
  color: var(--text-pri); line-height: 1.2;
}
.fact-value-note {
  font-family: var(--font-ui); font-size: .88rem; font-weight: 400;
  color: var(--text-sec); line-height: 1.4;
}
.badge-wkd-inline {
  display: inline-block; font-size: .75rem; font-weight: 600;
  padding: 2px 9px; border-radius: 4px;
  background: var(--badge-wkd); color: var(--badge-wkd-txt);
}
.badge-dst-inline {
  display: inline-block; font-size: .75rem; font-weight: 600;
  padding: 2px 9px; border-radius: 4px;
  background: var(--badge-dst); color: var(--badge-dst-txt);
}

/* ── CTA section ──────────────────────────────────── */
.cta-section { padding: 32px 0; text-align: center; }
.btn-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 30px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff;
  font-family: var(--font-ui); font-size: 1rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  box-shadow: 0 2px 12px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-cta:hover {
  background: var(--accent-hover); transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--accent) 45%, transparent);
}
.btn-cta svg { width: 18px; height: 18px; }
.city-link {
  display: block; margin-top: 14px;
  font-size: .82rem; color: var(--text-muted);
  text-decoration: none;
}
.city-link:hover { color: var(--accent); text-decoration: underline; }

/* ── Grid responsive ──────────────────────────────── */
@media (max-width: 399px) {
  .clock-grid { grid-template-columns: 1fr; }
}
@media (min-width: 400px) and (max-width: 599px) {
  .clock-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 600px) and (max-width: 899px) {
  .clock-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (min-width: 900px) and (max-width: 1399px) {
  .clock-grid { grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); }
}
@media (min-width: 1400px) {
  .clock-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); max-width: 1920px; margin-inline: auto; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .clock-tile  { min-height: 100px; padding: 10px; }
  .digital-time { font-size: 1.4rem; }
}
