/* Weekend Almanac — editorial warm-paper theme */

@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f6f1e6;
  --paper-raised: #fdfaf2;
  --ink: #23201a;
  --ink-soft: #5c564a;
  --ink-faint: #8a8271;
  --line: #ddd3bf;
  --line-strong: #b9ad93;
  --accent: #b04a24;
  --accent-ink: #8f3a1a;
  --accent-soft: #f3e0d4;
  --shadow: 0 1px 2px rgba(35, 32, 26, 0.06), 0 8px 24px rgba(35, 32, 26, 0.07);
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(176, 74, 36, 0.05), rgba(176, 74, 36, 0) 240px),
    var(--paper);
  color: var(--ink);
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
}

.shell {
  max-width: 1040px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

h1, h2, h3 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; }
h1, h2, h3 { text-wrap: balance; }

button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  transition: top 160ms ease;
}
.skip-link:focus { top: 12px; }

/* ---------- Masthead ---------- */

.masthead {
  padding: clamp(28px, 5vw, 56px) 0 8px;
  border-bottom: 3px double var(--line-strong);
}
.masthead-kicker {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.masthead-title {
  margin: 0;
  font-size: clamp(40px, 7vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.01em;
}
.masthead-dates {
  margin: 10px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.masthead-note {
  margin: 14px 0 0;
  max-width: 56ch;
  color: var(--ink-soft);
  text-wrap: pretty;
}

/* ---------- Toolbar ---------- */

.toolbar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(150px, 0.7fr) auto;
  grid-template-areas: "search filter saved" "count count count";
  gap: 10px 14px;
  align-items: end;
}

.label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 4px;
}

.field--search { grid-area: search; min-width: 0; }
.field--filter { grid-area: filter; min-width: 0; }
.field--saved { grid-area: saved; }

.search-box { position: relative; }
.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  translate: 0 -50%;
  color: var(--ink-faint);
  pointer-events: none;
}

input[type="search"], select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 9px 12px;
}
input[type="search"] { padding-left: 34px; }
input[type="search"]::placeholder { color: var(--ink-faint); }
input[type="search"]:hover, select:hover { border-color: var(--ink-faint); }
select { appearance: none; padding-right: 30px; }
.field--filter { position: relative; }
.field--filter::after {
  content: "";
  position: absolute;
  right: 12px;
  bottom: 16px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--ink-soft);
  border-bottom: 1.5px solid var(--ink-soft);
  rotate: 45deg;
  pointer-events: none;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 15px;
  padding: 9px 13px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.saved-toggle:hover { border-color: var(--accent); color: var(--accent-ink); }
.saved-toggle[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.count {
  grid-area: count;
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- List ---------- */

main { padding: 8px 0 56px; }

.day-section { margin-top: 28px; }
.day-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 14px;
}
.day-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}
.day-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--ink-faint);
}
.day-rule {
  flex: 1;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  align-self: center;
}

.card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  scroll-margin-top: 110px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card-thumb {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--accent-soft);
  display: block;
}

.card-body { min-width: 0; }

.card-heading { margin: 0; min-width: 0; }

.card-title {
  font: inherit;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 21px;
  line-height: 1.25;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 4px;
  cursor: pointer;
  text-align: left;
  text-wrap: balance;
}
.card-title:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.card-meta {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

.card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  align-self: start;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--ink-faint));
}

.tag--music { --dot: #6b4d8f; }
.tag--art { --dot: #b04a24; }
.tag--food { --dot: #6d7a2e; }
.tag--literature { --dot: #2e6e6a; }
.tag--outdoors { --dot: #3d6b3f; }
.tag--walks { --dot: #4a5f8a; }
.tag--film { --dot: #8f3b52; }

.price {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
  white-space: nowrap;
}

.card-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.card-save:hover { border-color: var(--accent); color: var(--accent-ink); }
.card-save[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Empty state ---------- */

.empty {
  margin: 48px auto;
  max-width: 460px;
  text-align: center;
  padding: 32px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  scroll-margin-top: 110px;
}
.empty-mark { font-size: 28px; color: var(--accent); margin: 0 0 6px; }
.empty-title { margin: 0 0 8px; font-size: 26px; }
.empty-copy { margin: 0 0 18px; color: var(--ink-soft); text-wrap: pretty; }

.btn {
  font: inherit;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--ink);
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--accent); border-color: var(--accent); }

/* ---------- Footer ---------- */

.footer {
  border-top: 3px double var(--line-strong);
  padding: 24px 0 40px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.footer p { margin: 4px 0; }

/* ---------- Detail dialog ---------- */

.detail {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 0;
  margin: 0 0 0 auto;
  width: min(560px, 100vw);
  height: 100dvh;
  max-height: none;
  max-width: none;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: -12px 0 40px rgba(35, 32, 26, 0.18);
  overscroll-behavior: contain;
}
.detail:focus { outline: none; }
.detail::backdrop { background: rgba(35, 32, 26, 0.45); }

.detail[open] { animation: sheet-in 260ms ease; }
@keyframes sheet-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.sheet {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px clamp(18px, 4vw, 32px) calc(48px + env(safe-area-inset-bottom));
}

.sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.icon-btn:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.detail-figure { margin: 0 0 18px; }
.detail-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--accent-soft);
  display: block;
}
.detail-caption {
  margin-top: 6px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--ink-faint);
}

.detail-title { margin: 0 0 6px; font-size: clamp(28px, 4vw, 36px); line-height: 1.1; }
.detail-meta {
  margin: 0 0 18px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin: 0 0 18px;
}
.facts > div { background: var(--paper-raised); padding: 10px 12px; }
.facts dt {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 2px;
}
.facts dd { margin: 0; font-size: 14.5px; font-variant-numeric: tabular-nums; }

.btn--save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-raised);
  color: var(--ink);
  width: 100%;
  justify-content: center;
  padding: 12px 18px;
  margin-bottom: 22px;
}
.btn--save:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn--save[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--save[aria-pressed="true"]:hover { background: var(--accent-ink); }

.detail-body p {
  margin: 0 0 14px;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: break-word;
}
.detail-body p:first-child { font-size: 18px; color: var(--ink); text-wrap: pretty; }

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "search filter" "saved count";
    align-items: center;
  }
  .field--saved { justify-self: start; }
  .count { justify-self: end; align-self: center; }

  .card {
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-areas: "thumb body" "side side";
    row-gap: 8px;
  }
  .card-thumb { grid-area: thumb; width: 64px; height: 64px; }
  .card-body { grid-area: body; }
  .card-side {
    grid-area: side;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  .card-save { width: 34px; height: 34px; }

  .detail {
    width: 100vw;
    margin: 0;
    height: 92dvh;
    margin-top: auto;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 40px rgba(35, 32, 26, 0.25);
  }
  .detail[open] { animation: sheet-up 260ms ease; }
  @keyframes sheet-up {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
}

@media (max-width: 400px) {
  .facts { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .detail[open] { animation: none; }
  .skip-link { transition: none; }
  .card, .saved-toggle, .btn, .icon-btn, .card-save {
    transition: none;
  }
}
