/* Ønskeskyen: varmt papir, terrakotta og mos. Kun systemfonte. */

:root {
  color-scheme: light dark;

  --bg: #fbf6ef;
  --hero: #f6e3d1;
  --hero-ink: #4a2f20;
  --surface: #fffdf9;
  --surface-dim: #f1eae0;
  --ink: #33291f;
  --muted: #68594a;
  --line: #e4d6c4;
  --field-line: #94806b;
  --accent: #a8482c;
  --accent-hover: #8f3b22;
  --accent-ink: #ffffff;
  --heart: #a52f42;
  --heart-bg: #fbe6e4;
  --moss: #2f6340;
  --moss-bg: #e6f0e4;
  --danger: #a3262f;
  --danger-hover: #861e26;
  --danger-ink: #ffffff;
  --shadow: 0 1px 2px rgba(74, 47, 32, 0.08), 0 8px 22px rgba(74, 47, 32, 0.08);
  --toast-bg: #33291f;
  --toast-ink: #fdf8f1;
  --toast-error-bg: #7d1f28;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: max(16px, 4vw);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1915;
    --hero: #33281f;
    --hero-ink: #f6e3d1;
    --surface: #2a231d;
    --surface-dim: #231d18;
    --ink: #f3eadf;
    --muted: #c3b5a4;
    --line: #443a30;
    --field-line: #8b7b6a;
    --accent: #eda383;
    --accent-hover: #f5b79c;
    --accent-ink: #2a160d;
    --heart: #f3a3ae;
    --heart-bg: #45262a;
    --moss: #a8d3b1;
    --moss-bg: #243528;
    --danger: #f09a9f;
    --danger-hover: #f7b6b9;
    --danger-ink: #2c0d0f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.25);
    --toast-bg: #f3eadf;
    --toast-ink: #2a231d;
    --toast-error-bg: #f5bcbf;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-hover);
}

img {
  display: block;
  max-width: 100%;
}

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

h2:focus {
  outline: none;
}

.sprite {
  position: absolute;
}

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

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

/* ---------- Top med skykant ---------- */

.hero {
  position: relative;
  background: var(--hero);
  color: var(--hero-ink);
  padding: 22px var(--gutter) 16px;
  margin-bottom: 36px;
}

@media (min-width: 720px) {
  .hero {
    padding: 32px var(--gutter) 26px;
    margin-bottom: 44px;
  }
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -18px;
  height: 18px;
  background: radial-gradient(circle at 26px -8px, var(--hero) 27px, transparent 28px) 0 0 / 52px 18px repeat-x;
}

.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  margin-bottom: 8px;
}

.hero h1 {
  font-size: clamp(1.8rem, 7vw, 3rem);
  letter-spacing: -0.01em;
}

.intro {
  margin-top: 12px;
  white-space: pre-line;
  font-size: 1.1rem;
}

/* ---------- Indhold ---------- */

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter) 96px;
}

/* Kort forklaring under toppen, detaljer i en fold-ud */
.lead {
  max-width: 640px;
  margin: 0 auto 20px;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}

.lead .note {
  display: inline;
}

.how {
  display: inline;
}

.how > summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-left: 0.3em;
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
  list-style: none;
}

.how > summary::-webkit-details-marker {
  display: none;
}

.how > summary::after {
  content: " +";
  white-space: pre;
}

.how[open] > summary::after {
  content: " −";
}

.how ul {
  display: block;
  margin: 8px 0 0;
  padding: 12px 16px 12px 32px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.how li + li {
  margin-top: 4px;
}

.notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
}

.section-heading {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.stack > * + * {
  margin-top: 6px;
}

.offscreen {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------- Personer ---------- */

.monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
}

.tint-0 { background: #f6d9c8; color: #7a2f17; }
.tint-1 { background: #d9e8d4; color: #234d31; }
.tint-2 { background: #f3e2b8; color: #694a0b; }
.tint-3 { background: #ead8e6; color: #5c2a55; }

@media (prefers-color-scheme: dark) {
  .tint-0 { background: #5a3324; color: #fbd9c7; }
  .tint-1 { background: #2f4733; color: #d3ebd5; }
  .tint-2 { background: #54431d; color: #f6e3b4; }
  .tint-3 { background: #4c2f49; color: #f0d7ec; }
}

.person-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

.person-card {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  padding: 18px 18px 18px 20px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.person-card:hover {
  color: var(--ink);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.person-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.person-name {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.25;
}

.person-count {
  color: var(--muted);
  font-size: 0.95rem;
}

.person-card .monogram {
  width: 64px;
  height: 64px;
  font-size: 2rem;
}

.person-card .person-name {
  font-size: 1.5rem;
}

.person-card > .icon {
  width: 1.6em;
  height: 1.6em;
  color: var(--accent);
}

.share-main input {
  font-weight: 600;
}

.direct-link {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.9rem;
}

.btn-link.btn-inline {
  display: inline;
  min-height: 0;
  padding: 0;
  border: 0;
  font: inherit;
  font-size: inherit;
  cursor: pointer;
}

.person-nav {
  margin-bottom: 14px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  min-height: 44px;
  font-weight: 600;
}

/* Vandret række af navne, der kan rulle på mobilen */
.switch-row {
  position: relative;
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 2px 8px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.switch-row > li {
  flex: none;
}

.switch-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 18px;
  border: 2px solid var(--field-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.switch-pill:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* Valgt person: fyldt, fed og med flueben, så det ikke kun er farven, der viser det */
.switch-pill[aria-current="page"],
.switch-pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.switch-pill[aria-current="page"]::before,
.switch-pill[aria-pressed="true"]::before {
  content: "✓ ";
  white-space: pre;
}

.person-rows {
  list-style: none;
  margin: 12px 0 4px;
  padding: 0;
}

.person-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 14px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.person-row:first-child {
  border-top: 0;
}

.person-row .monogram {
  width: 44px;
  height: 44px;
  font-size: 1.35rem;
}

.person-info .person-name {
  font-size: 1.15rem;
}

.person-actions {
  grid-column: 1 / -1;
}

@media (min-width: 720px) {
  .person-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .person-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
}

.prompt {
  margin: 8px 0 4px;
  padding: 14px 16px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
  font-weight: 500;
}

.add-list {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.add-list .field {
  margin-bottom: 0;
}

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

.toolbar h2 {
  font-size: 1.5rem;
}

.toolbar .muted {
  font-size: 0.95rem;
}

.message {
  max-width: 560px;
  margin: 32px auto;
  padding: 24px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--field-line);
  border-radius: 18px;
}

.message .btn {
  margin-top: 14px;
}

.site-footer {
  padding: 0 var(--gutter) 88px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Kort ---------- */

.wish-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.card-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-dim);
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 18px 18px;
}

.card-title {
  font-size: 1.3rem;
}

.card-price {
  font-weight: 600;
}

.card-description {
  white-space: pre-line;
  color: var(--muted);
}

.clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.store-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 4px 0;
  font-weight: 500;
}

.store-link .icon {
  width: 0.95em;
  height: 0.95em;
}

.card-state {
  width: 100%;
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 2px 10px 2px 8px;
  border-radius: 999px;
  background: var(--heart-bg);
  color: var(--heart);
  font-size: 0.875rem;
  font-weight: 600;
}

.state {
  display: flex;
  align-items: center;
  gap: 0.45em;
  font-weight: 600;
}

.state-mine {
  color: var(--moss);
}

.state-taken {
  color: var(--muted);
}

.state-free {
  color: var(--muted);
  font-weight: 500;
}

/* Reserveret af en anden: dæmpet, men teksten bevarer sin kontrast. */
.card-taken {
  background: var(--surface-dim);
  box-shadow: none;
  border-style: dashed;
  border-color: var(--field-line);
}

.card-taken .card-media img {
  filter: grayscale(0.7) opacity(0.65);
}

.card-taken .card-title {
  color: var(--muted);
}

.card-taken .badge {
  background: transparent;
  color: var(--muted);
  padding-left: 0;
}

/* Reserveret af dig */
.card-mine {
  border: 2px solid var(--moss);
  background: var(--surface);
}

.card-mine .card-state {
  margin-top: auto;
}

.card-mine .state {
  background: var(--moss-bg);
  padding: 8px 12px;
  border-radius: 10px;
}

/* ---------- Ejersiden ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel > h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.panel p + .field,
.panel .hint + .field {
  margin-top: 12px;
}

.panel .field + p {
  margin-top: 10px;
}

.gate {
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.gate form {
  margin-top: 16px;
}

.gate > h2 {
  margin-bottom: 10px;
}

.gate .notice {
  margin-bottom: 12px;
}

.gate-form .btn-primary {
  width: 100%;
  margin-top: 4px;
}

.gate-foot {
  margin-top: 16px;
}

.gate .btn-secondary {
  margin-top: 12px;
}

.gate p + p {
  margin-top: 8px;
}

input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1.5px solid var(--field-line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

.session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: -12px 0 16px;
  color: var(--muted);
}

.session-bar strong {
  color: var(--ink);
}

.user-rows {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
}

.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.user-row:first-child {
  border-top: 0;
}

.user-info .person-name {
  font-size: 1.15rem;
}

.me-tag {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--muted);
}

.state-pending {
  color: var(--accent);
  font-size: 0.95rem;
}

.state-pending::before {
  content: "• ";
}

.invite-result {
  margin-top: 16px;
  padding: 16px;
  border: 2px dashed var(--accent);
  border-radius: 14px;
}

.invite-result h3 {
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.invite-result h3:focus {
  outline: none;
}

.gate .button-row {
  margin-top: 14px;
}

details.panel > summary {
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 600;
  min-height: 28px;
}

.details-body {
  margin-top: 14px;
}

.copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.copy-row input {
  flex: 1 1 200px;
  min-width: 0;
}

.reveal-row {
  margin-bottom: 18px;
}

.forget-row {
  margin-top: 32px;
  text-align: center;
}

.admin-card .media-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background: var(--hero);
  color: var(--bg);
  font-size: 3rem;
}

.admin-card .media-empty .icon {
  opacity: 0.85;
}

.card-reserved {
  border-style: dashed;
  border-color: var(--field-line);
}

.admin-card .state-taken {
  color: var(--ink);
}

/* På telefonen er kortene vandrette, så listen ikke bliver alenlang. */
@media (max-width: 559px) {
  .admin-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .admin-card .card-media {
    padding: 14px 0 0 14px;
  }

  .admin-card .card-media img,
  .admin-card .media-empty {
    aspect-ratio: 1;
    border-radius: 10px;
    font-size: 2rem;
  }

  .admin-card .card-body {
    padding: 14px;
  }

  .admin-card .card-title {
    font-size: 1.15rem;
  }
}

/* ---------- Knapper ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 44px;
  padding: 8px 18px;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-wide {
  width: 100%;
}

.btn-small {
  padding: 6px 14px;
  font-size: 1rem;
}

.btn-icon {
  min-width: 44px;
  padding: 6px 10px;
}

.btn-icon .icon {
  width: 1.25em;
  height: 1.25em;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--field-line);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-dim);
  border-color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: var(--danger-ink);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-danger-quiet {
  background: transparent;
  color: var(--danger);
  border-color: currentColor;
}

.btn-danger-quiet:hover:not(:disabled) {
  background: var(--surface-dim);
}

.btn-link {
  background: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  font-weight: 500;
}

.btn-link:hover {
  color: var(--ink);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Formularer ---------- */

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

.field > label {
  font-weight: 600;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

input[type="text"],
input[type="url"],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1.5px solid var(--field-line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  width: 100%;
  min-height: 44px;
  padding: 6px 0;
  font: inherit;
  color: var(--ink);
}

input[aria-invalid="true"],
input[type="password"][aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--danger);
  border-width: 2px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

.hint {
  font-size: 0.95rem;
  color: var(--muted);
}

.form-error {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  background: var(--surface-dim);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 500;
}

.image-field {
  margin-top: 10px;
}

.fetch-button {
  align-self: flex-start;
  margin-top: 6px;
}

.fetch-status {
  font-size: 0.95rem;
  color: var(--ink);
}

.fetch-status:not(:empty) {
  margin-top: 6px;
  padding: 8px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--surface-dim);
}

.preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.preview img {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-dim);
}

/* ---------- Dialoger ---------- */

dialog {
  width: calc(100% - 32px);
  max-width: 460px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

dialog::backdrop {
  background: rgba(45, 30, 20, 0.5);
}

dialog h2 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.dialog-wish {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  margin-bottom: 14px;
}

#confirm-text {
  margin-bottom: 4px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ---------- Statusbesked ---------- */

.toast {
  position: fixed;
  z-index: 10;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  font-weight: 500;
  pointer-events: none;
}

.toast.is-error {
  background: var(--toast-error-bg);
  color: #fff;
}

/* Tom region bliver i DOM'en, så skærmlæsere opfanger nye beskeder. */
.toast:empty {
  padding: 0;
  background: none;
  box-shadow: none;
}

@media (prefers-color-scheme: dark) {
  .toast.is-error {
    color: #2c0d0f;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
