/* ============================================================
   Weekend Board — enamel wayside over ruled ivory paper
   ============================================================ */

@font-face {
  font-family: 'Oswald';
  src: url('assets/oswald.ttf') format('truetype');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('assets/dm-sans.ttf') format('truetype');
  font-weight: 100 1000;
  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 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #F5F2E9;
  --paper-2: #FBF9F1;
  --paper-3: #ECE8D8;
  --ink: #20201B;
  --ink-2: #5B594E;
  --green: #1E4B38;
  --green-deep: #143529;
  --green-soft: #E3EBE2;
  --hairline: #DAD4C0;
  --hairline-2: #C9C2AA;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font-display: 'Oswald', 'Arial Narrow', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', monospace;
  --hour: 30px;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

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

::selection { background: rgba(30, 75, 56, .22); }
input, select, textarea { caret-color: var(--green); }

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--green);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 500;
  text-decoration: none;
}
.skip:focus { left: 0; }

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

.masthead {
  background: var(--green);
  color: var(--paper);
}

.masthead-inner {
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding-top: 22px;
  padding-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-right: auto;
}

.mark { width: 26px; height: 26px; fill: var(--paper); flex: none; }

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: .05em;
  text-transform: uppercase;
  line-height: 1;
}

.masthead-dates {
  margin: 0;
  font-size: 13.5px;
  color: rgba(245, 242, 233, .85);
  letter-spacing: .02em;
}

.masthead-saved {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: rgba(245, 242, 233, .85);
  border: 1px solid rgba(245, 242, 233, .35);
  border-radius: 99px;
  padding: 4px 12px;
  white-space: nowrap;
}

.masthead-rail {
  height: 9px;
  border-top: 1px solid rgba(245, 242, 233, .18);
  background: repeating-linear-gradient(90deg,
    rgba(245, 242, 233, .38) 0 1px,
    transparent 1px 22px);
}

/* ---------- Controls bar ---------- */

.controls {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 1px 0 rgba(32, 32, 27, .02);
}

.controls-inner {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.field { display: flex; flex-direction: column; gap: 4px; }

.field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-2);
}

.field-search { flex: 1 1 260px; max-width: 380px; }

.search-wrap, .select-wrap { position: relative; }

.field-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}

input[type="search"] {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--hairline-2);
  border-radius: 9px;
  background: var(--paper-2);
  font: inherit;
  color: var(--ink);
}
input[type="search"]::placeholder { color: #6E6B5D; }
input[type="search"]:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}
input[type="search"]::-webkit-search-cancel-button { color: var(--ink-2); }

.field-cat { flex: 0 1 auto; }

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  height: 40px;
  min-width: 190px;
  width: 100%;
  padding: 0 36px 0 12px;
  border: 1px solid var(--hairline-2);
  border-radius: 9px;
  background: var(--paper-2);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--hairline-2);
  border-radius: 99px;
  background: var(--paper-2);
  font-weight: 500;
  font-size: 14px;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}

.saved-toggle .star {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.saved-toggle .badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(32, 32, 27, .08);
  border-radius: 99px;
  padding: 1px 8px;
}

.saved-toggle[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--paper);
}
.saved-toggle[aria-pressed="true"] .star { fill: var(--paper); stroke: var(--paper); }
.saved-toggle[aria-pressed="true"] .badge { background: rgba(245, 242, 233, .22); }
.saved-toggle:hover { border-color: var(--green); }

.count {
  margin: 0 0 0 auto;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 99px;
  background: transparent;
  color: var(--green);
  font-weight: 500;
  font-size: 13.5px;
}
.clear-btn svg { width: 14px; height: 14px; }
.clear-btn:hover { background: var(--green-soft); }
.clear-btn:focus-visible { outline-offset: 0; }

/* ---------- Category hues ---------- */

.cat-Art        { --c: #A63047; }
.cat-Film       { --c: #2E5FA3; }
.cat-Food       { --c: #99650F; }
.cat-Literature { --c: #5F4DA8; }
.cat-Music      { --c: #176E77; }
.cat-Outdoors   { --c: #4A7A2E; }
.cat-Walks      { --c: #96502A; }

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c, var(--ink));
  flex: none;
}

/* ---------- Board ---------- */

.board-section { padding-top: 34px; }

.board-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.15;
}

.board-hint {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-2);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--hairline-2);
  border-radius: 99px;
  background: var(--paper-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.legend-chip .dot { width: 9px; height: 9px; }
.legend-chip:hover { border-color: var(--ink-2); }
.legend-chip[aria-pressed="true"] {
  background: var(--green);
  border-color: var(--green);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--green);
}

.board {
  display: grid;
  grid-template-columns: 52px 1fr 1fr;
  gap: 0 16px;
  margin-bottom: 42px;
}

.board-dayname {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-bottom: 8px;
}

.hour-rail {
  position: relative;
  height: calc(14 * var(--hour));
}

.hour-rail .hour {
  position: absolute;
  right: 10px;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-2);
  white-space: nowrap;
}

.day-track {
  position: relative;
  height: calc(14 * var(--hour));
  background: var(--paper-2);
  border-top: 1px solid var(--hairline-2);
  border-bottom: 1px solid var(--hairline-2);
  background-image: repeating-linear-gradient(to bottom,
    var(--hairline) 0 1px,
    transparent 1px var(--hour));
  border-radius: 2px;
}

.block {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 1px;
  padding: 4px 7px;
  border: 0;
  border-radius: 6px;
  background: var(--c, var(--ink));
  color: #fff;
  text-align: left;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(32, 32, 27, .22);
  transition: filter .15s var(--ease);
}
.block:hover { filter: brightness(1.08); }
.block:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

.b-time {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  opacity: .92;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.b-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 11.5px;
  line-height: 1.15;
  letter-spacing: .015em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.b-star { width: 9px; height: 9px; fill: currentColor; flex: none; }

.block.is-saved {
  box-shadow: 0 1px 2px rgba(32, 32, 27, .22),
              inset 0 0 0 2px var(--green-deep);
  outline: 2px solid var(--green-deep);
  outline-offset: -4px;
}

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

.list-section { padding-bottom: 20px; }

.load-error {
  padding: 18px 4px;
  color: var(--ink-2);
  max-width: 60ch;
}

.day-group { margin-bottom: 26px; }

.day-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 2px;
  padding: 10px 0 8px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.day-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: .02em;
  color: var(--ink-2);
  text-transform: none;
}

.rows { list-style: none; margin: 0; padding: 0; }

.row-item + .row-item { border-top: 1px solid var(--hairline); }

.row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 4px 18px;
  width: 100%;
  padding: 13px 8px;
  background: transparent;
  border: 0;
  text-align: left;
  transition: background-color .15s var(--ease);
}
.row:hover { background: var(--paper-2); }
.row:focus-visible { outline-offset: -2px; }

.row-time {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
}
.row-time b { font-weight: 700; color: var(--ink); }

.row-main { min-width: 0; }

.row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17.5px;
  line-height: 1.2;
  letter-spacing: .01em;
}

.saved-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 99px;
  padding: 1.5px 9px 1.5px 7px;
}
.saved-flag svg { width: 10px; height: 10px; fill: var(--green); }

.row-meta {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--ink-2);
}

.row-side {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.row-price {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}
.row-price.is-free { color: var(--green); }

.row-arrow {
  width: 16px;
  height: 16px;
  color: var(--hairline-2);
  transition: transform .15s var(--ease), color .15s var(--ease);
}
.row:hover .row-arrow { color: var(--green); transform: translateX(2px); }

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

.empty {
  max-width: 520px;
  margin: 28px auto;
  padding: 36px 28px;
  background: var(--paper-2);
  border: 1px dashed var(--hairline-2);
  border-radius: 14px;
  text-align: center;
}
.empty[hidden] { display: none; }

.empty-icon { width: 44px; height: 44px; color: var(--ink-2); }

.empty h3 {
  margin: 12px 0 6px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.empty p { margin: 0 auto 18px; color: var(--ink-2); max-width: 38ch; }

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  background: var(--green);
  border: 1px solid var(--green);
  border-radius: 99px;
  color: var(--paper);
  font-weight: 600;
  font-size: 14.5px;
  transition: background-color .15s var(--ease);
}
.primary-btn:hover { background: var(--green-deep); border-color: var(--green-deep); }

/* ---------- Detail sheet ---------- */

.detail {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  left: auto;
  margin: 0;
  height: 100%;
  width: min(520px, 100%);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.detail[open] { animation: sheet-in .32s var(--ease) both; }

@keyframes sheet-in {
  from { transform: translateX(4%); opacity: .35; }
  to { transform: none; opacity: 1; }
}

.detail::backdrop {
  background: rgba(16, 34, 26, .52);
}

.detail-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--paper);
  box-shadow: -14px 0 34px rgba(15, 42, 31, .3);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--hairline-2) transparent;
}

.detail-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--green);
  color: var(--paper);
}

.detail-top :focus-visible { outline-color: var(--paper); }

.detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(245, 242, 233, .4);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  transition: background-color .15s var(--ease);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: rgba(245, 242, 233, .16); }

.detail-content { padding: 24px 24px 28px; }

.detail-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 27px;
  line-height: 1.12;
  letter-spacing: .005em;
}

.detail-when {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--ink-2);
}

.when-time { font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); }

.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin: 0 0 22px;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
}

.detail-facts dt {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 2px;
}

.detail-facts dd {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
}
.detail-facts dd.mono { font-family: var(--font-mono); font-weight: 600; }

.detail-body p {
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.62;
  max-width: 62ch;
}

.detail-body p.lead { font-size: 16px; font-weight: 500; }

.access-note {
  display: flex;
  gap: 12px;
  background: var(--paper-3);
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 6px 0 16px;
}

.access-note svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  color: var(--green);
}

.note-title {
  margin: 0 0 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--green);
}

.access-note p:last-child { margin: 0; font-size: 14px; line-height: 1.55; }

.save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 48px;
  margin-top: 8px;
  background: var(--green);
  border: 1.5px solid var(--green);
  border-radius: 10px;
  color: var(--paper);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}

.save-btn .star {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.save-btn.is-saved {
  background: var(--paper-2);
  border-color: var(--green);
  color: var(--green);
}
.save-btn.is-saved .star { fill: var(--green); stroke: var(--green); }
.save-btn:hover { filter: brightness(1.05); }

.star.pop { animation: star-pop .38s var(--ease); }

@keyframes star-pop {
  0% { transform: scale(.55); }
  55% { transform: scale(1.3) rotate(12deg); }
  100% { transform: none; }
}

/* ---------- Deal-in animation (the authored moment) ---------- */

.deal { animation: deal .3s var(--ease) backwards; }

@keyframes deal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

.foot {
  border-top: 1px solid var(--hairline);
  margin-top: 26px;
  padding: 22px 24px 36px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.foot p { margin: 0 0 3px; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .board { grid-template-columns: 44px 1fr 1fr; gap: 0 10px; }
  .row { grid-template-columns: 92px minmax(0, 1fr) auto 18px; gap: 4px 12px; }
}

@media (max-width: 640px) {
  :root { --hour: 24px; }

  .masthead-inner { flex-wrap: wrap; gap: 8px 14px; padding-top: 16px; padding-bottom: 14px; }
  .wordmark { font-size: 19px; }
  .masthead-dates { order: 3; flex-basis: 100%; font-size: 12.5px; }

  .controls-inner { padding-top: 10px; padding-bottom: 10px; gap: 8px 14px; }
  .field-search { max-width: none; }
  .field-cat { flex: 1 1 auto; }
  .select-wrap select { min-width: 0; width: 100%; }
  .count { order: 5; margin-left: 0; }

  .board { grid-template-columns: 34px 1fr 1fr; gap: 0 8px; margin-bottom: 30px; }
  .board-head { align-items: flex-start; flex-direction: column; margin-bottom: 12px; }
  .b-title { -webkit-line-clamp: 2; }
  .block { padding: 2px 5px; border-radius: 5px; }
  .b-time { font-size: 9px; }
  .b-title { font-size: 10.5px; }
  .hour-rail .hour { font-size: 9px; right: 6px; }

  .row {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-areas:
      "time main"
      "time side";
    row-gap: 6px;
    padding: 12px 6px;
  }
  .row-time { grid-area: time; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
  .row-main { grid-area: main; }
  .row-side { grid-area: side; justify-self: start; gap: 12px; }
  .row-arrow { display: none; }
  .row-title { font-size: 16.5px; }

  .detail { width: 100%; }
  .detail-content { padding: 20px 18px 24px; }
  .detail-facts { grid-template-columns: 1fr; gap: 10px; }
  .detail-title { font-size: 24px; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
