@import url("/static/fonts/fonts.css");

/* StyleTry — редакционная примерочная: бумага, чернила, бордо только для выбора и действия. */
:root {
  --paper: #f3eee6;
  --paper-2: #e9e1d5;
  --card: #fbf8f3;
  --ink: #1d1915;
  --ink-soft: #625a51;
  --line: #d6ccbe;
  --accent: #7b2233;
  --accent-ink: #fbf3f0;
  --ok: #3f5e4a;
  --warn: #9a4b25;

  --font-display: "Cormorant", "Cormorant Garamond", Georgia, serif;
  --font-text: "Golos", "Golos Text", system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  --text-h2: clamp(1.9rem, 1.4rem + 1.8vw, 2.9rem);
  --text-hero: clamp(3.2rem, 1.6rem + 7vw, 8.5rem);

  --space-1: 0.375rem;
  --space-2: 0.75rem;
  --space-3: 1.25rem;
  --space-4: 2rem;
  --space-5: clamp(2.5rem, 2rem + 3vw, 5rem);

  --radius-tile: 2px;
  --radius-pill: 999px;
  --shadow-lift: 0 18px 40px -22px rgb(29 25 21 / 0.45);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 160ms;
  --slow: 520ms;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 400 var(--text-base)/1.55 var(--font-text);
  background-color: var(--paper);
  /* бумажное зерно */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.11 0 0 0 0 0.09 0 0 0 0 0.08 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.eyebrow {
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.display { font-family: var(--font-display); font-weight: 500; line-height: 0.95; letter-spacing: -0.01em; }
.display em { font-style: italic; color: var(--accent); }

/* --- шапка --- */
.masthead {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--ink);
}
.wordmark { font-family: var(--font-display); font-style: italic; font-size: 2rem; text-decoration: none; color: var(--ink); }
.masthead nav { display: flex; align-items: baseline; gap: var(--space-3); font-size: var(--text-sm); color: var(--ink-soft); }
.linkish { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.linkish:hover { color: var(--accent); }

/* --- приветствие --- */
.welcome { min-height: calc(100vh - 80px); display: grid; align-content: end; padding: var(--space-5) var(--space-4); gap: var(--space-4); }
.welcome h1 { font-size: var(--text-hero); margin: 0; max-width: 11ch; }
.welcome p { max-width: 42ch; margin: 0; color: var(--ink-soft); }
.welcome .note { border-left: 2px solid var(--accent); padding-left: var(--space-2); color: var(--ink); }

/* --- студия: сцена слева, гардероб справа --- */
.studio {
  display: grid;
  grid-template-columns: minmax(280px, 5fr) minmax(320px, 7fr);
  gap: 0;
  min-height: calc(100vh - 80px);
}
.stage {
  position: sticky; top: 0; align-self: start; height: calc(100vh - 80px);
  display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-3);
  padding: var(--space-4);
  border-right: 1px solid var(--line);
}
.stage h2, .wardrobe h2 { font-size: var(--text-h2); margin: 0; }
.stage-frame {
  position: relative; overflow: hidden; min-height: 0;
  background: var(--paper-2);
  display: grid; place-items: center;
}
.stage-frame img { width: 100%; height: 100%; object-fit: contain; }
.stage-frame .empty { padding: var(--space-4); text-align: center; color: var(--ink-soft); max-width: 30ch; }
.stage-frame.loading::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(251 248 243 / 0.55) 50%, transparent 70%);
  transform: translateX(-100%); animation: sheen 1.6s var(--ease) infinite;
}
.stage-status { position: absolute; left: var(--space-2); bottom: var(--space-2); background: var(--card); padding: 4px 10px; font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; }
@keyframes sheen { to { transform: translateX(100%); } }

.cta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  width: 100%; padding: 1.05rem 1.4rem; border: 0; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
  font-weight: 600; letter-spacing: 0.02em;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease), opacity var(--fast);
}
.cta:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.cta:active:not(:disabled) { transform: translateY(0); }
.cta:disabled { opacity: 0.35; cursor: not-allowed; }
.cta small { font-weight: 400; opacity: 0.85; }

.wardrobe { padding: var(--space-4); display: grid; gap: var(--space-5); align-content: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); margin-bottom: var(--space-3); }
.section-head .count { font-family: var(--font-display); font-style: italic; font-size: 1.4rem; color: var(--ink-soft); }

/* люди — узкие портреты в ряд */
.people { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: var(--space-1); scroll-snap-type: x proximity; }
.person { flex: 0 0 112px; scroll-snap-align: start; }
/* вещи — неровная сетка: первая вещь крупнее */
.garments { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: var(--space-3) var(--space-2); }

.tile { position: relative; }
.tile .pick { display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; }
.tile .pic {
  aspect-ratio: 3 / 4; overflow: hidden; border-radius: var(--radius-tile);
  background: var(--card); outline: 1px solid var(--line);
  transition: transform var(--slow) var(--ease), box-shadow var(--slow) var(--ease), outline-color var(--fast);
}
.garments .tile .pic { aspect-ratio: 1; padding: 10px; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; }
.garments .tile .pic img { object-fit: contain; }
.tile:hover .pic { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.tile .label { margin-top: 6px; font-size: var(--text-sm); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile[data-selected="true"] .pic { outline: 2px solid var(--accent); }
.tile .badge {
  position: absolute; top: 8px; left: 8px; min-width: 26px; height: 26px; padding: 0 7px;
  display: grid; place-items: center; border-radius: var(--radius-pill);
  background: var(--accent); color: var(--accent-ink); font-size: var(--text-xs); font-weight: 600;
  z-index: 2; /* приподнятая при наведении карточка (transform) иначе перекрывает значок */
  transform: scale(0.4); opacity: 0; transition: transform var(--fast) var(--ease), opacity var(--fast);
}
.tile[data-selected="true"] .badge { transform: scale(1); opacity: 1; }
.tile .remove {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgb(251 248 243 / 0.92); color: var(--ink-soft); cursor: pointer;
  z-index: 2; opacity: 0; transition: opacity var(--fast);
}
.tile:hover .remove, .tile:focus-within .remove { opacity: 1; }
.tile .remove:hover { color: var(--warn); }

.add {
  display: grid; place-items: center; aspect-ratio: 3 / 4; width: 100%;
  border: 1px dashed var(--ink-soft); border-radius: var(--radius-tile); background: transparent;
  color: var(--ink-soft); cursor: pointer; font-size: var(--text-sm);
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.garments .add { aspect-ratio: 1; }
.person .add { width: 112px; }
.add:hover { border-color: var(--accent); color: var(--accent); background: var(--card); }
.add span { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; display: block; }

/* образы — лента-лукбук */
.looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--space-3); }
.look figure { margin: 0; }
.look .pic { aspect-ratio: 3 / 4; background: var(--paper-2); overflow: hidden; }
.look .pic img { width: 100%; height: 100%; object-fit: cover; animation: reveal var(--slow) var(--ease); }
.look figcaption { display: flex; justify-content: space-between; gap: var(--space-1); margin-top: 6px; font-size: var(--text-xs); color: var(--ink-soft); }
.look .status-failed { color: var(--warn); }
.look a { color: inherit; }
@keyframes reveal { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }

/* диалог загрузки */
dialog { border: 0; padding: 0; background: var(--card); color: var(--ink); width: min(420px, calc(100vw - 2rem)); box-shadow: var(--shadow-lift); }
dialog::backdrop { background: rgb(29 25 21 / 0.45); }
dialog form { display: grid; gap: var(--space-3); padding: var(--space-4); }
dialog h3 { font-family: var(--font-display); font-weight: 500; font-size: 2rem; margin: 0; }
dialog img { max-height: 240px; margin: 0 auto; }
dialog label { display: grid; gap: 6px; font-size: var(--text-sm); color: var(--ink-soft); }
dialog input[type="text"] { padding: 0.7rem 0.8rem; border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-tile); }
dialog .row { display: flex; gap: var(--space-2); justify-content: flex-end; align-items: center; }
.ghost { background: none; border: 0; padding: 0.7rem 1rem; cursor: pointer; color: var(--ink-soft); }

.toast {
  position: fixed; left: 50%; bottom: var(--space-3); transform: translate(-50%, 140%);
  background: var(--ink); color: var(--paper); padding: 0.75rem 1.1rem; max-width: min(90vw, 460px);
  transition: transform var(--slow) var(--ease); z-index: 10;
}
.toast.show { transform: translate(-50%, 0); }

/* мобильная раскладка: сцена сверху, кнопка липнет к низу */
@media (max-width: 860px) {
  .masthead { padding: var(--space-2) var(--space-3); }
  .studio { grid-template-columns: 1fr; }
  .stage { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: var(--space-3); }
  .stage-frame { aspect-ratio: 3 / 4; max-height: 70vh; }
  .stage .cta { position: fixed; left: var(--space-2); right: var(--space-2); bottom: var(--space-2); width: auto; z-index: 5; box-shadow: var(--shadow-lift); }
  .wardrobe { padding: var(--space-3); padding-bottom: 6rem; }
  .welcome { padding: var(--space-4) var(--space-3); }
}

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