/* ============================================================
   Time & Sky — global stylesheet
   Brand name is a placeholder: find-and-replace "Time & Sky"
   ============================================================ */

:root {
  --ink: #0e1a2b;          /* deep night navy */
  --ink-soft: #44546b;     /* muted slate for secondary text */
  --paper: #f5f8fc;        /* cool paper white */
  --card: #ffffff;
  --line: #dbe4f0;
  --day: #1766c2;          /* clear-sky blue (links, actions) */
  --day-deep: #0f4f9c;
  --dawn: #f0a11c;         /* sunrise amber (highlights) */
  --night-band: #16263d;
  --ok: #1e8e5a;
  --warn: #c96f0a;
  --bad: #b3423a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 8px 24px rgba(14, 26, 43, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8eef7;
    --ink-soft: #9fb0c7;
    --paper: #0c1522;
    --card: #14202f;
    --line: #24354c;
    --day: #5aa2ee;
    --day-deep: #7db6f2;
    --dawn: #f2b23f;
    --night-band: #0a111c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

a { color: var(--day); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 3px solid var(--dawn); outline-offset: 2px; border-radius: 4px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 1rem; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -.02em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: .95rem; height: .95rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dawn) 0%, var(--day) 70%);
  flex: none;
}

.nav-toggle {
  margin-left: auto;
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .6rem;
  font-size: 1.1rem;
  color: var(--ink);
  cursor: pointer;
}

.nav-links {
  margin-left: auto;
  display: flex;
  gap: .25rem;
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}
.nav-links a {
  display: block;
  padding: .45rem .7rem;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .92rem;
}
.nav-links a:hover { color: var(--ink); background: var(--line); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--day); background: color-mix(in srgb, var(--day) 12%, transparent); }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    margin: 0;
    padding: .5rem 1rem 1rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Sky hero (signature): gradient follows real time of day ---------- */
.hero {
  color: #fff;
  padding: 2.5rem 0 2.75rem;
  background: linear-gradient(160deg, #16263d, #0e1a2b); /* default night; JS updates */
  transition: background 1.5s ease;
}
.hero.sky-dawn  { background: linear-gradient(160deg, #2b3a68 0%, #b45a7c 55%, #f0a11c 115%); }
.hero.sky-day   { background: linear-gradient(160deg, #1766c2 0%, #4d97e0 60%, #a8d0f2 120%); }
.hero.sky-dusk  { background: linear-gradient(160deg, #1d2a52 0%, #6a3d78 55%, #d1652e 115%); }
.hero.sky-night { background: linear-gradient(160deg, #0a111c 0%, #16263d 70%, #24354c 120%); }

.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .75rem;
  font-weight: 700;
  opacity: .85;
  margin: 0 0 .25rem;
}
.hero h1 {
  margin: 0 0 .35rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: -.02em;
  line-height: 1.15;
}
.hero p.lede { margin: 0; max-width: 46rem; opacity: .92; font-size: 1.02rem; }
.hero .muted { color: rgba(255, 255, 255, .78); }

.big-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: clamp(3rem, 12vw, 6.5rem);
  letter-spacing: -.03em;
  line-height: 1;
  margin: .75rem 0 .25rem;
}
.big-clock .sec { font-size: .45em; font-weight: 600; opacity: .8; }
.big-date { font-size: 1.05rem; opacity: .92; }

/* ---------- Layout blocks ---------- */
main { padding: 1.75rem 0 3rem; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}
.card h2, .card h3 { margin-top: 0; }

.section-title {
  font-size: 1.35rem;
  letter-spacing: -.01em;
  margin: 2rem 0 .9rem;
}

.muted { color: var(--ink-soft); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Forms ---------- */
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .3rem; }

input[type="text"], input[type="search"], input[type="datetime-local"],
input[type="date"], input[type="time"], input[type="number"], select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
input:focus, select:focus { border-color: var(--day); }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: .62rem 1.1rem;
  background: var(--day);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.btn:hover { background: var(--day-deep); }
.btn.ghost {
  background: transparent;
  color: var(--day);
  border: 1px solid var(--day);
}
.btn.small { padding: .35rem .7rem; font-size: .85rem; }

.field-row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.field-row > div { flex: 1 1 180px; }

/* ---------- Clock cards ---------- */
.clock-card { text-align: left; position: relative; }
.clock-card .city { font-weight: 700; font-size: 1rem; margin: 0; }
.clock-card .country { font-size: .8rem; color: var(--ink-soft); }
.clock-card .time {
  font-variant-numeric: tabular-nums;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.02em;
  margin: .2rem 0 0;
}
.clock-card .meta { font-size: .8rem; color: var(--ink-soft); }
.clock-card .remove {
  position: absolute;
  top: .5rem; right: .6rem;
  border: 0; background: none;
  color: var(--ink-soft);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
}
.clock-card .remove:hover { color: var(--bad); }
.clock-card.is-night { border-left: 4px solid var(--night-band); }
.clock-card.is-day { border-left: 4px solid var(--dawn); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: .55rem .65rem; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }

/* Meeting planner hour cells */
.hour-cell {
  min-width: 2rem;
  text-align: center;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  padding: .35rem .15rem;
}
.hour-work { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.hour-edge { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.hour-off  { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--ink-soft); }

/* ---------- Weather ---------- */
.wx-now {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.wx-temp {
  font-size: 3.4rem;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.wx-icon { font-size: 3rem; line-height: 1; }
.wx-day { text-align: center; padding: .75rem .35rem; }
.wx-day .d { font-weight: 700; font-size: .85rem; }
.wx-day .i { font-size: 1.6rem; margin: .25rem 0; }
.wx-day .hi { font-weight: 700; }
.wx-day .lo { color: var(--ink-soft); }

/* ---------- Countdown ---------- */
.count-grid { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
.count-box {
  flex: 1 1 110px;
  text-align: center;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem .5rem;
  box-shadow: var(--shadow);
}
.count-box .n {
  font-size: clamp(2rem, 7vw, 3.2rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.count-box .l { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }

/* ---------- Sun & moon ---------- */
.sun-arc { font-size: 2.2rem; }
.moon-emoji { font-size: 3.5rem; line-height: 1; }

/* ---------- Ad slots (Google AdSense placeholders) ---------- */
.ad-slot {
  margin: 1.5rem auto;
  min-height: 100px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}
.ad-slot.leaderboard { min-height: 90px; }
.ad-slot.rect { min-height: 250px; max-width: 336px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 2.25rem;
  color: var(--ink-soft);
  font-size: .88rem;
}
.site-footer .cols {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: space-between;
}
.site-footer ul { list-style: none; padding: 0; margin: .4rem 0 0; }
.site-footer li { margin: .25rem 0; }

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero { transition: none; }
}
