/* ===== Fonts (self-hosted) ===== */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-latin-700-italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ===== Tokens ===== */
:root {
  --cream: #fff8ee;
  --paper: #fffdf9;
  --pink-50: #fff1f3;
  --pink-100: #ffe3e8;
  --pink-200: #fcc8d3;
  --pink-300: #f4a3b5;
  --berry: #c81d3a;
  --berry-dark: #9b1530;
  --berry-deep: #6e1024;
  --leaf: #6fb06a;
  --leaf-100: #e4f2df;
  --leaf-dark: #3c7139;
  --ink: #45222a;
  --ink-soft: #74474f;
  --field-border: #a8707b;
  --line: #efd3d9;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 4px 4px 0 var(--pink-200);
  --shadow-strong: 6px 6px 0 var(--pink-300);
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html:has(dialog[open]) {
  overflow: hidden;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--berry-deep);
}
h2 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
}
h3 {
  font-size: 1.35rem;
}
p {
  margin: 0 0 1em;
}
img,
svg {
  display: block;
  max-width: 100%;
}
a {
  color: var(--berry-dark);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}
a:hover {
  color: var(--berry-deep);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
::selection {
  background: var(--pink-200);
  color: var(--ink);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-200%);
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.skip-link:focus {
  transform: none;
  color: #fff;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.icon {
  width: 1.2em;
  height: 1.2em;
  flex: none;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--leaf-dark);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0.65rem 1.25rem;
  border: 2px solid var(--berry-deep);
  border-radius: 8px;
  background: var(--berry);
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--berry-deep);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.15s;
}
.btn:hover {
  color: #fff;
  background: var(--berry-dark);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--berry-deep);
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--berry-deep);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}
.btn--ghost {
  background: var(--paper);
  color: var(--berry-dark);
  border-color: var(--berry-dark);
  box-shadow: 3px 3px 0 var(--pink-300);
}
.btn--ghost:hover {
  background: var(--pink-50);
  color: var(--berry-deep);
  box-shadow: 4px 4px 0 var(--pink-300);
}
.btn--ghost:active {
  box-shadow: 1px 1px 0 var(--pink-300);
}
.btn--block {
  width: 100%;
}
.btn--sm {
  min-height: 2.4rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.95rem;
  box-shadow: 2px 2px 0 var(--berry-deep);
}
.btn--ghost.btn--sm {
  box-shadow: 2px 2px 0 var(--pink-300);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid var(--berry-dark);
  border-radius: 8px;
  background: var(--paper);
  color: var(--berry-dark);
}
.icon-btn:hover {
  background: var(--pink-50);
}

/* ===== Badges & tags ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--pink-100);
  color: var(--berry-deep);
}
.badge .icon {
  width: 1rem;
  height: 1rem;
}
.badge--playlist {
  background: var(--leaf-100);
  color: #2f5a2c;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag {
  padding: 0.1rem 0.55rem;
  border: 1.5px solid var(--pink-300);
  border-radius: 4px;
  background: var(--paper);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ===== Forms ===== */
.field {
  margin: 0 0 1.35rem;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field > label,
.field > legend {
  display: block;
  margin-bottom: 0.35rem;
  padding: 0;
  font-weight: 700;
}
.optional {
  font-weight: 400;
  color: var(--ink-soft);
}
.hint {
  margin: -0.2rem 0 0.5rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
input[type="text"],
input[type="url"],
input[type="search"],
input[type="password"],
select,
textarea {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--field-border);
  border-radius: var(--radius-sm);
  background: #fff;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea {
  resize: vertical;
  min-height: 8rem;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--berry);
  box-shadow: 0 0 0 3px var(--pink-200);
}
[aria-invalid="true"] {
  border-color: var(--berry) !important;
  background: #fff7f8;
}
.field-error {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--berry-dark);
}
.field-error:empty {
  display: none;
}
.field-error::before {
  content: "! ";
}
.char-count {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: right;
}
.form-error {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 2px solid var(--berry);
  border-radius: var(--radius-sm);
  background: var(--pink-50);
  color: var(--berry-deep);
  font-weight: 700;
}

/* Selectable chips (checkbox / radio inside a label) */
.tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.pick {
  position: relative;
}
.pick input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.pick span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.8rem;
  border: 2px solid var(--field-border);
  border-radius: 6px;
  background: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s;
}
.pick span::before {
  content: "+";
  font-weight: 700;
  color: var(--ink-soft);
}
.pick input:checked + span {
  border-color: var(--berry-dark);
  background: var(--pink-100);
  color: var(--berry-deep);
  font-weight: 700;
}
.pick input:checked + span::before {
  content: "\2713";
  color: var(--berry-dark);
}
.pick input:focus-visible + span {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.pick input:disabled + span {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Honeypot */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ===== Dialog base ===== */
dialog.modal {
  width: min(40rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
dialog.modal::backdrop {
  background: rgba(69, 34, 42, 0.55);
}
.modal__paper {
  position: relative;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 2rem 1.75rem 1.75rem;
  border: 2px solid var(--berry-dark);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--pink-300);
}
.modal__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
}
dialog.modal[open] {
  animation: modal-in 0.22s var(--ease);
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  z-index: 200;
  transform: translateX(-50%);
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1.1rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  box-shadow: 4px 4px 0 var(--pink-300);
}
.toast:empty {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
