/* SOFIA ROMA · Libera. Brand: docs/SOFIA_METODO_2026.md, sezione "Brand" (brand book Mood V2).
   Regole che il CSS deve rispettare:
   - un fondo per superficie: nero, bianco o panna; niente gradienti, ombre, glow
   - titoli Instrument Serif, una parola in corsivo rosa; testo Inter
   - rosa come testo solo su nero, oppure su chiaro nei titoli grandi (3:1)
   - giallino solo su nero; mai giallino su chiaro, mai rosa su giallino
   - linee sottili, angoli arrotondati, una stellina rosa al massimo per schermata */

@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/instrument-serif-400.woff2') format('woff2'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('/fonts/instrument-serif-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('/fonts/inter-variable.woff2') format('woff2'); }

:root {
  /* panna e inchiostro con la stessa dominante rosata: R > G = B su tutta la scala */
  --paper: #FFF9F9;
  --surface: #FDFDFD;
  --sunken: #F7EEEE;
  --line: #EADFDF;
  --line-strong: #CFC2C2;
  --deco: #A69797;
  --ink-2: #6B5E5E;
  --ink: #1E1919;
  --black: #0E0E0E;
  --black-2: #1A1515;
  --black-line: #362E2E;
  --on-black: #FDFDFD;
  --on-black-2: #BDB2B2;
  /* brand */
  --pink: #FF40B4;
  --giallino: #F0F9AA;
  --serif: 'Instrument Serif', 'Times New Roman', Georgia, serif;
  --sans: 'Inter', 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --radius: 12px;
  --radius-lg: 18px;
  --gutter: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0E0E0E;
    --surface: #171212;
    --sunken: #1F1919;
    --line: #2E2626;
    --line-strong: #463B3B;
    --deco: #7A6C6C;
    --ink-2: #BDB2B2;
    --ink: #F5EFEF;
    --black: #1A1414;
    --black-2: #241D1D;
    --black-line: #3A3131;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 3px; }

/* ---------- tipografia ---------- */

.brand { display: flex; align-items: center; gap: 12px; }
.mono { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--pink); display: grid; place-items: center; font-family: var(--serif); font-size: 15px; line-height: .8; color: var(--pink); text-align: center; }
.mono span { display: block; }
.mono span + span { margin-left: .5em; }
.wordmark { font-family: var(--serif); font-size: 26px; line-height: 1; text-transform: uppercase; }
.wordmark i { color: var(--pink); text-transform: none; }
.wordmark small { display: block; font-family: var(--sans); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); margin-top: 5px; }
.kicker { font-family: var(--sans); font-size: 16px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.h1, .h2, .h3 { font-family: var(--serif); font-weight: 400; text-transform: uppercase; margin: 0; letter-spacing: -.005em; }
.h1 { font-size: clamp(44px, 11vw, 80px); line-height: .94; }
.h2 { font-size: clamp(30px, 6vw, 44px); line-height: 1; }
.h3 { font-size: 25px; line-height: 1.05; }
.em { font-style: italic; color: var(--pink); }
.lead { font-size: 18px; max-width: 36ch; }
.muted { color: var(--ink-2); }
.small { font-size: 16px; }
.strong { font-weight: 600; }
.ellipse { position: relative; white-space: nowrap; padding: 0 .1em; }
.ellipse::after { content: ''; position: absolute; inset: -.28em -.38em -.22em; border: 1.5px solid var(--pink); border-radius: 50%; transform: rotate(-3deg); pointer-events: none; }
.star { display: inline-block; width: 22px; height: 22px; background: var(--pink); clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }

/* ---------- superfici ---------- */

.card { background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-radius: var(--radius); }
.pad { padding: 20px; }
.on-black { background: var(--black); color: var(--on-black); }
.on-black .kicker { color: var(--giallino); }
.on-black .muted { color: var(--on-black-2); }
.on-black .wordmark small { color: var(--on-black-2); }
.label-box { display: inline-block; background: var(--black); color: var(--giallino); padding: 3px 14px 4px; border-radius: 999px; font-family: var(--serif); font-size: 21px; text-transform: uppercase; }
.sofia-note { background: var(--black); color: var(--on-black); padding: 20px 22px; border-radius: var(--radius); }
.sofia-note .kicker { color: var(--giallino); }
.sofia-note p { font-family: var(--serif); font-size: 23px; line-height: 1.2; }
.empty { padding: 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); }
.stack { display: grid; gap: 16px; }

/* ---------- bottoni e chip ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 22px; border: 0; border-radius: 999px;
  background: var(--pink); color: var(--black); font-weight: 600; font-size: 16px; letter-spacing: .01em;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.btn:hover { transform: translate(2px, -2px); transition-duration: .1s; }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.danger { background: var(--black); color: var(--on-black); }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 16px; }
.btn.block { width: 100%; }
.on-black .btn.secondary, .on-black .btn.ghost { color: var(--on-black); box-shadow: inset 0 0 0 1px var(--on-black-2); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: 16px; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip.sofia { background: var(--black); color: var(--giallino); box-shadow: none; }
.chip.mark::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.choice {
  min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 0;
  background: transparent; color: inherit; box-shadow: inset 0 0 0 1px currentColor;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.choice.on { background: var(--pink); color: var(--black); box-shadow: none; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- moduli ---------- */

.label { display: block; font-size: 16px; color: var(--ink-2); margin-bottom: 6px; }
.input, textarea, select { width: 100%; min-height: 48px; border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); background: var(--surface); border-radius: 10px; padding: 12px 14px; color: var(--ink); }
textarea { min-height: 96px; resize: vertical; }
.on-black .input, .on-black textarea { background: var(--black-2); color: var(--on-black); box-shadow: inset 0 0 0 1px var(--black-line); }
.on-black .input::placeholder, .on-black textarea::placeholder { color: var(--on-black-2); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hint { font-size: 16px; color: var(--ink-2); margin-top: 8px; }

/* ---------- titoli di sezione: filetto sottile sopra, come nel brand book ---------- */

.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 38px 0 16px; padding-top: 12px; border-top: 1px solid var(--ink); }
.section-head.first { margin-top: 4px; }
.count { font-family: var(--sans); font-size: 16px; color: var(--ink-2); text-transform: none; letter-spacing: 0; vertical-align: super; margin-left: 4px; }

/* ---------- look ---------- */

.look-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; align-items: start; }
.look { background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-radius: var(--radius-lg); padding: 10px 10px 18px; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.look:hover { transform: translate(4px, -4px); box-shadow: 0 0 0 1px var(--ink); transition-duration: .1s; }
.look-photo { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); background: var(--sunken); }
.look .caption { padding: 14px 6px 0; display: grid; gap: 10px; }
.look .title { font-family: var(--serif); font-weight: 400; text-transform: uppercase; font-size: 26px; line-height: 1; margin: 0; }
.look p { margin: 0; }
.look .items { margin: 0; padding: 0; list-style: none; color: var(--ink-2); }
.look .items li::before { content: '· '; }
.says { font-family: var(--serif); font-style: italic; font-size: 20px; line-height: 1.25; }
.communicates { font-family: var(--serif); font-style: italic; font-size: 21px; line-height: 1.2; }
.more { border-top: 1px solid var(--line); padding-top: 10px; }
.more summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: '+'; font-family: var(--serif); font-size: 26px; line-height: 1; transition: transform .3s var(--ease); }
.more[open] summary::after { transform: rotate(45deg); }
.more dl { margin: 10px 0 0; display: grid; gap: 12px; }
.more dt { font-size: 16px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.more dd { margin: 3px 0 0; }
.more ul { margin: 3px 0 0; padding-left: 18px; }

/* il look senza foto: i capi veri, uno per riquadro */
.collage { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 6px; aspect-ratio: 4 / 5; padding: 6px; border-radius: var(--radius); background: var(--sunken); }
.collage[data-n="1"], .collage[data-n="2"] { grid-template-columns: 1fr; }
.collage > .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.tile { position: relative; overflow: hidden; border-radius: 9px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); min-height: 0; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-text { height: 100%; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.tile-name { font-family: var(--serif); font-size: 21px; line-height: 1; overflow-wrap: anywhere; }
.swatches { display: flex; gap: 4px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line-strong); }
.swatches.big .swatch { width: 40px; height: 40px; }
/* nel collage il colore del capo diventa una striscia, come un campione di tessuto */
.tile .swatches { flex: 0 0 34%; gap: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.tile .swatch { flex: 1; width: auto; height: auto; border-radius: 0; box-shadow: none; }

/* ---------- armadio ---------- */

.wardrobe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.garment { background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-radius: var(--radius); padding: 8px 8px 12px; }
.garment-media { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 9px; background: var(--sunken); display: grid; place-items: center; }
.garment .name { font-family: var(--serif); font-size: 20px; line-height: 1.05; margin-top: 10px; }
.garment .chip-row { margin-top: 8px; }
.garment .garment-remove { width: 100%; margin-top: 10px; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 10px 0 16px; scrollbar-width: thin; }
.filter-row .choice { flex: 0 0 auto; }

/* ---------- app della persona ---------- */

.client-shell { max-width: 1120px; margin: 0 auto; padding: 18px var(--gutter) calc(110px + env(safe-area-inset-bottom, 0px)); }
.client-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.client-nav { display: none; gap: 4px; }
.client-nav button, .client-bottom-nav button { border: 0; background: transparent; color: inherit; font-size: 16px; font-weight: 500; min-height: 44px; padding: 6px 10px; }
.client-nav button.active { box-shadow: inset 0 -1px 0 var(--ink); }
.client-nav button.active::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); margin-right: 7px; vertical-align: middle; }
.client-bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--black); color: var(--on-black-2); padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -1px 0 var(--black-line); }
.client-bottom-nav button { font-size: 16px; padding: 6px 2px; }
.client-bottom-nav button.active { color: var(--giallino); }
.client-section { display: none; }
.client-section.active { display: block; }

.feel { position: relative; padding: 26px 20px 28px; border-radius: var(--radius-lg); margin: 0 calc(var(--gutter) * -1); }
.feel > .star { position: absolute; top: 22px; right: 22px; }
.feel .h1 { margin: 12px 0 16px; max-width: 11ch; }
.feel-step { margin-top: 24px; }
.feel-step .kicker { margin-bottom: 10px; }
.feel .choice { color: var(--on-black); }
.feel .choice.on { color: var(--black); }
.word-input { display: flex; gap: 8px; margin-top: 10px; }
.word-input .input { flex: 1; }
.remaining { margin-top: 12px; }
.fresh-intent { font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.2; margin: -4px 0 16px; }

/* ---------- Studio ---------- */

.studio-shell { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.studio-side { background: var(--black); color: var(--on-black); padding: 18px; }
.side-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 18px; }
.side-nav button { border: 0; background: transparent; color: var(--on-black-2); text-align: left; min-height: 44px; padding: 8px 12px; border-radius: 10px; font-size: 16px; font-weight: 500; }
.side-nav button.active { color: var(--giallino); box-shadow: inset 0 0 0 1px var(--black-line); }
.studio-main { padding: 20px var(--gutter); max-width: 1440px; width: 100%; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.metric { padding: 16px; }
.metric-value { font-family: var(--serif); font-size: 44px; line-height: 1; margin-top: 6px; }
.metric.alert { background: var(--black); color: var(--on-black); box-shadow: none; }
.metric.alert .metric-value { color: var(--giallino); }
.metric.alert .muted { color: var(--on-black-2); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 16px; }
th { font-size: 16px; font-weight: 500; color: var(--ink-2); }
.client-detail-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 18px; }
.link-row { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 12px; box-shadow: 0 0 0 1px var(--line); border-radius: var(--radius); background: var(--paper); }
.mobile-url { word-break: break-all; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 16px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); padding: 10px 12px; border-radius: 10px; }
.composer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.select-card { border: 0; padding: 6px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); text-align: left; border-radius: var(--radius); }
.select-card.selected { box-shadow: 0 0 0 1px var(--pink); }
.select-card.selected .name::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pink); margin-right: 6px; vertical-align: middle; }
.select-card .name { font-family: var(--serif); font-size: 18px; line-height: 1.05; margin-top: 6px; }
.assess { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 8px; }
.assess select, .assess input { min-height: 44px; padding: 8px; font-size: 16px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; border-radius: 999px; font-size: 16px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--deco); }
.dot.active { background: var(--pink); }
.dot.suspended { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-2); }
.dot.expired, .dot.cancelled { background: var(--ink); }

/* Studio è denso: più look per riga, testo più compatto */
.studio-main .look-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.studio-main .look .title { font-size: 21px; }
.studio-main .look .caption { gap: 8px; }
.studio-main .tile-name { font-size: 17px; }

/* ---------- finestre e messaggi ---------- */

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px var(--gutter); }
.login-card, .message-card { width: min(480px, 100%); padding: 28px; }
.toast { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 90; background: var(--black); color: var(--on-black); padding: 14px 16px; border-radius: var(--radius); box-shadow: 0 0 0 1px var(--pink); max-width: 460px; margin: 0 auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(14, 14, 14, .55); display: grid; place-items: end center; padding: 0; z-index: 80; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow: auto; padding: 22px var(--gutter) calc(22px + env(safe-area-inset-bottom, 0px)); border-radius: var(--radius-lg) var(--radius-lg) 0 0; background: var(--paper); }
.modal .look { box-shadow: none; padding: 0; margin-top: 12px; }
.modal .look:hover { transform: none; }

/* ---------- schermi larghi ---------- */

@media (min-width: 760px) {
  .client-nav { display: flex; }
  .client-bottom-nav { display: none; }
  .client-shell { padding-bottom: 60px; }
  .feel { margin: 0; padding: 40px; }
  .feel > .star { top: 40px; right: 40px; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { place-items: center; padding: 18px; }
  .modal { border-radius: var(--radius-lg); }
  .toast { left: auto; right: 18px; bottom: 18px; }
}

@media (min-width: 1000px) {
  .studio-shell { grid-template-columns: 260px 1fr; }
  .studio-side { position: sticky; top: 0; height: 100vh; padding: 26px 18px; }
  .side-nav { flex-direction: column; }
  .studio-main { padding: 26px 30px; }
  .metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .client-detail-grid { grid-template-columns: 1.1fr .9fr; }
  .link-row { grid-template-columns: 1fr auto; align-items: center; }
}

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

/* le superfici nere non hanno il filo chiaro delle schede */
.card.on-black { box-shadow: none; }

@media (prefers-color-scheme: dark) {
  .feel { box-shadow: 0 0 0 1px var(--black-line); }
}

/* elenco persone: ricerca sopra i filtri */
.client-tools { display: grid; gap: 10px; margin-bottom: 16px; }
.client-tools .filter-row { margin: 0; }

/* ---------- pagine pubbliche: iscrizione e accesso via email ---------- */
.public-shell { max-width: 640px; margin: 0 auto; padding: 18px var(--gutter) 60px; display: grid; gap: 18px; }
.public-shell .feel { margin: 0; }
.promise { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.promise li { padding-left: 18px; position: relative; }
.promise li::before { content: ''; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: var(--pink); }
.price { font-family: var(--serif); font-size: 44px; line-height: 1; margin: 8px 0 6px; }
.price .muted { font-family: var(--sans); font-size: 16px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.check-row input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--pink); flex: 0 0 auto; }
a.btn { text-decoration: none; }

/* studio: cosa manca perché l'iscrizione online funzioni */
.readiness { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.readiness li { display: flex; align-items: center; gap: 8px; }

/* app: primi passi e profilo scritto da sé */
.first-steps { margin-bottom: 18px; }
.steps { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.steps li.done { color: var(--ink-2); }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
@media (max-width: 520px) { .trio { grid-template-columns: 1fr; } }
