/* Weekend Ledger: dark ink-and-citrus direction, system fonts only */
:root {
  --ink: #15161b;
  --panel: #1d1f27;
  --panel-2: #262932;
  --line: #3a3e4b;
  --text: #f2f0ea;
  --muted: #b3b6c2;
  --accent: #d4ff5a;
  --accent-ink: #15161b;
  --warn: #ffb3a1;
  --serif: Charter, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { background: var(--ink); color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(212, 255, 90, 0.06), transparent 320px),
    var(--ink);
  min-height: 100vh;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 6px;
  z-index: 10;
}
.skip-link:focus { top: 12px; }

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 40px;
  border-bottom: 1px solid var(--line);
}

.brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dates {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 32px;
  padding: 32px 40px 64px;
  max-width: 1280px;
  margin: 0 auto;
}

.controls {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 18px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="search"],
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font: inherit;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

input[type="search"]::placeholder { color: #8a8e9b; }

select {
  appearance: auto;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.toggle .switch {
  flex: none;
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.toggle .switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease;
}

.toggle[aria-pressed="true"] {
  border-color: var(--accent);
}

.toggle[aria-pressed="true"] .switch {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle[aria-pressed="true"] .switch::after {
  background: var(--accent-ink);
  transform: translateX(18px);
}

.count {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
}

.saved-note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
}

.list-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.item.is-saved {
  border-color: var(--accent);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.tag {
  color: var(--accent);
}

.item h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 600;
}

.item p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.item-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 8px;
}

.saved-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.btn {
  min-height: 44px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--muted);
  border-radius: 999px;
  cursor: pointer;
}

.btn:hover { border-color: var(--text); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.empty-state {
  padding: 40px 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 24px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--muted);
}

/* Detail dialog */
dialog.detail-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

dialog.detail-dialog::backdrop {
  background: rgba(8, 9, 12, 0.72);
}

.detail-inner {
  padding: 28px 32px 32px;
  overflow-y: auto;
  max-height: calc(100vh - 48px);
}

.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.detail-top h2 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1.15;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
  margin: 24px 0;
  padding: 0;
}

.facts div { min-width: 0; }

.facts dt {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.facts dd {
  margin: 2px 0 0;
  font-size: 16px;
}

.detail-body {
  white-space: pre-line;
  margin: 0 0 16px;
  font-size: 17px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.detail-actions .save-item {
  flex: 1 1 260px;
}

.save-item[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Responsive */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 24px 56px;
  }
  .controls {
    position: static;
  }
  .events {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .masthead { padding: 16px 20px; }
  .layout { padding: 20px 16px 48px; }
  .brand { font-size: 22px; }
  .list-head h2 { font-size: 28px; }
  .detail-inner { padding: 24px 20px 28px; }
  .detail-top h2 { font-size: 26px; }
  .facts { grid-template-columns: 1fr; }
}

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