/* Fontes hospedadas no próprio site (licença OFL) — nenhuma requisição a terceiros */
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/fonts/cormorant-garamond-latin-500-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Jost"; src: url("/fonts/jost-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url("/fonts/jost-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url("/fonts/jost-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Jost"; src: url("/fonts/jost-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

/* =====================================================================
   IDENTIDADE VISUAL — altere aqui cores, fontes e logo
   ===================================================================== */
:root {
  /* Paleta da marca */
  --bege: #E1C4A8;      /* principal  */
  --marrom: #52312E;    /* secundária */
  --azul: #293345;      /* terciária  */

  /* Tons derivados */
  --bege-claro: #F5ECE3;
  --bege-medio: #EBD9C7;
  --marrom-hover: #6B4440;
  --azul-escuro: #1C2433;

  /* Tipografia */
  --font-titulo: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-texto: "Jost", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --bg: var(--bege-claro);
  --surface: #FFFFFF;
  --text: var(--marrom);
  --text-soft: #7A5C58;
  --border: #E4D3C2;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(82, 49, 46, .10);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-texto);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-titulo); font-weight: 500; line-height: 1.15; margin: 0; }
.hidden { display: none !important; }

/* ----------------------------- Botões ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1.5px solid transparent;
  font: 600 14px/1 var(--font-texto); letter-spacing: .02em;
  cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--marrom); color: var(--bege-claro); }
.btn-primary:hover { background: var(--marrom-hover); }
.btn-azul { background: var(--azul); color: var(--bege-claro); }
.btn-azul:hover { background: var(--azul-escuro); }
.btn-outline { background: transparent; color: var(--marrom); border-color: var(--marrom); }
.btn-outline:hover { background: var(--marrom); color: var(--bege-claro); }
.btn-ghost { background: transparent; color: var(--marrom); }
.btn-ghost:hover { background: var(--bege-medio); }
.btn-danger { background: transparent; color: #9B2C2C; border-color: #E8BDBD; }
.btn-danger:hover { background: #9B2C2C; color: #fff; border-color: #9B2C2C; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: inherit; cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { width: 22px; height: 22px; }

/* ----------------------------- Inputs ------------------------------ */
.input {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--border);
  background: #fff; color: var(--text); font: 15px var(--font-texto);
}
.input:focus { outline: none; border-color: var(--marrom); }
label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--text-soft); }

/* ----------------------------- Topo -------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--azul); color: var(--bege-claro);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 36px; width: auto; }
.brand span { font-family: var(--font-titulo); font-size: 24px; font-weight: 500; letter-spacing: .03em; }
.brand span em { font-style: italic; opacity: .85; }

/* ----------------------------- Toast ------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--azul); color: var(--bege-claro); padding: 12px 20px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------------- Rodapé ------------------------------ */
.footer { text-align: center; padding: 40px 16px; color: var(--text-soft); font-size: 13px; }

/* ===================================================================
   GRADE JUSTIFICADA (estilo Google Fotos)
   =================================================================== */
.grid { display: flex; flex-wrap: wrap; gap: 4px; }
.grid::after { content: ""; flex-grow: 999999999; }
.tile {
  --r: 1.5;                               /* largura / altura, definido via JS */
  position: relative; flex-grow: calc(var(--r) * 100); width: calc(var(--r) * 220px);
  background: var(--bege-medio); overflow: hidden; cursor: pointer;
}
.tile > i { display: block; padding-bottom: calc(100% / var(--r)); }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
@media (max-width: 600px) { .tile { width: calc(var(--r) * 120px); } .grid { gap: 2px; } }

.tile .check {
  position: absolute; top: 8px; left: 8px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0,0,0,.25); display: grid; place-items: center;
  opacity: 0; transition: opacity .15s; color: transparent;
}
.tile .check svg { width: 16px; height: 16px; }
.tile::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.35), transparent 35%); opacity: 0; transition: opacity .15s;
}
.tile:hover::before, .tile:hover .check, .selecting .tile .check { opacity: 1; }
.tile .check { z-index: 2; }
.tile.selected img { transform: scale(.88); border-radius: 6px; }
.tile.selected { background: var(--bege); }
.tile.selected .check { background: var(--marrom); border-color: var(--marrom); color: #fff; opacity: 1; }
@media (hover: none) { .tile .check { opacity: .9; } }

/* ===================================================================
   LIGHTBOX
   =================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 50; background: var(--azul-escuro); color: var(--bege-claro);
  display: flex; flex-direction: column;
}
.lb-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; gap: 8px; }
.lb-bar .lb-info { font-size: 14px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { position: relative; flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 56px 24px; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.08); }
.lb-nav.prev { left: 8px; } .lb-nav.next { right: 8px; }
@media (max-width: 600px) { .lb-stage { padding: 0 0 16px; } .lb-nav { display: none; } }

/* ===================================================================
   MODAL
   =================================================================== */
.modal-bg { position: fixed; inset: 0; background: rgba(28,36,51,.55); display: grid; place-items: center; z-index: 60; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 28px; width: min(440px, 100%); box-shadow: var(--shadow); }
.modal h2 { font-size: 28px; margin-bottom: 18px; }
.modal .field { margin-bottom: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
