:root {
  --bg: #120e0c;
  --ink: #f6efe4;
  --muted: #cbbba6;
  --gold: #e4c16a;
  --gold-deep: #a9833a;
  --line: rgba(228, 193, 106, 0.28);
  --card: rgba(28, 22, 19, 0.92);
  --pine: #1e4a38;
  --red: #8f2433;
  --serif: "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.5;
  background:
    radial-gradient(1.4px 1.4px at 7% 12%, rgba(255, 255, 255, 0.55) 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 19% 28%, rgba(255, 255, 255, 0.35) 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 31% 8%, rgba(255, 255, 255, 0.4) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 46% 22%, rgba(255, 255, 255, 0.3) 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 62% 14%, rgba(255, 255, 255, 0.45) 50%, transparent 52%),
    radial-gradient(1.3px 1.3px at 78% 26%, rgba(255, 255, 255, 0.28) 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 91% 10%, rgba(255, 255, 255, 0.4) 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 12% 70%, rgba(255, 255, 255, 0.22) 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 84% 76%, rgba(255, 255, 255, 0.25) 50%, transparent 52%),
    radial-gradient(1100px 520px at 0% -10%, rgba(143, 36, 51, 0.45), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(30, 74, 56, 0.55), transparent 50%),
    radial-gradient(700px 420px at 50% 120%, rgba(169, 131, 58, 0.18), transparent 45%),
    var(--bg);
}

a { color: var(--gold); }

h1, h2, .brand-title {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.1; margin: 0 0 0.4rem; }

.skip {
  position: absolute;
  left: 0.8rem;
  top: -4rem;
  background: var(--gold);
  color: #2a1608;
  padding: 0.5rem 0.8rem;
  z-index: 10;
}

.skip:focus { top: 0.8rem; }

.wrap { width: min(1120px, calc(100% - 1.4rem)); margin: 0 auto; }

.site {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(18, 14, 12, 0.86);
  border-bottom: 1px solid rgba(228, 193, 106, 0.16);
  backdrop-filter: blur(12px);
}

.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.75rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: var(--gold);
  font-family: var(--serif);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--gold);
}

.brand-text { display: flex; flex-direction: column; }
.brand-title { font-size: 1.25rem; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 0.82rem; }

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.85rem;
}

.nav-link, .linkish, .langs a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.nav-link.is-active, .langs a.is-active { color: var(--gold); }

.linkish {
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.who { color: var(--muted); font-size: 0.92rem; }

.langs { display: inline-flex; gap: 0.4rem; }
.langs a { font-weight: 700; }

main { padding: 1.4rem 0 3rem; }

.lede { color: var(--muted); max-width: 40rem; }

.gifts {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.gift {
  position: relative;
  display: flex;
  min-height: 9.5rem;
  aspect-ratio: 4 / 5;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: #fff8ea;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  --paper: #8f2433;
  --paper-2: #641824;
  --ribbon: #e4c16a;
  background: var(--paper);
}

.gift-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: saturate(0.8) contrast(0.95);
}

.gift-paper {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: repeating-linear-gradient(45deg, var(--paper) 0 12px, var(--paper-2) 12px 24px);
}

.gift.has-photo .gift-paper { opacity: 0.68; }

.gift.paper-2 {
  --paper: #1f6a4a;
  --paper-2: #143f2e;
  --ribbon: #f2d48a;
}

.gift.paper-2 .gift-paper {
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.16) 0 3px, transparent 4px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.12) 0 3px, transparent 4px),
    linear-gradient(160deg, var(--paper), var(--paper-2));
  background-size: 28px 28px, 34px 34px, auto;
}

.gift.paper-3 {
  --paper: #6d2a4a;
  --paper-2: #3d1729;
  --ribbon: #f4efe4;
}

.gift.paper-3 .gift-paper {
  background: repeating-linear-gradient(var(--paper) 0 14px, var(--paper-2) 14px 22px);
}

.gift.paper-4 {
  --paper: #1c3f66;
  --paper-2: #12263d;
  --ribbon: #e4c16a;
}

.gift.paper-4 .gift-paper {
  background:
    linear-gradient(45deg, transparent 46%, var(--ribbon) 46% 54%, transparent 54%),
    linear-gradient(var(--paper), var(--paper-2));
  background-size: 22px 22px, auto;
}

.gift.paper-5 {
  --paper: #8a3b16;
  --paper-2: #4e220d;
  --ribbon: #2f6a52;
}

.gift.paper-5 .gift-paper {
  background: repeating-linear-gradient(-45deg, var(--paper) 0 10px, var(--paper-2) 10px 20px);
}

.gift.paper-6 {
  --paper: #243028;
  --paper-2: #101814;
  --ribbon: #c0392b;
}

.gift.paper-6 .gift-paper {
  background:
    linear-gradient(90deg, transparent 40%, rgba(255, 255, 255, 0.05) 40% 60%, transparent 60%),
    linear-gradient(var(--paper), var(--paper-2));
}

.gift::before, .gift::after {
  content: "";
  position: absolute;
  background: var(--ribbon);
  z-index: 2;
}

.gift::before { width: 12%; left: 50%; top: 0; bottom: 0; transform: translateX(-50%); }
.gift::after { height: 12%; left: 0; right: 0; top: 42%; }

.bow {
  position: absolute;
  top: 0.35rem;
  left: 50%;
  z-index: 4;
  width: 2.4rem;
  height: 1rem;
  transform: translateX(-50%);
}

.bow::before, .bow::after {
  content: "";
  position: absolute;
  width: 1.05rem;
  height: 0.85rem;
  border: 3px solid var(--ribbon);
  border-bottom: 0;
  border-radius: 1rem 1rem 0 0;
  top: 0;
}

.bow::before { left: 0; transform: rotate(-18deg); }
.bow::after { right: 0; transform: rotate(18deg); }

.tag {
  position: relative;
  z-index: 3;
  width: 3.1rem;
  height: 3.1rem;
  margin-bottom: 1.4rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f7f1e4;
  color: #2a120f;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
}

.badge {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 4;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(18, 14, 12, 0.78);
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 700;
}

.caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 1.4rem 0.45rem 0.45rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  text-align: center;
}

.caption-title, .caption-brewer {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caption-title { font-weight: 700; font-size: 0.86rem; }
.caption-brewer { font-size: 0.75rem; opacity: 0.9; }

.gift.is-mine { outline: 2px dashed var(--gold); outline-offset: 3px; }

.gift:hover { filter: brightness(1.06); }
.gift:focus-visible, .button:focus-visible, .nav-link:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .langs a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.sheet, .card {
  max-width: 42rem;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem 1.1rem 1.4rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.sheet-wide { max-width: 46rem; }

.back { margin-top: 0; }

.beer-head { text-align: center; }
.day-pill {
  display: inline-block;
  margin: 0.8rem 0 0;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--red);
  color: #fff8ea;
  font-weight: 700;
}

.style-pill, .byline, .meta, .hint { color: var(--muted); }
.description { white-space: pre-wrap; }

.beer-photo {
  width: 100%;
  max-height: 22rem;
  object-fit: cover;
  border-radius: 14px;
  background: #0c0a09;
}

.glass {
  width: 7rem;
  height: 8rem;
  margin: 0.4rem auto 0;
  border: 3px solid var(--gold);
  border-top: 0;
  border-radius: 0 0 2rem 2rem;
  position: relative;
  background: linear-gradient(#e4c16a 0 18%, #8a5a16 18% 100%);
}

.glass span {
  position: absolute;
  left: -0.4rem;
  right: -0.4rem;
  top: 0;
  height: 0.7rem;
  border-radius: 4px;
  background: var(--gold);
}

.averages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.averages div {
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(228, 193, 106, 0.14);
}

.averages dt { color: var(--muted); font-size: 0.82rem; }
.averages dd { margin: 0; font-family: var(--serif); font-size: 1.4rem; }

.actions { margin: 1rem 0; }

.button {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  background: linear-gradient(#f0d48a, #c9963a);
  color: #2a1608;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.form, .rate-form { display: grid; gap: 0.9rem; margin-top: 1rem; }

label { display: grid; gap: 0.35rem; }

input, select, textarea {
  width: 100%;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #100e0c;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

textarea { min-height: 8rem; resize: vertical; }

textarea.comment-input { min-height: 5.5rem; }

.comments { display: grid; gap: 0.7rem; margin-top: 1.2rem; }

.comments h2 { margin: 0; font-size: 1.45rem; }

.comment {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(228, 193, 106, 0.14);
}

.comment .meta { margin: 0; }

.comment p { margin: 0.3rem 0 0; white-space: pre-wrap; }

.alert {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  background: rgba(143, 36, 51, 0.35);
  border: 1px solid rgba(228, 193, 106, 0.3);
}

.alert.ok { background: rgba(30, 74, 56, 0.55); }

.stars { border: 0; margin: 0; padding: 0; }
.stars legend { font-weight: 700; margin-bottom: 0.2rem; }

.star-row { display: flex; flex-direction: row-reverse; justify-content: flex-end; }

.star-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.star-row label {
  font-size: 2rem;
  line-height: 1;
  padding: 0.45rem;
  color: #6a5d50;
  cursor: pointer;
}

.star-row label:hover,
.star-row label:hover ~ label,
.star-row input:checked ~ label { color: var(--gold); }

.star-row input:focus-visible + label { outline: 2px solid var(--gold); border-radius: 8px; }

.rank {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rank a { color: var(--ink); font-weight: 700; text-decoration: none; }
.rank a:hover { color: var(--gold); }
.rank .meta { margin: 0.15rem 0 0; }
.score { margin: 0; font-family: var(--serif); font-size: 1.6rem; color: var(--gold); }

.medal {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #3a322c;
  font-weight: 700;
}

.rank:nth-child(1) .medal { background: #e4c16a; color: #2a1608; }
.rank:nth-child(2) .medal { background: #d9dde3; color: #1c1c1c; }
.rank:nth-child(3) .medal { background: #c68658; color: #2a1608; }

.site-foot {
  border-top: 1px solid rgba(228, 193, 106, 0.16);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem 0 2rem;
}

.site-foot p { margin: 0.2rem 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (min-width: 540px) {
  .gifts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 800px) {
  .gifts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .averages { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .gifts { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

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