/* Colours come from palette.css, which build.py writes from mapkit/palette.py.  */

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 40px 32px 24px; }

/* ---------- Calendar page: headline ---------- */
.masthead { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 30px; }
.masthead h1 {
  margin: 0;
  font-size: clamp(56px, 9vw, 112px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: .88;
  font-variation-settings: "opsz" 96;
}
.hl {
  display: inline-block;
  background: var(--highlight);
  color: var(--on-highlight);
  padding: .03em .12em .07em;
  margin: .1em 0 0 -.12em;
  line-height: .92;
}
.byline { text-align: right; max-width: 330px; font-size: 15px; color: var(--muted); }
.byline b { display: block; font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -0.03em; line-height: 1.1; }
.byline b a { text-decoration: none; background-image: linear-gradient(var(--highlight), var(--highlight)); background-size: 100% 4px; background-position: 0 92%; background-repeat: no-repeat; }
.byline b a:hover { background-size: 100% 100%; }
.byline p { margin: 6px 0 0; }
.progress strong { color: var(--ink); }
.chips { display: flex; gap: 6px; justify-content: flex-end; margin-top: 12px; }
.chips i { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ink); }

/* ---------- Calendar grid ---------- */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 2px solid var(--ink);
  border-left: 1px solid var(--ink);
}
.dow {
  font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 8px 10px;
  border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.tile {
  position: relative;
  aspect-ratio: 1 / .9;
  padding: 10px 11px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  color: var(--ink); text-decoration: none;
}
.tile .num {
  position: relative; align-self: flex-start;
  font-size: clamp(24px, 2.8vw, 36px); font-weight: 800; letter-spacing: -0.04em; line-height: 1;
}
.tile .theme {
  position: relative; align-self: flex-start;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; line-height: 1.2;
}

/* empty days: the dotted riso pattern */
.tile.empty {
  background-image: radial-gradient(var(--dots) 1.1px, transparent 1.1px);
  background-size: 11px 11px; background-position: 5px 5px;
}
.tile.empty .num { color: var(--dots); }
.tile.empty .theme { background: var(--paper); padding: 1px 4px; margin-left: -4px; }
.tile.empty.is-past .num { color: var(--muted); }

/* finished days: map preview + highlighted labels in the day's colour */
.tile .thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.tile .no-thumb { background: color-mix(in srgb, var(--day) 28%, var(--paper)); }
.tile.done .num, .tile.done .theme { background: var(--day); color: var(--on-day); padding: 2px 6px 1px; margin-left: -6px; }
.tile.done .num { margin-top: -2px; }
.tile.done:hover .thumb, .tile.done:focus-visible .thumb { transform: scale(1.05); }
.tile.done:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }

/* today */
.tile.is-today { box-shadow: inset 0 0 0 3px var(--ink); }
.tile.is-today::after {
  content: "Today";
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  background: var(--ink); color: var(--paper); padding: 2px 6px;
}

.tile.blank { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(23, 20, 18, .06) 6px 7px); }

/* ---------- Day page ---------- */
.topnav {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px;
  font-size: 14px; font-weight: 600;
  border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 24px;
}
.topnav a { text-decoration: none; }
.topnav a:hover { text-decoration: underline; }
.topnav .pn { display: flex; gap: 18px; }
.dayhead { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px 20px; }
.daynum {
  background: var(--day); color: var(--on-day);
  font-size: clamp(48px, 7vw, 76px); font-weight: 800; letter-spacing: -0.05em; line-height: .9;
  padding: 6px 12px 2px;
}
.dayhead h1 {
  margin: 0;
  font-size: clamp(52px, 10vw, 120px); font-weight: 800; letter-spacing: -0.055em; line-height: .82;
  font-variation-settings: "opsz" 96;
}
.daysub { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 22px 0 6px; font-size: 15px; color: var(--muted); }
.daysub .title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }
.prompt { margin: 0 0 18px; max-width: 72ch; font-size: 14px; color: var(--muted); }

.mapframe { margin: 0; border: 2px solid var(--ink); background: var(--water); }
.mapframe iframe { display: block; width: 100%; height: min(74vh, 700px); border: 0; }
.mapframe img { display: block; width: 100%; height: auto; }
.maplinks { margin: 8px 0 0; text-align: right; font-size: 13px; font-weight: 700; }

.label {
  display: inline-block; margin: 0 0 14px; padding: 3px 8px;
  background: var(--day); color: var(--on-day);
  font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.why, .sources, .how { margin-top: 44px; }
.why p, .why li { font-size: 19px; line-height: 1.55; max-width: 64ch; }
.why p { margin: 0 0 14px; }

.srcgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.src { border: 1.5px solid var(--ink); background: #f7f3eb; padding: 14px 16px 12px; }
.src h3 { margin: 0 0 10px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.src h3 a { text-decoration: none; border-bottom: 3px solid var(--day); }
.src dl { display: grid; grid-template-columns: 100px 1fr; gap: 5px 12px; margin: 0; font-size: 14px; line-height: 1.45; }
.src dt { padding-top: 2px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.src dd { margin: 0; }
.missing { background: var(--alert); color: var(--on-alert); font-size: 12.5px; font-weight: 700; padding: 1px 6px; }
.missing-block { display: inline-block; background: var(--alert); color: var(--on-alert); font-weight: 700; padding: 6px 10px; }

.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools span { border: 1.5px solid var(--ink); padding: 3px 10px; font-size: 14px; font-weight: 600; }
details.code { margin-top: 16px; border: 1.5px solid var(--ink); }
details.code summary { cursor: pointer; padding: 10px 14px; font-weight: 800; }
details.code pre {
  margin: 0; padding: 16px; overflow-x: auto;
  background: var(--ink); color: var(--paper);
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; line-height: 1.6;
}

.pnext { display: grid; grid-template-columns: 1fr 1fr; margin-top: 48px; border: 2px solid var(--ink); }
.pnext a, .pnext span { padding: 14px 16px; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; text-decoration: none; }
.pnext > :last-child { border-left: 2px solid var(--ink); text-align: right; }
.pnext a:hover { background: var(--day); color: var(--on-day); }
.pnext small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: inherit; opacity: .75; }
.pnext .off {
  color: var(--muted);
  background-image: radial-gradient(var(--dots) 1.1px, transparent 1.1px); background-size: 11px 11px;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px;
  margin-top: 12px; padding: 14px 0 28px;
  border-top: 2px solid var(--ink);
  font-size: 13px; color: var(--muted);
}
.site-footer .template-note { flex-basis: 100%; }
.site-footer .template-note a { font-weight: 600; color: var(--ink); }

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .wrap { padding: 24px 16px 16px; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 18px; }
  .byline { text-align: left; }
  .chips { justify-content: flex-start; }
  .calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dow, .tile.blank { display: none; }
  .tile { aspect-ratio: 1 / .78; }
  .srcgrid { grid-template-columns: 1fr; }
  .src dl { grid-template-columns: 88px 1fr; }
  .mapframe iframe { height: 68vh; }
  .pnext a, .pnext span { font-size: 17px; }
}
