/* Cynthia Star — feuille de style unique. Palette chaude, typo éditoriale. */

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3eee6;
  --ink: #1f1b16;
  --muted: #8a7f72;
  --line: #e6ded1;
  --accent: #9a6b41;
  --accent-soft: #f0e4d6;
  --danger: #a33b2e;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(31, 27, 22, .05), 0 8px 24px -16px rgba(31, 27, 22, .3);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; margin: 0; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.link {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px; padding: 0;
}
.link:hover { color: var(--ink); }

/* ------------------------------------------------------- écran de connexion */

.gate {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}

.gate-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 34px 32px 28px;
  box-shadow: var(--shadow);
}

.brand-lg { justify-content: center; }
.brand-lg .brand-mark { width: 34px; height: 34px; }
.brand-lg .brand-name { font-size: 28px; }

.gate-tag {
  margin: 8px 0 26px; text-align: center;
  color: var(--muted); font-family: var(--serif); font-style: italic;
}

.gate-form { display: flex; flex-direction: column; gap: 14px; }

.gate-error {
  margin: 0; padding: 9px 12px; border-radius: var(--radius-sm);
  background: #fbeceb; color: var(--danger); font-size: 13.5px;
}

.btn-block { width: 100%; margin-top: 4px; }

.gate-switch {
  margin: 20px 0 0; text-align: center;
  font-size: 13.5px; color: var(--muted);
}
.gate-switch .link { margin-left: 4px; }

/* ------------------------------------------------------------------ en-tête */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}

.topbar-inner {
  display: flex; align-items: center; gap: 18px;
  padding-top: 18px; padding-bottom: 16px;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #d9bb96, var(--accent) 70%);
}

.brand-name { font-family: var(--serif); font-size: 23px; letter-spacing: -.02em; }

.brand-tag {
  margin: 0; color: var(--muted); font-style: italic;
  font-family: var(--serif); font-size: 15px; flex: 1;
}

.account {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 1px; font-size: 12.5px; color: var(--muted);
}
.account .link { font-size: 12px; }

.tabs { display: flex; gap: 6px; }

.tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--muted);
  padding: 10px 2px 13px; margin-right: 22px;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.count {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px;
  background: var(--surface-2); border-radius: 20px;
  font-size: 12px; color: var(--muted);
}

/* ------------------------------------------------------------------ boutons */

.btn {
  appearance: none; cursor: pointer; font: inherit;
  padding: 9px 16px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #855a35; }

.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn-danger { color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.icon-btn {
  appearance: none; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  width: 30px; height: 30px; border-radius: 50%;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* -------------------------------------------------------------------- vues */

.view { display: none; padding: 28px 0 56px; }
.view.is-active { display: block; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}

.toolbar-right { display: flex; gap: 10px; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  appearance: none; cursor: pointer; font: inherit; font-size: 13px;
  padding: 6px 13px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.chip:hover { border-color: #cdbfa9; color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

input[type="text"], input[type="search"], input[type="number"],
input[type="email"], input[type="password"], select {
  font: inherit; color: var(--ink);
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
input:focus, select:focus, .btn:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type="search"] { width: 190px; }

/* ---------------------------------------------------------------- dressing */

.grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
}

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.card-media { position: relative; aspect-ratio: 4 / 5; background: var(--surface-2); }

.thumb {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; object-fit: cover;
}
.thumb-flat em { font-style: normal; font-size: 34px; opacity: .55; }

.card-wear {
  position: absolute; right: 8px; bottom: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .92);
  cursor: pointer; font-size: 14px; color: var(--ink);
  opacity: 0; transition: opacity .15s;
}
.card:hover .card-wear { opacity: 1; }
.card-wear:hover { background: #fff; }

.card-body { padding: 11px 13px 13px; }
.card-body h3 { font-size: 15px; line-height: 1.3; }
.card-meta { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.card-sub {
  margin: 7px 0 0; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 6px;
}
.cpw { margin-left: auto; color: var(--accent); }

.dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.no-result { color: var(--muted); font-style: italic; grid-column: 1 / -1; }

.empty {
  text-align: center; padding: 60px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.empty h2 { font-size: 22px; }
.empty p { color: var(--muted); max-width: 440px; margin: 10px auto 22px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ tenues */

.suggestion {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}

.suggestion-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.suggestion-head h2 { font-size: 24px; }
.suggestion-why { margin: 6px 0 0; color: var(--muted); font-family: var(--serif); font-style: italic; }

.score {
  margin-left: auto; text-align: center; flex: 0 0 auto;
  background: var(--accent-soft); border-radius: 50%;
  width: 64px; height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.score strong { font-family: var(--serif); font-size: 21px; line-height: 1; color: var(--accent); }
.score span { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }

.outfit-row {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.piece { margin: 0; cursor: pointer; }
.piece .thumb {
  aspect-ratio: 4 / 5; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2);
}
.piece:hover .thumb { border-color: var(--accent); }
.piece figcaption { display: block; padding: 8px 2px 0; }
.piece strong { display: block; font-size: 13.5px; font-weight: 500; }
.piece span { display: block; font-size: 12px; color: var(--muted); }

.suggestion-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

.section-title { font-size: 17px; margin: 38px 0 14px; }

.saved-list { display: flex; flex-direction: column; gap: 10px; }

.saved {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px;
}
.saved-thumbs { display: flex; gap: 5px; }
.saved-thumbs .thumb {
  width: 34px; height: 44px; border-radius: 5px; object-fit: cover;
  border: 1px solid var(--line);
}
.saved-body { flex: 1; min-width: 0; }
.saved-body h4 {
  font-size: 14.5px; font-family: var(--sans); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.saved-body p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.saved-actions { display: flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------------- stats */

.stat-row {
  display: grid; gap: 14px; margin-bottom: 30px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 2px;
}
.tile-value { font-family: var(--serif); font-size: 30px; line-height: 1.1; }
.tile-key { font-size: 13px; color: var(--muted); }
.tile-sub { font-size: 12px; color: var(--accent); margin-top: 4px; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px 24px;
}
.panel .section-title { margin-top: 0; }
.panel-hint { margin: -8px 0 14px; font-size: 12.5px; color: var(--muted); font-style: italic; }
.panel-split { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-top: 16px; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 148px 1fr 32px; align-items: center; gap: 12px; }
.bar-label { font-size: 13.5px; }
.bar-track { height: 8px; background: var(--surface-2); border-radius: 100px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 100px; }
.bar-value { font-size: 13px; color: var(--muted); text-align: right; }

.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.rank li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------- pied */

.foot {
  padding-top: 22px; padding-bottom: 40px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px;
}
.foot p { margin: 0; }

/* --------------------------------------------------------------- dialogue */

dialog {
  border: 0; border-radius: var(--radius); padding: 0;
  width: min(760px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 70px -20px rgba(31, 27, 22, .45);
}
dialog::backdrop { background: rgba(31, 27, 22, .42); backdrop-filter: blur(2px); }

.dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.dialog-head h2 { font-size: 19px; }

.dialog-body { display: grid; grid-template-columns: 220px 1fr; gap: 24px; padding: 22px 20px; }

.photo-drop { display: block; cursor: pointer; }
.photo-preview {
  aspect-ratio: 4 / 5; border-radius: var(--radius-sm);
  border: 1px dashed var(--line); background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; text-align: center;
}
.photo-preview:hover { border-color: var(--accent); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-hint { color: var(--muted); font-size: 13px; line-height: 1.7; }

.photo-clear {
  position: absolute; left: 0; right: 0; bottom: 0;
  border: 0; cursor: pointer; font: inherit; font-size: 12px;
  padding: 7px; background: rgba(31, 27, 22, .72); color: #fff;
}

.photo-note { margin: 10px 0 0; font-size: 12px; color: var(--muted); line-height: 1.45; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; align-content: start; }

.field { display: flex; flex-direction: column; gap: 5px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field > span em { font-style: normal; opacity: .7; }
.field-wide { grid-column: 1 / -1; }
.field-inline { flex-direction: row; align-items: center; width: auto; }
.field-inline select { width: auto; }
.field-hint { font-size: 11.5px; color: var(--accent); font-style: normal; min-height: 14px; }

.color-row { display: flex; align-items: center; gap: 10px; }
input[type="color"] {
  width: 48px; height: 36px; padding: 2px; cursor: pointer; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.color-name { font-style: normal; font-size: 13.5px; color: var(--muted); }

.dialog-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 20px; border-top: 1px solid var(--line); background: var(--surface-2);
}
.spacer { flex: 1; }

/* ------------------------------------------------------------------- toast */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  background: var(--ink); color: var(--bg);
  padding: 11px 20px; border-radius: 100px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 50;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* -------------------------------------------------------------- responsive */

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { flex-wrap: wrap; }
  .brand-tag { display: none; }
  .account { align-items: flex-start; }
  .dialog-body { grid-template-columns: 1fr; }
  .photo-preview { aspect-ratio: 16 / 9; }
  .form-grid { grid-template-columns: 1fr; }
  .panel-split { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 120px 1fr 28px; }
  .toolbar-right { width: 100%; }
  input[type="search"] { flex: 1; width: auto; }
}
