/* Generation UI: the style picker and the live generation cards. */

.style-picker-card {
  background: var(--paper-card);
  border: var(--border-hard);
  box-shadow: 5px 5px 0 rgba(16, 16, 16, 0.9);
  padding: var(--space-5);
  margin-top: var(--space-4);
  max-width: 34rem;
}

.style-picker-form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-3);
  justify-items: start;
}

.focus-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--space-2);
  width: 100%;
}

.focus-option {
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--paper);
  padding: 0.6em 0.75em;
  display: grid;
  gap: 0.3em;
  align-content: start;
}

.focus-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.focus-name {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.focus-hint {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.focus-option:hover {
  border-color: var(--ink);
}

.focus-option:has(input:checked) {
  border: 1.5px solid var(--accent);
  box-shadow: 3px 3px 0 rgba(43, 60, 255, 0.65);
}

.focus-option:has(input:checked) .focus-name {
  color: var(--accent);
}

.focus-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The focus modes as a disclosure (2026-07-24). Four cards with hint
   text cost ~280px of a rail whose whole job is to fit one screen, for
   a control most renders leave on the default. Collapsed, the summary
   still states the active mode, so nothing is hidden in effect: the
   row reads as an answer, not as a thing to go find. */

.focus-details {
  width: 100%;
}

.focus-details > summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  cursor: pointer;
  list-style: none;
  padding-block: var(--space-1);
}

.focus-details > summary::-webkit-details-marker {
  display: none;
}

.focus-summary-value {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  /* On phone widths the summary row is too narrow for both label and
     value: the label may wrap, the mode name may not ("DECIDE FOR / ME"
     read as two settings). */
  white-space: nowrap;
}

/* Caret in the same hairline geometry as the room select's. */
.focus-summary-value::after {
  content: "";
  width: 0.38em;
  height: 0.38em;
  border-right: 1.5px solid currentcolor;
  border-bottom: 1.5px solid currentcolor;
  transform: translateY(-0.15em) rotate(45deg);
  transition: transform 150ms ease;
}

.focus-details[open] > summary .focus-summary-value::after {
  transform: translateY(0.05em) rotate(-135deg);
}

.focus-details > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.focus-details .focus-picker {
  margin-top: var(--space-2);
}

/* Workspace tool switcher (OVERHAUL.md Phase D): a three-way segmented
   control at the top of the form. Paid tools render as padlocked links
   for free users, same fence language as the quality tiers. */

.tool-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1.5px solid var(--line-strong);
  width: 100%;
}

.tool-tab {
  position: relative;
  cursor: pointer;
  text-align: center;
  padding: 0.5em 0.3em;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-decoration: none;
  background: var(--paper);
}

.tool-tab + .tool-tab {
  border-left: 1.5px solid var(--line);
}

.tool-tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tool-tab:hover {
  color: var(--ink);
}

.tool-tab:has(input:checked) {
  background: var(--ink);
  color: var(--paper);
}

.tool-tab:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tool-tab.is-locked {
  background: var(--paper-deep);
  padding-right: 1.1em;
}

.tool-tab.is-locked .quality-lock {
  top: 0.55em;
  right: 0.35em;
  width: 0.55rem;
}

.tool-tab.is-locked:hover {
  color: var(--accent);
}

.tool-tab.is-locked:hover .quality-lock {
  fill: var(--accent);
}

/* Room selector (OVERHAUL.md decision 4) and the optional focus note
   (decision 5): plain inputs in the rail's card language. */

.room-picker {
  position: relative;
  display: grid;
  gap: var(--space-2);
  width: 100%;
}

.room-select,
.room-detail,
.focus-note {
  width: 100%;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 0;
  padding: 0.5em 0.6em;
}

/* The select was the one control in the rail still wearing its OS
   chrome: a native double-chevron and platform metrics sitting between
   a custom segmented control and custom radio cards. appearance: none
   hands the affordance to a drawn caret so the rail reads as one
   system. The caret is CSS geometry, not an SVG data URI, because hard
   hairline angles are already this design's vocabulary. */
.room-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.1em;
  cursor: pointer;
}

.room-picker::after {
  content: "";
  position: absolute;
  top: 1.15em;
  right: 0.85em;
  width: 0.42em;
  height: 0.42em;
  border-right: 1.5px solid var(--ink-soft);
  border-bottom: 1.5px solid var(--ink-soft);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
  transition: border-color 150ms ease;
}

.room-picker:hover::after {
  border-color: var(--ink);
}

/* Required and still on its prompt: the room gates every render, so the
   unpicked state reads as work outstanding rather than as a filled
   field. :invalid is exact here, the prompt option carries no value. */
.room-select:invalid {
  color: var(--ink-soft);
}

.room-select:hover,
.room-detail:hover,
.focus-note:hover {
  border-color: var(--ink);
}

.room-select:focus-visible,
.room-detail:focus-visible,
.focus-note:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.focus-note {
  resize: vertical;
  min-height: 3.2em;
}

.label-optional {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-left: 0.4em;
}

/* The free tier's fenced note field: same dashed lock language as the
   locked quality tiers, one tap from pricing. */
.focus-note-locked {
  position: relative;
  display: block;
  width: 100%;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border: 1.5px dashed var(--line);
  padding: 0.55em 1.8em 0.55em 0.6em;
  text-decoration: none;
}

.focus-note-locked em {
  font-style: normal;
  color: var(--ink);
}

.focus-note-locked:hover {
  border-color: var(--accent);
  border-style: solid;
}

.focus-note-locked:hover .quality-lock {
  fill: var(--accent);
}

/* Quality picker (OVERHAUL.md decision 3): same card language as the
   focus picker. For free users the paid tiers render as locked links
   into pricing: the fence lives inside the working UI, honestly. */

.quality-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: var(--space-2);
  width: 100%;
}

.quality-option {
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--paper);
  padding: 0.6em 0.75em;
  display: grid;
  gap: 0.3em;
  align-content: start;
  text-decoration: none;
}

.quality-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quality-name {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.quality-hint {
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.quality-cost {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 0.1em 0.5em;
  border-radius: var(--radius-pill);
}

.quality-option:hover {
  border-color: var(--ink);
}

.quality-option:has(input:checked),
.quality-option.is-current {
  border: 1.5px solid var(--accent);
  box-shadow: 3px 3px 0 rgba(43, 60, 255, 0.65);
}

.quality-option:has(input:checked) .quality-name,
.quality-option.is-current .quality-name {
  color: var(--accent);
}

.quality-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.quality-option.is-current {
  cursor: default;
}

/* The locked tiers: readable, real, and one tap from pricing. The lock
   sits where a checked state would, so the eye reads "this exists and
   is closed", not "this is broken". */
.quality-option.is-locked {
  background: var(--paper-deep);
  border-style: dashed;
}

.quality-option.is-locked .quality-name,
.quality-option.is-locked .quality-hint {
  color: var(--ink-soft);
}

.quality-lock {
  position: absolute;
  top: 0.6em;
  right: 0.65em;
  width: 0.7rem;
  height: auto;
  fill: var(--ink-soft);
}

.quality-option.is-locked:hover {
  border-color: var(--accent);
  border-style: solid;
}

.quality-option.is-locked:hover .quality-lock {
  fill: var(--accent);
}

.quality-option.is-locked:hover .quality-name {
  color: var(--accent);
}

.style-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: var(--space-2);
  width: 100%;
  max-height: 24rem;
  overflow-y: auto;
  padding-right: var(--space-1);
}

.style-option {
  position: relative;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--paper);
  display: grid;
}

.style-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.style-option img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.style-option span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35em 0.5em;
  color: var(--ink-soft);
}

.style-option:hover {
  border-color: var(--ink);
}

.style-option:has(input:checked) {
  border: 1.5px solid var(--accent);
  box-shadow: 3px 3px 0 rgba(43, 60, 255, 0.65);
}

.style-option:has(input:checked) span {
  background: var(--accent);
  color: #fff;
}

.style-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Generation cards */

.generations {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
  max-width: 34rem;
}

.generation-card {
  background: var(--paper-card);
  border: var(--border-hard);
  box-shadow: 5px 5px 0 rgba(16, 16, 16, 0.9);
  overflow: hidden;
}

.generation-photo {
  width: 100%;
  height: auto;
  display: block;
}

.generation-meta {
  padding: var(--space-3) var(--space-4);
  display: grid;
  gap: var(--space-2);
}

.generation-style {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
}

.generation-note {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.generation-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}

/* Four full-length labels wrapped onto a second row and stranded the
   last one. The labels are shorter now ("Regenerate", "Change style");
   this keeps the row honest at narrow canvas widths without letting a
   single button orphan itself. */
.generation-actions .btn-sm {
  flex: 0 1 auto;
}

/* An edit render is identified by what it changed, not by the tool that
   made it: every one of them read "ONE CHANGE" otherwise. The
   instruction is the user's own sentence, so it stays in sentence case
   under a mono kicker rather than being shouted in uppercase. */
.generation-edit-note {
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--ink);
  font-style: italic;
  max-width: 34rem;
}

.generation-meta-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.generation-when {
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.generation-before {
  text-align: right;
  flex-shrink: 0;
}

.generation-before img {
  width: 5rem;
  height: auto;
  border: 1px solid var(--line);
  display: block;
}

.generation-before figcaption {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  margin-top: 0.2em;
}

.generations-empty {
  border: 1.5px dashed var(--line);
  padding: var(--space-5);
  color: var(--ink-soft);
}

/* The render wait: an architect's-ruler progress bar (OVERHAUL era,
   2026-07-24; replaces the spinner, which read as stuck). The track
   carries scale ticks every 10%, the fill is the IKB accent with a
   moving sheen so motion never dies even while the percentage crawls,
   and the stage line narrates the design brief in mono. */

.generation-pending {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
}

.render-progress {
  display: grid;
  gap: 0.45em;
}

.render-progress-track {
  height: 10px;
  border: 1.5px solid var(--line-strong);
  background:
    repeating-linear-gradient(90deg,
      transparent 0, transparent calc(10% - 1px),
      var(--line) calc(10% - 1px), var(--line) 10%),
    var(--paper-deep);
}

.render-progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.5s linear;
  overflow: hidden;
}

.render-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg,
    transparent 30%, rgba(251, 251, 248, 0.45) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: render-sheen 1.8s ease-in-out infinite;
}

@keyframes render-sheen {
  to { transform: translateX(100%); }
}

.render-progress-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.render-progress-stage {
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.render-progress-stage.is-in {
  opacity: 1;
}

.render-progress-pct {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .render-progress-fill {
    transition: none;
  }

  .render-progress-fill::after {
    animation: none;
  }

  .render-progress-stage {
    transition: none;
  }
}

/* Lightbox: the expanded view of a finished render */

.lightbox {
  /* The global `* { margin: 0 }` reset kills the UA rule that centers
     native dialogs; margin: auto restores it. */
  margin: auto;
  border: var(--border-hard);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: var(--space-3);
  max-width: min(92vw, 70rem);
  box-shadow: var(--shadow-deep);
}

.lightbox::backdrop {
  background: rgba(16, 16, 16, 0.72);
  backdrop-filter: blur(4px);
}

.lightbox img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  margin-inline: auto;
  border-radius: var(--radius-md);
}

.lightbox figcaption {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--ink-soft);
  padding-top: var(--space-2);
}

.lightbox-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
