/* Daily Pixel — public site styles */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #F3F4F1;
  --ink: #1D2327;
  --graphite: #61696E;
  --rule: #D8DBD6;
  --tile: #E2E5E0;
  --pixel: #2448D8;
  --on-pixel: #FFFFFF;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --text: "Newsreader", Georgia, "Times New Roman", serif;
  --gutter: clamp(16px, 3vw, 40px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15181A;
    --ink: #E6E8E4;
    --graphite: #9AA2A6;
    --rule: #2B3033;
    --tile: #212528;
    --pixel: #6A8DFF;
    --on-pixel: #0E1420;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--pixel); }
:focus-visible { outline: 2px solid var(--pixel); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- masthead ---------- */
.masthead {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 8px 28px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px var(--gutter) 22px;
}
.brand { display: block; color: var(--ink); line-height: 0; }
.brand:hover { color: var(--ink); }
.wordmark { height: 50px; width: auto; display: block; }
.tagline {
  margin: 0 0 3px;
  font-family: var(--text);
  font-style: italic;
  color: var(--graphite);
  font-size: 1.05rem;
}
.nav { display: flex; gap: 22px; font-family: var(--display); font-weight: 500; font-size: 0.98rem; margin-bottom: 4px; }
.nav a { text-decoration: none; padding-bottom: 3px; border-bottom: 2px solid transparent; }
.nav a[aria-current] { border-bottom-color: var(--pixel); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 56px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
main { min-width: 0; }

/* ---------- a day ---------- */
.photos { display: grid; gap: 18px; }
.photo-link { display: block; justify-self: start; line-height: 0; }
.photo {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  max-height: calc(100svh - 150px);
  object-fit: contain;
  background: var(--tile);
}
.post-text {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 24px;
  margin-top: 30px;
}
.dateblock { display: block; text-decoration: none; font-family: var(--display); }
.day-num {
  display: block;
  font-size: 5.6rem;
  font-weight: 750;
  line-height: 0.8;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.day-rest { display: flex; flex-direction: column; margin-top: 12px; font-size: 0.9rem; line-height: 1.3; color: var(--graphite); }
.dateblock:hover .day-num { color: var(--pixel); }
.words { max-width: 62ch; }
.post-title {
  font-family: var(--display);
  font-weight: 650;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
  text-wrap: balance;
}
.body { font-size: 1.2rem; line-height: 1.65; }
.body p { margin: 0 0 0.9em; }
.body h3 { font-family: var(--display); font-size: 1.15rem; margin: 1.4em 0 0.4em; }
.body blockquote { margin: 0 0 0.9em; padding-left: 18px; border-left: 3px solid var(--rule); font-style: italic; }
.body ul { margin: 0 0 0.9em; padding-left: 1.2em; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; font-family: var(--display); font-size: 0.82rem; }
.tag { border: 1px solid var(--rule); padding: 2px 9px; border-radius: 99px; color: var(--graphite); }

.steps {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-family: var(--display);
}
.step { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.step-next { flex-direction: row-reverse; text-align: right; }
.step-img { width: 72px; height: 72px; object-fit: cover; }
.step:hover .step-img { outline: 2px solid var(--pixel); outline-offset: 2px; }
.step-text { display: flex; flex-direction: column; line-height: 1.25; }
.step-label { font-size: 0.82rem; color: var(--graphite); }
.step-date { font-weight: 600; }

/* ---------- squares ---------- */
.sq { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; }
.sq-empty { display: block; aspect-ratio: 1; background: var(--tile); }
.section-h, .side-h {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1rem;
  margin: 0 0 12px;
}
.recent { margin-top: 64px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.tile { display: block; line-height: 0; }
.tile:hover .sq, .cell.has:hover .sq { outline: 2px solid var(--pixel); outline-offset: 2px; position: relative; z-index: 1; }
.more { font-family: var(--display); font-size: 0.92rem; margin: 14px 0 0; }

/* ---------- sidebar ---------- */
.sidebar { font-family: var(--display); }
.sidebar > section + section { margin-top: 40px; }
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.cal-head select {
  font: inherit; font-weight: 600; font-size: 0.95rem;
  color: var(--ink); background: transparent; border: 0; padding: 4px 2px; cursor: pointer;
}
.cal-head .cal-month { flex: 1; }
.cal-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border: 1px solid var(--rule); background: transparent; color: var(--ink);
  font: inherit; font-size: 1.1rem; cursor: pointer; border-radius: 2px;
}
.cal-btn:hover { border-color: var(--pixel); color: var(--pixel); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-wd { font-size: 0.72rem; color: var(--graphite); text-align: center; padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1; display: grid; place-items: center;
  background: var(--tile); font-size: 0.75rem; color: var(--graphite); text-decoration: none; line-height: 1;
}
.cal-day.out { background: transparent; }
.cal-day img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
a.cal-day:hover img { outline: 2px solid var(--pixel); outline-offset: 1px; z-index: 1; }
.cal-day.is-today { box-shadow: inset 0 0 0 2px var(--pixel); color: var(--pixel); font-weight: 700; }
.cal-day.is-today img { outline: 2px solid var(--pixel); outline-offset: 1px; }
.cal-foot { margin: 10px 0 0; font-size: 0.88rem; color: var(--graphite); min-height: 1.4em; }
.month-list { list-style: none; margin: 0; padding: 0; font-size: 0.95rem; }
.month-list li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--rule); }
.month-list a { text-decoration: none; }
.count { color: var(--graphite); font-variant-numeric: tabular-nums; font-size: 0.88em; font-weight: 400; }

/* ---------- month page ---------- */
.month-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 22px; }
.month-title {
  font-family: var(--display); font-weight: 750; letter-spacing: -0.03em;
  font-size: clamp(2.4rem, 6vw, 4.5rem); line-height: 0.95; margin: 0;
}
.month-title span { color: var(--graphite); font-weight: 400; }
.month-count { margin: 0; font-style: italic; color: var(--graphite); }
.mosaic { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mosaic-big { gap: 6px; font-family: var(--display); }
.mosaic-big .wd { font-size: 0.8rem; color: var(--graphite); padding-bottom: 4px; }
.mosaic .cell { position: relative; aspect-ratio: 1; background: var(--tile); display: block; text-decoration: none; }
/* Thumbnails fill their square without stretching the grid to the photo's own size */
.mosaic .cell .sq { position: absolute; inset: 0; }
.mosaic .cell.out { background: transparent; }
.mosaic-big .n {
  position: absolute; left: 6px; top: 6px; font-size: 0.8rem; line-height: 1;
  color: var(--graphite);
}
.mosaic-big .has .n { background: var(--paper); color: var(--ink); padding: 3px 5px; left: 0; top: 0; font-weight: 600; }
.mosaic-big .multi { position: absolute; right: 0; bottom: 0; background: var(--ink); color: var(--paper); font-size: 0.75rem; padding: 2px 6px; }
.mosaic .is-today { box-shadow: inset 0 0 0 2px var(--pixel); }
.mnav { display: flex; justify-content: space-between; margin-top: 28px; font-family: var(--display); }
.mnav a { display: flex; flex-direction: column; text-decoration: none; font-size: 0.85rem; color: var(--graphite); }
.mnav a span { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.mnav a:hover span { color: var(--pixel); }
.mnav-next { text-align: right; }

/* ---------- archives ---------- */
.year { margin-bottom: 56px; }
.year-title { font-family: var(--display); font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 18px; display: flex; align-items: baseline; gap: 14px; border-bottom: 1px solid var(--rule); padding-bottom: 8px; }
.year-title .count { font-size: 1rem; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px 26px; font-family: var(--display); }
.ym { display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 8px; }
.ym .mosaic { grid-column: 1 / -1; gap: 2px; }
.ym-name { font-weight: 600; font-size: 0.95rem; text-decoration: none; }
.ym.is-empty .ym-name { color: var(--graphite); font-weight: 400; }
.ym.is-empty .mosaic { opacity: 0.55; }

.about, .empty { max-width: 62ch; }
.foot {
  max-width: 1440px; margin: 80px auto 0; padding: 22px var(--gutter) 40px;
  font-family: var(--display); font-size: 0.85rem; color: var(--graphite);
}
.foot p { border-top: 1px solid var(--rule); padding-top: 18px; margin: 0; }

/* ---------- small screens ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 56px; }
  .sidebar { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 40px; }
  .sidebar > section + section { margin-top: 0; }
  .photo { max-height: none; }
}
@media (max-width: 640px) {
  .masthead { grid-template-columns: 1fr; padding-top: 20px; }
  .wordmark { height: 40px; }
  .tagline { margin: 0; }
  .post-text { grid-template-columns: 1fr; gap: 12px; }
  .dateblock { display: flex; align-items: flex-end; gap: 12px; }
  .day-num { font-size: 3.6rem; }
  .day-rest { margin: 0 0 2px; }
  .tiles { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .mosaic-big { gap: 3px; }
  .mosaic-big .wd { font-size: 0.68rem; }
  .mosaic-big .n { font-size: 0.68rem; }
  .step-img { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
.mosaic .has.is-today .sq { outline: 3px solid var(--pixel); outline-offset: -3px; }
