/* Timezone Converter — animated modern UI.
   Palette: deep indigo night + warm amber accent (two cities, one line).
   All animation is CSS-driven; JS only toggles classes / sets text.
   Clocks update once per second, never per frame. */

:root {
  --bg: #0f1226;
  --bg-soft: #171a35;
  --card: #ffffff;
  --ink: #171a35;
  --ink-soft: #4b4f6e;
  --line: #e3e5f2;
  --accent: #f59e0b;
  --accent-2: #6366f1;
  --accent-3: #0ea5e9;
  --good: #15803d;
  --good-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(15, 18, 38, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(99, 102, 241, .28), transparent 60%),
    radial-gradient(700px 380px at -10% 0%, rgba(245, 158, 11, .22), transparent 55%),
    var(--bg);
  line-height: 1.55;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ---------------- top bar (HEIC template) ----------------
   Sticky brand + section nav, matching the HEIC tool page pattern. */
.site-header {
  position: sticky; top: 0; z-index: 50;
  /* Solid background: with a translucent header, content sliding
     underneath showed through and looked overlapped at some scroll
     positions (E2E 2026-11-07). */
  background: #0f1226;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 800; font-size: 1.05rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #d97706);
  box-shadow: var(--shadow);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: #c7cbf5; text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 10px; transition: background 0.18s, color 0.18s;
}
.nav a:hover, .nav a:focus-visible { background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; }

/* ---------------- hero ---------------- */
/* Kept compact on purpose: the converter must start on the first screen
   at a 999px-high desktop viewport (E2E 2026-11-07 found it below the
   fold with the taller hero). */
.hero { color: #fff; padding: 28px 0 18px; }
.hero .eyebrow {
  margin: 0 0 6px; text-transform: uppercase; letter-spacing: .14em;
  font-size: .78rem; color: #c7cbf5; font-weight: 600;
}
.hero h1 { margin: 0 0 10px; font-size: clamp(1.9rem, 5vw, 2.9rem); line-height: 1.1; }
.hero .lede { margin: 0; max-width: 62ch; color: #dfe2f7; font-size: 1.06rem; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.pill {
  font-size: .82rem; font-weight: 600; color: #dfe2f7;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 5px 11px; border-radius: 999px;
}

main { padding-bottom: 40px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 14px 0;
  animation: card-in .45s ease both;
  /* Anchor targets sit under the 64px sticky header without this. */
  scroll-margin-top: 76px;
}
.card:nth-of-type(2) { animation-delay: .05s; }
.card:nth-of-type(3) { animation-delay: .1s; }
.card:nth-of-type(4) { animation-delay: .15s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 { margin: 0 0 6px; font-size: 1.25rem; line-height: 1.3; }
h3 { margin: 18px 0 4px; font-size: 1.05rem; }
p { margin: 8px 0; }
.hint { color: var(--ink-soft); font-size: .9rem; }

.field label { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
select, input[type="text"], input[type="date"] {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .22);
}
.zone-label { font-size: .88rem; color: var(--ink-soft); margin: 6px 0 0; min-height: 1.2em; }

.pair-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}
.pair-actions { display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; margin-top: 14px; }

.btn {
  font: inherit; font-weight: 650;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent-2); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }
.btn-primary:hover { background: #5457e8; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }
.btn-small { padding: 7px 14px; font-size: .9rem; }
.btn-success { background: var(--good); color: #fff; box-shadow: 0 4px 14px rgba(21, 128, 61, .35); }
#swap-btn { margin-top: 26px; padding: 11px 14px; }

/* The main tool card: one card holds the whole converter (pair picker +
   convert form, merged 2026-11-07). The amber top edge marks it as the
   tool itself, so it is easy to spot on the page. */
.tool-card { border-top: 4px solid var(--accent); }
.live-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e; margin-left: 4px; vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
}
.clocks {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  margin-top: 12px;
}
.clock {
  background: linear-gradient(160deg, #171a35, #23265a);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.clock::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .08) 50%, transparent 60%);
  animation: sheen 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.clock-zone { margin: 0; font-weight: 700; font-size: 1rem; letter-spacing: .02em; }
.clock-time {
  margin: 6px 0 2px;
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: .02em;
  transition: opacity .18s ease;
}
.clock-time.tick { animation: tick .3s ease; }
@keyframes tick { 0% { opacity: .55; } 100% { opacity: 1; } }
.clock-date, .clock-offset { margin: 2px 0; color: #c7cbf5; font-size: .92rem; }
.clock-offset strong { color: #fcd34d; }
.diff { text-align: center; min-width: 150px; }
.diff-value { font-size: 1.7rem; font-weight: 800; margin: 0; font-variant-numeric: tabular-nums; color: var(--accent-2); }
.diff-words { margin: 4px 0 0; color: var(--ink-soft); font-size: .92rem; max-width: 22ch; }

/* --- Convert --- */
.convert-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;
  margin-top: 14px;
}
.result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 12px;
  background: linear-gradient(120deg, #eef2ff, #fef3c7);
  border: 1px solid #dbe2ff;
  animation: result-in .35s ease both;
}
@keyframes result-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.result-line { font-size: 1.25rem; margin: 0; }
.result-line .arrow { color: var(--accent-2); padding: 0 6px; }
.result-sub { margin: 8px 0 0; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-2); color: #fff; font-size: .85rem; font-weight: 700;
}
.badge.same { background: var(--good); }
.badge.next { background: var(--accent); }
.badge.prev { background: #0ea5e9; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 14px 0 0; font-size: .95rem; }
.alert-error { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca; }
.alert-warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #fde68a; }
.alert-warn strong { color: #78350f; }

.share-row { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.share-row > label { font-weight: 650; }
.share-controls { display: flex; gap: 10px; margin-top: 8px; }
.share-controls input { font-size: .9rem; color: var(--ink-soft); }
#copy-share.copied { animation: copied-pop .4s ease; }
@keyframes copied-pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* --- Timeline --- */
.timeline {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  margin-top: 16px;
  touch-action: pan-y;
  user-select: none;
}
.tl-cell {
  border: 1.5px solid var(--line);
  background: #f8f9ff;
  border-radius: 8px;
  padding: 8px 2px 6px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  min-width: 0;
  overflow: hidden;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.tl-cell:hover { transform: translateY(-3px); border-color: var(--accent-2); background: #eef2ff; }
.tl-cell .tl-from { display: block; font-weight: 700; font-size: .85rem; font-variant-numeric: tabular-nums; }
.tl-cell .tl-to { display: block; font-size: .78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.tl-cell .tl-shift { display: block; font-size: .7rem; color: var(--accent); font-weight: 700; min-height: 1em; }
.tl-cell.daytime { background: #fffbeb; border-color: #fde68a; }
.tl-cell.selected {
  background: var(--accent-2); border-color: var(--accent-2); color: #fff;
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 6px 16px rgba(99, 102, 241, .4);
}
.tl-cell.selected .tl-to, .tl-cell.selected .tl-shift { color: #e0e7ff; }
.tl-cell.gap { background: var(--bad-bg); border-color: #fecaca; }
.tl-cell.gap .tl-to { color: var(--bad); font-weight: 700; }
.timeline-legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 12px; font-size: .88rem; color: var(--ink-soft); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.swatch-overlap { background: #fde68a; border: 1px solid #f59e0b; }
.swatch-gap { background: #fecaca; border: 1px solid #f87171; }

/* --- Meeting finder --- */
.meet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;
  margin-top: 14px;
}
.time-range { display: flex; gap: 8px; align-items: center; }
.time-range input { text-align: center; }
.meet-result { margin-top: 18px; }
.overlap-bar {
  height: 26px; border-radius: 999px; overflow: hidden;
  background: #eef2ff; border: 1px solid #dbe2ff; position: relative; margin: 12px 0;
}
.overlap-fill {
  position: absolute; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3));
  border-radius: 999px;
  animation: fill-in .8s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes fill-in { from { width: 0; } }
.overlap-fill.no-overlap {
  background: repeating-linear-gradient(45deg, #fca5a5, #fca5a5 8px, #fee2e2 8px, #fee2e2 16px);
}
.meet-times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.meet-time {
  background: #f8f9ff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.meet-time p { margin: 2px 0; }
.meet-time .mt-big { font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.meet-note { margin-top: 10px; }

/* --- DST --- */
.dst-list { list-style: none; padding: 0; margin: 12px 0 0; }
.dst-list li {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px;
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.dst-list .dst-date { font-weight: 750; }
.dst-list .dst-kind { font-size: .85rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.dst-kind.spring { background: var(--warn-bg); color: var(--warn); }
.dst-kind.fall { background: #e0e7ff; color: #3730a3; }
.dst-none { color: var(--good); font-weight: 650; }

/* --- Privacy --- */
.privacy { border: 2px solid #bbf7d0; }
.net-counter { font-size: 1.05rem; }
.net-counter strong { font-size: 1.4rem; color: var(--good); }
.verify-steps { margin: 10px 0; padding-left: 22px; }
.verify-steps li { margin: 4px 0; }
kbd {
  background: #eef2ff; border: 1px solid #c7cbf5; border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font: .85em ui-monospace, monospace;
}

/* --- Guide / FAQ --- */
.guide h3 { margin-top: 20px; }
.guide ul { padding-left: 22px; }
details {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 10px 0;
}
details summary { cursor: pointer; font-weight: 650; }
details[open ] summary { margin-bottom: 6px; }

.site-footer { color: #c7cbf5; padding: 10px 0 40px; font-size: .9rem; }
.site-footer .footer-note { color: #9aa0cc; }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* --- Responsive --- */
@media (max-width: 760px) {
  .nav { display: none; }
  .pair-row, .convert-row, .meet-grid { grid-template-columns: 1fr; }
  #swap-btn { margin: 0; justify-self: center; transform: rotate(90deg); }
  .clocks { grid-template-columns: 1fr; }
  .diff { order: 3; }
  .meet-times { grid-template-columns: 1fr; }
  .card { padding: 18px; }
}

/* --- Timeline wraps before it can overflow its card --- */
@media (max-width: 640px) {
  .timeline { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .tl-cell .tl-from { font-size: .78rem; }
  .tl-cell .tl-to { font-size: .7rem; }
}
@media (max-width: 420px) {
  .timeline { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tl-cell { padding: 6px 1px 5px; }
  .tl-cell .tl-from { font-size: .72rem; }
  .tl-cell .tl-to { font-size: .68rem; }
  .tl-cell .tl-shift { font-size: .62rem; }
}

/* --- Reduced motion: kill the animation layer, keep the tool instant --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .clock::after { display: none; }
}
