:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1f24;
  --muted: #5c6570;
  --line: #d9dee5;
  --accent: #1f4b7a;
  --accent-soft: #e8f0f8;
  --ok: #0f6b4c;
  --danger: #8b1e1e;
  --radius: 10px;
  --max: 980px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
.skip-link {
  position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: .5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0; }
.wrap { width: min(var(--max), calc(100% - 2rem)); margin-inline: auto; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  padding: .35rem 0;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.logo-mark {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}
.logo-text { font-size: 1.1rem; line-height: 1; }
.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .35rem .95rem;
  align-items: center;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .95rem;
  white-space: nowrap;
}
.nav a:hover { color: var(--accent); }

.main { padding: 1.75rem 0 3rem; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(220px, 0.85fr);
  gap: 1.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.hero-copy h1 {
  font-size: clamp(1.55rem, 2.4vw, 2.05rem);
  line-height: 1.25;
  margin: 0 0 .75rem;
  letter-spacing: -0.02em;
}
.lede { color: var(--muted); margin: 0; max-width: 38rem; }
.hero-art {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: .75rem;
}

.panel, .cards article, .prose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}
.panel h2, .panel h3 { margin-top: 1.25rem; }
.panel h2:first-child { margin-top: 0; }

.planner-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin: 1rem 0 1.15rem;
}
.city-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: end;
  margin: 0 0 1rem;
}
label { display: grid; gap: .35rem; font-size: .9rem; color: var(--muted); }
input, select, textarea, button { font: inherit; color: var(--text); }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .65rem;
  background: #fff;
  width: 100%;
}
.btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: .65rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  height: fit-content;
}
.btn:hover { filter: brightness(1.05); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.city-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.city-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: .55rem .75rem;
}
.city-list button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: .25rem .55rem;
  cursor: pointer;
}
.hint { color: var(--muted); font-size: .92rem; }
.results { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.result {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .75rem .9rem;
  background: #fafbfc;
}
.result strong { color: var(--ok); }
.grid { display: grid; gap: 2px; overflow-x: auto; padding-bottom: .25rem; }
.grid-row {
  display: grid;
  grid-template-columns: 120px repeat(24, minmax(16px, 1fr));
  gap: 2px;
  align-items: stretch;
  min-width: 640px;
}
.grid-label { font-size: .78rem; color: var(--muted); display: flex; align-items: center; }
.cell { height: 16px; border-radius: 2px; background: #e6e9ee; }
.cell.work { background: #7eb6a0; }
.cell.fringe { background: #c9d67a; }
.cell.sleep { background: #9aa3ad; }

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.cards h2 { font-size: 1.05rem; margin: 0 0 .4rem; }
.cards p { margin: 0; color: var(--muted); font-size: .95rem; }
.prose { max-width: 44rem; }
.prose h1 { margin-top: 0; }
.prose code { background: #eef1f5; padding: .1rem .35rem; border-radius: 4px; font-size: .92em; }
.flash { background: #e7f6ee; border: 1px solid #b7e0c7; color: #0f6b4c; padding: .75rem 1rem; border-radius: 8px; }
.flash.error { background: #fcebeb; border-color: #efc0c0; color: var(--danger); }
.contact-form { display: grid; gap: .85rem; max-width: 32rem; }
.hp { position: absolute; left: -10000px; height: 0; overflow: hidden; }

.site-footer {
  border-top: 1px solid var(--line);
  background: #eef0f3;
  padding: 2rem 0 1.25rem;
  margin-top: 1rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 1.5rem;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}
.footer-brand img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
}
.footer-grid h2 {
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 .5rem;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: .3rem 0; }
.footer-grid p, .footer-note p { color: var(--muted); font-size: .92rem; }
.footer-note { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .planner-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { max-height: 180px; max-width: 420px; }
}
@media (max-width: 700px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: .75rem 0;
  }
  .nav { justify-content: flex-start; }
  .footer-grid { grid-template-columns: 1fr; }
  .city-row { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .planner-controls { grid-template-columns: 1fr; }
}
