/* Layout: uma coluna de leitura (max 1080px) sobre um corredor noturno; números de apartamento
   aparecem sempre como plaquinhas de porta em latão, o elemento-assinatura do site. */
:root {
  --night: #16111d;
  --hall: #1f1829;
  --hall-2: #2a2136;
  --line: #3b3049;
  --bone: #f2ebdf;
  --dust: #b2a5bd;
  --pumpkin: #ff7b22;
  --pumpkin-deep: #d65c08;
  --brass-1: #e9c77b;
  --brass-2: #b58a3c;
  --brass-ink: #2b1d08;
  --moss: #93c47d;
  --blood: #ff6b6b;

  --font-display: 'Grenze Gotisch', 'Georgia', serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-plate: 'IBM Plex Mono', ui-monospace, 'Consolas', monospace;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.6rem, 7vw, 4.4rem);

  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 123, 34, 0.12), transparent 60%),
    var(--night);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--pumpkin); }
a:hover { color: var(--brass-1); }
:focus-visible { outline: 2px solid var(--brass-1); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.1; }
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); font-weight: 700; }
p { margin: 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
@media (min-width: 700px) { .wrap { padding-inline: 32px; } }

/* ---------- topo ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(22, 17, 29, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; gap: 16px; padding-block: 10px; flex-wrap: wrap; }
.brand {
  font-family: var(--font-display);
  font-size: var(--step-1);
  color: var(--bone);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}
.brand-title { display: flex; align-items: baseline; gap: 10px; line-height: 1.1; }
.brand-name { color: var(--bone); }
.brand-edition { color: var(--pumpkin); font-family: var(--font-plate); font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--dust);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--step--1);
}
.nav a:hover { color: var(--bone); background: var(--hall-2); }
.nav a[aria-current='page'] { color: var(--night); background: var(--pumpkin); }

main { padding-block: 32px 64px; display: grid; gap: 48px; }
footer { border-top: 1px solid var(--line); color: var(--dust); font-size: var(--step--1); }
footer .wrap { padding-block: 24px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ---------- elementos comuns ---------- */
.eyebrow {
  font-family: var(--font-plate);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pumpkin);
}
.muted { color: var(--dust); }
.lede { font-size: var(--step-1); color: var(--dust); max-width: 60ch; }
.section { display: grid; gap: 20px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head p { max-width: 60ch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 700 var(--step-0) / 1 var(--font-body);
  padding: 12px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: var(--pumpkin);
  color: var(--night);
  transition: background 0.15s, transform 0.15s;
}
.btn:hover { background: var(--brass-1); color: var(--night); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--bone); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--dust); color: var(--bone); }
.btn.small { padding: 8px 14px; font-size: var(--step--1); }
.btn.danger { background: transparent; color: var(--blood); border-color: rgba(255, 107, 107, 0.4); }
.btn.danger:hover { background: rgba(255, 107, 107, 0.12); }
.btn.danger.armed { background: var(--blood); color: var(--night); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.panel {
  background: var(--hall);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: grid;
  gap: 18px;
  min-width: 0;
}
.notice {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  color: var(--dust);
  display: grid;
  gap: 10px;
}
.notice strong { color: var(--bone); }
.notice.warn { border-color: rgba(255, 123, 34, 0.5); background: rgba(255, 123, 34, 0.06); }

/* ---------- plaquinha de porta ---------- */
.plate {
  --size: 1;
  position: relative;
  display: inline-grid;
  justify-items: center;
  align-content: center;
  min-width: calc(5.2rem * var(--size));
  padding: calc(8px * var(--size)) calc(16px * var(--size));
  border-radius: 6px;
  background: linear-gradient(160deg, var(--brass-1), var(--brass-2));
  color: var(--brass-ink);
  font-family: var(--font-plate);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.35);
  line-height: 1.1;
}
.plate::before, .plate::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6d8, #7a5a22);
}
.plate::before { left: 6px; }
.plate::after { right: 6px; }
.plate small { font-size: calc(0.62rem * var(--size)); letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; }
.plate b { font-size: calc(1.35rem * var(--size)); font-weight: 600; letter-spacing: 0.04em; }
.plate.lg { --size: 1.5; }
.plate.sm { --size: 0.8; }

/* ---------- formulários ---------- */
form { display: grid; gap: 18px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .label { font-weight: 600; font-size: var(--step--1); }
.field .hint { color: var(--dust); font-size: var(--step--1); }
input[type='text'], input[type='tel'], input[type='number'], input[type='password'], input[type='date'], input[type='time'], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--bone);
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
input:focus, textarea:focus, select:focus { border-color: var(--pumpkin); outline: none; box-shadow: 0 0 0 3px rgba(255, 123, 34, 0.2); }
input.pin { font-family: var(--font-plate); letter-spacing: 0.4em; font-size: var(--step-1); max-width: 12rem; }

.choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.choice label {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--night);
}
.choice label:has(input:checked) { border-color: var(--pumpkin); background: rgba(255, 123, 34, 0.08); }
.choice input { margin-top: 4px; accent-color: var(--pumpkin); }
.choice small { display: block; color: var(--dust); }

.kid-rows { display: grid; gap: 10px; }
.kid-row { display: grid; gap: 10px; grid-template-columns: 1fr 5rem auto; align-items: end; }
@media (max-width: 480px) {
  .brand { gap: 9px; }
  .brand-name { font-size: 1.12rem; }
  .kid-row { grid-template-columns: 1fr 5rem; }
  .kid-row > button { grid-column: 1 / -1; justify-self: start; }
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--dust);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  font-size: var(--step--1);
}
.icon-btn:hover { color: var(--blood); border-color: var(--blood); }

.form-error { color: var(--blood); font-weight: 600; min-height: 1.2em; }
.form-error:empty { display: none; }

/* ---------- home ---------- */
main.wrap:has(> .hero) { max-width: none; padding-inline: 0; padding-top: 0; }
main:has(> .hero) > section:not(.hero) { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 32px; }
main:has(> .hero) > .kids-panel { width: calc(100% - 64px); max-width: 1016px; padding: 24px; }
.hero { position: relative; isolation: isolate; width: 100%; max-width: 1600px; margin-inline: auto; min-height: 640px; display: grid; align-items: center; overflow: hidden; background: var(--night); }
.hero-visual { position: absolute; inset: 0; z-index: -1; }
.hero-art { width: 100%; height: 100%; object-fit: cover; object-position: right center; }
.hero-visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(22,17,29,.9), rgba(22,17,29,.66) 30%, rgba(22,17,29,.12) 58%, transparent 72%), linear-gradient(0deg, var(--night), transparent 18%); }
.hero-content { width: 100%; max-width: 1080px; margin-inline: auto; padding: 56px 32px 64px; }
.hero-copy { max-width: 440px; display: grid; gap: 20px; }
.hero h1 { font-size: clamp(2.6rem, 5vw, 4.1rem); max-width: 100%; }
.hero h1 em { font-style: normal; color: var(--pumpkin); }
.hero .lede { font-size: 1.1rem; color: var(--bone); }
.hero .muted { color: var(--bone); }
.countdown { font-family: var(--font-plate); color: var(--brass-1); font-size: var(--step-1); }

@media (min-width: 1601px) {
  .hero-art { object-position: center; }
  .hero-visual::after { background: linear-gradient(90deg, var(--night), transparent 6%, transparent 94%, var(--night)), linear-gradient(90deg, rgba(22,17,29,.9), rgba(22,17,29,.66) 30%, rgba(22,17,29,.12) 58%, transparent 72%), linear-gradient(0deg, var(--night), transparent 18%); }
}

@media (max-width: 760px) {
  .hero { display: block; min-height: 0; }
  .hero-visual { position: relative; z-index: 0; }
  .hero-art { height: auto; object-fit: contain; }
  .hero-visual::after { background: linear-gradient(0deg, var(--night), transparent 28%); }
  .hero-content { padding: 12px 24px 32px; }
  .hero-copy { max-width: none; }
  .hero h1 { font-size: clamp(2.2rem, 7.5vw, 3.6rem); max-width: 15ch; }
  main:has(> .hero) > section:not(.hero) { padding-inline: 24px; }
  main:has(> .hero) > .kids-panel { width: calc(100% - 48px); padding: 24px; }
}
@media (max-width: 480px) {
  .hero-content { padding-inline: 16px; }
  .hero h1 { font-size: clamp(2rem, 10vw, 3rem); max-width: 100%; }
  main:has(> .hero) > section:not(.hero) { padding-inline: 16px; }
  main:has(> .hero) > .kids-panel { width: calc(100% - 32px); padding: 20px; }
}

.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.stat { border-top: 2px solid var(--line); padding-top: 12px; display: grid; gap: 2px; }
.stat b { font-family: var(--font-plate); font-size: var(--step-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { color: var(--dust); font-size: var(--step--1); }
.stat.hot { border-color: var(--pumpkin); }
.stat.hot b { color: var(--pumpkin); }

.kids-panel { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: start; }
.kids-panel .big { font-family: var(--font-plate); font-size: var(--step-2); color: var(--brass-1); }
.ages { display: grid; gap: 8px; }
.age-row { display: grid; grid-template-columns: 9.5rem 1fr 2.5rem; gap: 10px; align-items: center; font-size: var(--step--1); }
.age-row .bar { height: 10px; border-radius: 5px; background: var(--hall-2); overflow: hidden; }
.age-row .bar i { display: block; height: 100%; background: var(--pumpkin); border-radius: 5px; }
.age-row b { font-family: var(--font-plate); text-align: right; font-variant-numeric: tabular-nums; }

.tower-group { display: grid; gap: 12px; }
.tower-group h3 { font-family: var(--font-plate); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.12em; color: var(--dust); font-weight: 600; }
.doors { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.door {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  padding: 18px 12px 14px;
  border-radius: 40px 40px 8px 8px;
  background: linear-gradient(180deg, var(--hall-2), var(--hall));
  border: 1px solid var(--line);
  min-width: 0;
}
.door p { font-size: var(--step--1); color: var(--dust); overflow-wrap: anywhere; }
.door .cam { font-size: 0.75rem; color: var(--pumpkin); font-family: var(--font-plate); text-decoration: none; }

/* ---------- galeria ---------- */
.year-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.year-tabs a {
  font-family: var(--font-plate);
  text-decoration: none;
  color: var(--dust);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.year-tabs a[aria-current='true'] { background: var(--bone); color: var(--night); border-color: var(--bone); }

.gallery { display: grid; gap: 24px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.entry { background: var(--hall); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.entry.voted { border-color: var(--pumpkin); box-shadow: 0 0 0 1px var(--pumpkin); }
.entry .cover { aspect-ratio: 4 / 5; width: 100%; object-fit: cover; cursor: zoom-in; background: var(--night); border: 0; padding: 0; }
.entry .cover img { width: 100%; height: 100%; object-fit: cover; }
.entry .thumbs { display: flex; gap: 6px; padding: 8px 12px 0; overflow-x: auto; }
.entry .thumbs button { flex: 0 0 52px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; cursor: zoom-in; background: none; }
.entry .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.entry .body { padding: 14px 16px 16px; display: grid; gap: 12px; align-content: start; }
.entry .who { display: flex; gap: 12px; align-items: center; }
.entry .who p { color: var(--dust); font-size: var(--step--1); min-width: 0; overflow-wrap: anywhere; }
.rank { font-family: var(--font-plate); color: var(--brass-1); }
.votes { font-family: var(--font-plate); font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-family: var(--font-plate); font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; background: var(--hall-2); color: var(--dust); }
.tag.on { background: rgba(147, 196, 125, 0.15); color: var(--moss); }
.tag.hot { background: var(--pumpkin); color: var(--night); }

dialog.lightbox { border: 0; padding: 0; background: transparent; max-width: min(96vw, 1100px); max-height: 92vh; }
dialog.lightbox::backdrop { background: rgba(10, 6, 14, 0.9); }
dialog.lightbox img { max-height: 84vh; width: auto; margin: 0 auto; border-radius: 6px; }
dialog.lightbox p { color: var(--bone); text-align: center; padding-top: 8px; }
dialog.lightbox button { position: fixed; top: 16px; right: 16px; }

/* ---------- minha porta ---------- */
.mine-head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.kid-list { display: grid; gap: 8px; }
.kid { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--night); border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.kid > div { min-width: 0; }
.kid small { color: var(--dust); }
.photo-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
.photo-grid figure { margin: 0; position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--night); }
.photo-grid img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.photo-grid figcaption { font-size: var(--step--1); padding: 6px 8px; color: var(--dust); overflow-wrap: anywhere; }
.photo-grid figure button { position: absolute; top: 6px; right: 6px; }
.two-col { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }

/* ---------- admin ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--dust); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; background: var(--hall); }
td.num { font-family: var(--font-plate); font-variant-numeric: tabular-nums; text-align: right; }
tr:last-child td { border-bottom: 0; }
.switch { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; white-space: nowrap; }
.switch input { accent-color: var(--pumpkin); width: 18px; height: 18px; }
.mini-thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.mini-thumbs span { position: relative; }
.mini-thumbs img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
.mini-thumbs button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--blood); color: var(--night); font-weight: 700; cursor: pointer; line-height: 1; padding: 0; }
.pin-reveal { font-family: var(--font-plate); font-size: var(--step-1); color: var(--brass-1); letter-spacing: 0.3em; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  background: var(--bone);
  color: var(--night);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  max-width: calc(100vw - 32px);
  z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--blood); }

.skeleton { color: var(--dust); padding-block: 40px; }

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