/* Enxovalzinho, site. Os tokens espelham Shared/DesignSystem/Colors.swift e BabyTheme.swift. */

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/Fraunces.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #FBF7F1;
  --surface: #FFFFFF;
  --ink: #26312E;
  --muted: #66726E;
  --line: #E9E1D5;
  --track: #E6EEEB;
  --apricot: #E9A47E;
  --success: #3F8A5A;
  --accent: #437A6F;
  --on-accent: #FFFFFF;
  --accent-tint: rgba(67, 122, 111, 0.12);
  --shadow: 0 1px 2px rgba(38, 49, 46, 0.04), 0 8px 24px rgba(38, 49, 46, 0.06);
  --radius-card: 20px;
  --radius-inner: 14px;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color-scheme: light;
}
:root[data-accent="rose"] { --accent: #A4545C; --accent-tint: rgba(184, 103, 111, 0.13); }
:root[data-accent="blue"] { --accent: #43709A; --accent-tint: rgba(76, 122, 160, 0.13); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141917; --surface: #1E2523; --ink: #EEF2F0; --muted: #A3AFAB; --line: #2C3531;
    --track: #2A3330; --apricot: #F0B48F; --success: #6CC08A;
    --accent: #7DBBAE; --on-accent: #0F1F1B; --accent-tint: rgba(125, 187, 174, 0.14);
    --shadow: none;
    color-scheme: dark;
  }
  :root:not([data-theme="light"])[data-accent="rose"] { --accent: #E8A2A9; --accent-tint: rgba(232, 162, 169, 0.14); }
  :root:not([data-theme="light"])[data-accent="blue"] { --accent: #93BADB; --accent-tint: rgba(147, 186, 219, 0.14); }
}
:root[data-theme="dark"] {
  --bg: #141917; --surface: #1E2523; --ink: #EEF2F0; --muted: #A3AFAB; --line: #2C3531;
  --track: #2A3330; --apricot: #F0B48F; --success: #6CC08A;
  --accent: #7DBBAE; --on-accent: #0F1F1B; --accent-tint: rgba(125, 187, 174, 0.14);
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.55 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: "SOFT" 50, "WONK" 0;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 7vw, 2.75rem); line-height: 1.08; }
h2 { font-size: 1.35rem; line-height: 1.25; }
h3 { font-size: 1.05rem; line-height: 1.3; }
p { margin: 0; }

.page { max-width: 960px; margin: 0 auto; padding-block: 28px 72px; display: flex; flex-direction: column; gap: 28px; }
.page.narrow { max-width: 680px; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand span { font-family: var(--display); font-weight: 600; font-size: 1.15rem; font-variation-settings: "SOFT" 50; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.caption { font-size: 13px; }

/* Cartões */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 20px;
}
.tint { background: var(--accent-tint); border-radius: var(--radius-card); padding: 20px 22px; }

/* Cabeçalho da lista */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.hero-art { width: 132px; height: 132px; object-fit: contain; animation: float 5.6s ease-in-out infinite; }
.hero-text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.hero-message { white-space: pre-line; overflow-wrap: anywhere; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 6px 12px; border-radius: 999px; background: var(--accent-tint); color: var(--accent);
  font-size: 14px; font-weight: 600;
}
@media (max-width: 520px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { width: 112px; height: 112px; grid-row: 1; justify-self: start; }
}

/* Progresso */
.progress { display: flex; align-items: center; gap: 14px; }
.ring { width: 56px; height: 56px; flex: none; }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--track); }
.ring .value { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Abas (cápsula como no app) */
.segments { display: flex; gap: 4px; padding: 4px; background: var(--surface); border-radius: 999px; box-shadow: var(--shadow); }
.segment {
  flex: 1; border: 0; background: transparent; color: var(--ink); font: 600 15px/1 var(--body);
  padding: 11px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; justify-content: center;
  transition: background-color 0.25s, color 0.25s;
}
.segment[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.segment .count { font-variant-numeric: tabular-nums; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, transparent); }

/* Grade de presentes (CardGrid do app) */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.gift {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px;
  background: var(--surface); border-radius: var(--radius-card); box-shadow: var(--shadow);
  border: 0; text-align: left; color: inherit; font: inherit; cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: pop-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.gift:active { transform: scale(0.97); }
.gift:focus-visible, .segment:focus-visible, .button:focus-visible, .field input:focus-visible, .field textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px;
}
.gift-image {
  aspect-ratio: 1; border-radius: var(--radius-inner); overflow: hidden;
  background: color-mix(in srgb, var(--apricot) 14%, var(--surface));
  display: grid; place-items: center; color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.gift-image img { width: 100%; height: 100%; object-fit: cover; }
.gift-image svg { width: 34px; height: 34px; }
.gift-title {
  font-size: 14px; font-weight: 600; line-height: 1.3; min-height: 2.6em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.gift-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.gift-meta .store { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-meta .price { color: var(--accent); font-weight: 600; white-space: nowrap; }
.badge {
  position: absolute; top: 18px; left: 18px; padding: 4px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.badge.mine { background: var(--accent); color: var(--on-accent); }
.gift.taken .gift-image, .gift.taken .gift-title, .gift.taken .gift-meta { opacity: 0.45; }

/* Botões */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border: 0; border-radius: 16px; font: 600 17px/1 var(--body); cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--on-accent); transition: transform 0.15s, opacity 0.2s;
}
.button:active { transform: scale(0.97); }
.button[disabled] { opacity: 0.5; cursor: default; }
.button.secondary { background: var(--accent-tint); color: var(--accent); }
.button.ghost { background: transparent; color: var(--accent); min-height: 44px; padding: 0 12px; }
.button.block { width: 100%; }

/* Folha (dialog) */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: min(560px, 100%); max-height: 92vh;
  background: var(--bg); color: var(--ink); border-radius: 26px 26px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
}
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 26px; } }
dialog.sheet[open] { animation: sheet-in 0.36s cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.sheet::backdrop { background: rgba(20, 25, 23, 0.42); backdrop-filter: blur(2px); }
.sheet-body { padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: 92vh; }
.sheet-head { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: center; }
.sheet-head .gift-image { width: 96px; }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.icon-button {
  width: 36px; height: 36px; border-radius: 999px; border: 0; background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.field input, .field textarea {
  width: 100%; font: 17px/1.4 var(--body); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px;
}
.field textarea { resize: vertical; min-height: 84px; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); align-self: flex-start; }
.stepper button { width: 38px; height: 38px; border-radius: 999px; border: 0; background: var(--accent-tint); color: var(--accent); font: 600 20px/1 var(--body); cursor: pointer; }
.stepper button[disabled] { opacity: 0.35; cursor: default; }
.stepper output { min-width: 34px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.notice { padding: 14px 16px; border-radius: 16px; background: var(--accent-tint); font-size: 15px; }
.notice.error { background: color-mix(in srgb, #C0504D 14%, transparent); }

/* Estados */
.state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 48px 8px; }
.state img { width: 160px; height: 160px; object-fit: contain; animation: float 5.6s ease-in-out infinite; }
.skeleton { background: linear-gradient(90deg, var(--track), color-mix(in srgb, var(--track) 50%, var(--surface)), var(--track)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-card); }

.footer { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding-top: 12px; }
.footer .card { display: flex; align-items: center; gap: 14px; text-align: left; }
.footer .card img { width: 52px; height: 52px; border-radius: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); max-width: calc(100% - 32px); animation: toast-in 0.3s ease both; z-index: 10;
}
.live { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: var(--success); animation: pulse 2.4s ease-in-out infinite; }

[hidden] { display: none !important; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

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

/* Páginas de texto (privacidade, início) */
.prose { display: flex; flex-direction: column; gap: 32px; }
.prose section { display: flex; flex-direction: column; gap: 10px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; }
.prose em { font-style: normal; font-weight: 600; }
.email { font-weight: 600; color: var(--accent); user-select: all; word-break: break-all; }
.store-badge { display: inline-flex; align-items: center; gap: 10px; }

/* Utilitários (sem estilos inline: a CSP bloqueia) */
.stack { display: flex; flex-direction: column; gap: 22px; }
.stack-sm { display: flex; flex-direction: column; gap: 14px; }
.center { text-align: center; }
.sk-hero { height: 150px; }
.sk-grid { margin-top: 20px; }
.sk-card { aspect-ratio: 0.78; }
.progress-title { font-size: 1.15rem; }
.app-card { text-decoration: none; color: inherit; }
.sheet-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding-right: 32px; }
#sheet-title { overflow-wrap: anywhere; }
.sheet-notes { white-space: pre-line; overflow-wrap: anywhere; }

/* Responsivo: telas bem estreitas (iPhone SE, Android pequeno) até monitores largos. */
.segment { white-space: nowrap; min-width: 0; }
@media (max-width: 380px) {
  body { font-size: 16px; }
  .card, .tint { padding: 16px; }
  .segment { font-size: 14px; padding: 10px 8px; gap: 6px; }
  .live { font-size: 0; gap: 0; }              /* fica só o ponto verde */
  .live::before { width: 8px; height: 8px; }
  .grid { gap: 10px; }
  .gift { padding: 8px; }
  .badge { top: 14px; left: 14px; font-size: 11px; }
  .hero-art { width: 96px; height: 96px; }
  .footer .card { flex-direction: column; text-align: center; }
}
@media (min-width: 1200px) {
  .page:not(.narrow) { max-width: 1120px; }
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
/* Celular deitado: folha não cobre a tela inteira. */
@media (max-height: 500px) and (orientation: landscape) {
  dialog.sheet { margin: auto; border-radius: 22px; max-height: 96vh; }
  .sheet-body { max-height: 96vh; }
}
@media (hover: hover) {
  .gift:hover { transform: translateY(-2px); }
  .button:hover { opacity: 0.92; }
}
