/* Outfit Roller
   Palette borrowed from the clothes themselves: raw indigo denim, tailor's
   chalk, and brass hardware. Brass means one thing only — this slot is
   fastened and will survive the next roll. */

:root {
  --ground:    #10162A;
  --panel:     #19223D;
  --stitch:    #38477A;
  --chalk:     #EDE7DA;
  --dim:       #8B95B8;
  --brass:     #DCA84A;
  --rust:      #C8624A;

  /* System faces only — the app loads nothing from the internet, so it is
     instant and works even with no signal. Avenir Next Condensed ships on
     every iPhone and Mac; the mono stack resolves to SF Mono on iOS. */
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --display: "Avenir Next Condensed", "Avenir Next", "Arial Narrow",
             "Helvetica Neue", sans-serif;

  --gutter: 22px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--chalk);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

form { margin: 0; }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 26px var(--gutter) 60px;
}

/* ---- Top bar ------------------------------------------------------- */

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 560px;
  margin: 0 auto;
  padding: 18px var(--gutter) 0;
}

.bar__mark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--chalk);
}

.bar__nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.linkish {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  text-decoration: none;
  cursor: pointer;
}

.linkish:hover,
.linkish:active { color: var(--chalk); }

/* ---- The three slots ----------------------------------------------- */

/* Fill the screen so the roll button lands in thumb reach, but grow
   normally if the item names run long. */
.rig {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 150px);
  margin-top: 16px;
}

.rig .roll { margin-top: auto; }

/* ---- Outfit type ---------------------------------------------------- */

.looks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.look {
  appearance: none;
  padding: 9px 13px;
  border: 1px solid var(--stitch);
  border-radius: 999px;
  background: none;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

/* The current look is outlined in chalk, never brass — brass stays reserved
   for a locked slot so the two states can never be confused. */
.look--on {
  color: var(--chalk);
  border-color: var(--chalk);
  font-weight: 600;
}

.slot {
  position: relative;
  padding: 20px 18px 24px;
  border-top: 1px dashed var(--stitch);
  transition: background 180ms ease, box-shadow 180ms ease;
}

.slot:last-of-type { border-bottom: 1px dashed var(--stitch); }

.slot__toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.slot__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

/* Looks with four garments get tighter so everything still fits above the
   fold on a phone. */
.rig--4 .slot { padding: 12px 18px 16px; }
.rig--4 .slot__name { font-size: clamp(1.7rem, 8.4vw, 2.5rem); }

.slot__cat {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
  transition: color 180ms ease;
}

.slot__lock {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--stitch);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  user-select: none;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}

.slot__lock-on { display: none; }

.slot__name {
  margin: 6px 0 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.1rem, 11vw, 3.3rem);
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  overflow-wrap: break-word;
  animation: settle 420ms cubic-bezier(0.16, 0.84, 0.3, 1) both;
}

.slot__name--empty { color: var(--dim); }

.slot__name--empty a {
  color: inherit;
  text-decoration-color: var(--stitch);
  text-underline-offset: 6px;
}

@keyframes settle {
  0%   { opacity: 0; transform: translateY(-20px); }
  72%  { opacity: 1; transform: translateY(3px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Fastened. The brass edge is the rivet; the slot sits out the next roll,
   so it also sits out the settle animation — motion tells you what changed. */

.slot:has(.slot__toggle:checked) {
  background: linear-gradient(90deg, rgba(220, 168, 74, 0.09), transparent 70%);
  box-shadow: inset 3px 0 0 var(--brass);
}

.slot:has(.slot__toggle:checked) .slot__cat { color: var(--brass); }

.slot:has(.slot__toggle:checked) .slot__lock {
  color: var(--brass);
  border-color: var(--brass);
  background: rgba(220, 168, 74, 0.1);
}

.slot:has(.slot__toggle:checked) .slot__lock-off { display: none; }
.slot:has(.slot__toggle:checked) .slot__lock-on  { display: inline; }
.slot:has(.slot__toggle:checked) .slot__name     { animation: none; }

/* ---- Primary action ------------------------------------------------ */

.roll {
  display: block;
  width: 100%;
  margin-top: 28px;
  padding: 20px;
  border: 0;
  border-radius: 3px;
  background: var(--chalk);
  color: var(--ground);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 90ms ease, background 160ms ease;
}

.roll:active {
  transform: translateY(2px);
  background: #FFFFFF;
}

.hint {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---- Forms --------------------------------------------------------- */

.field { display: block; }

.field__label {
  display: block;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
}

.field__input {
  width: 100%;
  padding: 16px 14px;
  border: 1px solid var(--stitch);
  border-radius: 3px;
  background: var(--panel);
  color: var(--chalk);
  font-family: var(--mono);
  font-size: 16px; /* 16px keeps iOS Safari from zooming on focus */
}

.field__input::placeholder { color: #5C678F; }

.field__input:focus {
  border-color: var(--brass);
  outline: none;
}

/* Segmented category picker */

.pick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.pick__radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pick__label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--stitch);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  user-select: none;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.pick__radio:checked + .pick__label {
  color: var(--brass);
  border-color: var(--brass);
  background: rgba(220, 168, 74, 0.1);
}

/* ---- Closet racks -------------------------------------------------- */

.add { margin-bottom: 46px; }

.rack { margin-top: 38px; }

.rack__title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 4px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--stitch);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--chalk);
}

.rack__count { color: var(--dim); letter-spacing: 0; }

.rack__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rack__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(56, 71, 122, 0.35);
}

.rack__name {
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.remove {
  flex: none;
  appearance: none;
  background: none;
  border: 0;
  padding: 12px 0 12px 14px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  cursor: pointer;
  transition: color 140ms ease;
}

.remove:hover,
.remove:active { color: var(--rust); }

.rack__empty {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--dim);
}

/* ---- Sign in ------------------------------------------------------- */

.gate .wrap {
  display: flex;
  align-items: center;
  min-height: 100dvh;
  padding-top: 0;
  padding-bottom: 0;
}

.signin { width: 100%; }

.signin__mark {
  margin: 0 0 34px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
}

.alert {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--rust);
}

/* ---- Motion preferences -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
