/* ==========================================================================
   Fauve: editorial fashion styling
   All colors are custom properties on :root. Dark theme follows the system.
   ========================================================================== */

:root {
  /* Paper and ink */
  --paper: #f6f0e4;
  --paper-2: #ede4d3;
  --paper-3: #e3d8c3;
  --ink: #1a1612;
  --ink-2: #4f473b;
  --ink-3: #6b6252;
  --on-ink: #f6f0e4;

  /* Lines */
  --rule: #cdc2ad;
  --rule-strong: #1a1612;
  --field-bg: #fbf8f1;
  --field-line: #8a8170;

  /* Accent, focus and messages */
  --accent: #b8381b;
  --on-accent: #ffffff;
  --focus: #1d4ed8;
  --danger: #8f2a12;
  --danger-bg: #f8e1da;

  /* Flat-lay board stays light in both themes, like a photo on a table */
  --flatlay-bg: #ece4d4;

  /* Effects */
  --shadow-pop: 0 8px 24px rgba(26, 22, 18, 0.18);

  /* Photo box: the same in light and dark, because it sits on a photo */
  --crop-dim: rgba(21, 18, 14, 0.58);
  --crop-line: #ffffff;
  --crop-edge: rgba(21, 18, 14, 0.7);

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --gutter: 16px;
  --max: 1240px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15120e;
    --paper-2: #1e1a14;
    --paper-3: #292319;
    --ink: #f1eadb;
    --ink-2: #c6bba8;
    --ink-3: #a79c87;
    --on-ink: #15120e;

    --rule: #3b342a;
    --rule-strong: #f1eadb;
    --field-bg: #1a1610;
    --field-line: #8c8270;

    --accent: #f0805f;
    --on-accent: #15120e;
    --focus: #8fb4ff;
    --danger: #ffb4a0;
    --danger-bg: #3a1c14;

    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.55);
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
p,
ul,
ol,
fieldset {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--on-ink);
  text-decoration: none;
}

.skip-link:focus {
  top: var(--gutter);
}

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

.noscript {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px var(--gutter);
  color: var(--danger);
}

/* ---------- Masthead ---------- */

.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 22px;
  border-bottom: 1px solid var(--rule-strong);
  position: relative;
}

.masthead::after {
  content: "";
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: -5px;
  border-bottom: 1px solid var(--rule-strong);
}

.eyebrow,
.label,
.sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.wordmark {
  margin-top: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.7rem, 8.6vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  color: var(--ink);
}

/* The name is the address: AnimalKingdom.style. ".style" is part of it,
   full size, set in italic in the accent color: the name's own bit of
   style. On a narrow screen it breaks after "Animal", never inside
   "Kingdom.style". */
.wordmark-break {
  white-space: nowrap;
}

.wordmark-tld {
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.tagline {
  margin-top: 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 3.4vw, 1.6rem);
  color: var(--ink-2);
}

/* ---------- Page layout ---------- */

.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 36px var(--gutter) 56px;
  display: grid;
  gap: 44px;
}

.inputs {
  min-width: 0;
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
    column-gap: 64px;
    align-items: start;
  }
}

/* ---------- Panels ---------- */

.panel {
  padding: 22px 0 30px;
  border-top: 1px solid var(--rule-strong);
}

.panel:first-child {
  padding-top: 18px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.panel-num {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--accent);
}

.panel h2,
.results h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.panel-intro {
  margin-bottom: 18px;
  color: var(--ink-2);
}

.hint,
.blurb {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.blurb {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
}

/* ---------- Form fields ---------- */

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
  margin-top: 16px;
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 6px;
}

.field > label,
.field > .label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

input[type="number"],
input[type="text"],
select {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 9px 12px;
  background-color: var(--field-bg);
  color: var(--ink);
  border: 1px solid var(--field-line);
  border-radius: 2px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

input:hover,
select:hover {
  border-color: var(--ink);
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 21px) 50%, calc(100% - 15px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

input[aria-invalid="true"] {
  border-color: var(--danger);
  border-width: 2px;
}

.range {
  min-height: 1.2em;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.range.is-bad {
  color: var(--danger);
  font-weight: 600;
}

.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pair .field > label {
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 500;
  font-size: 0.8rem;
}

/* Segmented toggles (real radio inputs) */

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin-top: 4px;
}

.seg {
  position: relative;
  display: inline-flex;
  border: 1px solid var(--ink);
  border-radius: 2px;
}

.seg input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.seg label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: var(--tap);
  padding: 0 16px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.seg label + input + label {
  border-left: 1px solid var(--ink);
}

.seg input:checked + label {
  background: var(--ink);
  color: var(--on-ink);
}

.seg input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Quick sizing: a row of letter sizes that wraps on a narrow screen. */
.quick-size {
  margin-top: 18px;
  border: 0;
  padding: 0;
}

.seg-letters {
  display: flex;
  flex-wrap: wrap;
}

.seg-letters label {
  min-width: 56px;
  padding: 0 12px;
  border-bottom: 1px solid var(--ink);
  margin-bottom: -1px;
}

/* Disclosures */

.disclosure {
  margin-top: 20px;
  border-top: 1px solid var(--rule);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap);
  cursor: pointer;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

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

.disclosure > summary::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
}

.disclosure[open] > summary::after {
  content: "\2212";
}

.disclosure-body {
  padding: 4px 0 8px;
}

.how-list {
  list-style: none;
  padding: 4px 0 8px;
  display: grid;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.how-list strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: var(--ink);
  color: var(--on-ink);
}

.btn-primary {
  width: 100%;
  min-height: 56px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.9rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn:disabled {
  cursor: not-allowed;
  background: var(--paper-3);
  border-color: var(--rule);
  color: var(--ink-3);
}

.build {
  padding-top: 24px;
  border-top: 1px solid var(--rule-strong);
}

/* ---------- Drop zone ---------- */

.drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  padding: 24px 16px;
  text-align: center;
  background: var(--paper-2);
  border: 1.5px dashed var(--ink-3);
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.drop:hover,
.drop.is-over {
  background: var(--paper-3);
  border-color: var(--accent);
}

.drop-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
}

.drop-sub {
  margin-top: 6px;
  max-width: 28ch;
  margin-inline: auto;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.drop[hidden] {
  display: none;
}

/* ---------- Photo and box ---------- */

/* The stage is exactly the size of the <img>. The picture is letterboxed inside it
   with object-fit: contain, and app.js works out where the real picture sits. */
.photo-frame {
  background: var(--paper-3);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}

.photo-stage {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  touch-action: none;
}

.photo-img {
  display: block;
  width: 100%;
  height: clamp(200px, 62vw, 320px);
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--crop-line);
  outline: 1px solid var(--crop-edge);
  box-shadow: 0 0 0 9999px var(--crop-dim);
  pointer-events: none;
}

.photo.is-over .photo-frame {
  border-color: var(--accent);
  border-width: 2px;
}

.photo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 10px;
}

.photo-note {
  font-size: 0.82rem;
  color: var(--ink-2);
}

.btn-small {
  padding: 0 16px;
  font-size: 0.74rem;
}

/* ---------- Animal check ---------- */

/* A live region. It stays in the page, empty, so a change is read out. */
.animal:not(:empty) {
  margin-top: 12px;
}

.animal-line {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.animal-note {
  font-size: 0.9rem;
  color: var(--ink-2);
}

/* Kind, not alarming: the same warm note as the "choices changed" line. */
.animal-reject {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  background: var(--paper-2);
}

.animal-reject p {
  font-weight: 600;
}

/* ---------- Palette ---------- */

.palette {
  margin-top: 20px;
}

.palette .sub {
  margin-bottom: 10px;
}

.empty-note,
.status {
  font-size: 0.9rem;
  color: var(--ink-2);
}

.chips {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 12px;
}

.chip {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}

.chip.is-derived {
  border-style: dashed;
  border-color: var(--ink-3);
}

.chip-swatch {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  min-height: 98px;
  padding: 8px;
  border-bottom: 1px solid var(--rule);
}

/* 44px touch target in the bottom corner, below the role tags */
.chip-remove {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.chip-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
}

.chip-remove:hover .chip-x {
  background: var(--crop-edge);
  color: var(--crop-line);
  border-color: var(--crop-line);
}

.chip-remove:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.chip-remove:disabled:hover .chip-x {
  background: transparent;
  color: inherit;
  border-color: currentColor;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-top: 4px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--accent);
}

.role-tag {
  padding: 2px 6px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.chip-meta {
  padding: 8px 10px 10px;
}

.chip-name {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.chip-hex,
.chip-pct,
.chip-note {
  margin-top: 2px;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.chip-note {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.78rem;
}

.chips-skeleton .chip {
  border-color: var(--rule);
}

.chips-skeleton .chip-swatch {
  background: var(--paper-3);
  border-bottom: 0;
}

.harmony {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.harmony-line {
  margin-top: 4px;
  color: var(--ink-2);
}

.harmony-line strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.error {
  padding: 12px 14px;
  background: var(--danger-bg);
  border-left: 4px solid var(--danger);
  color: var(--ink);
}

.error-title {
  font-weight: 600;
  color: var(--danger);
}

/* ---------- Results ---------- */

.results {
  min-width: 0;
}

.results-empty {
  padding: 40px 24px;
  text-align: center;
  border: 1px dashed var(--ink-3);
  background: var(--paper-2);
}

.results .results-empty h2 {
  font-size: 1.5rem;
}

.results-empty p {
  max-width: 40ch;
  margin: 10px auto 0;
  color: var(--ink-2);
}

.results h2 {
  font-size: clamp(2rem, 5vw, 2.75rem);
  scroll-margin-top: 16px;
}

.results h2:focus {
  outline: none;
}

.stale {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  background: var(--paper-2);
  font-size: 0.92rem;
}

.summary {
  margin-top: 14px;
  max-width: 60ch;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  line-height: 1.4;
}

/* The animal's design story sits right under the color summary. */
.design {
  max-width: 60ch;
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 4px solid var(--accent);
  background: var(--paper-2);
}

.design-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
}

.design-mood {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-2);
}

.design-story {
  margin-top: 8px;
  font-size: 0.98rem;
  line-height: 1.5;
}

.strip {
  display: flex;
  height: 10px;
  margin-top: 18px;
  border: 1px solid var(--rule-strong);
}

.strip span {
  display: block;
  min-width: 6px;
}

.flatlay-box {
  margin-top: 18px;
  border: 1px solid var(--rule-strong);
  background: var(--flatlay-bg);
}

.flatlay-box svg {
  display: block;
  width: 100%;
  height: auto;
}

/* "See it for real": the realistic AI photo of the outfit. */
.look {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
}

.look-intro {
  margin: 6px 0 12px;
  font-size: 0.92rem;
  color: var(--ink-2);
}

.look-msg {
  margin: 0;
  font-size: 0.9rem;
}

.look-check:empty {
  display: none;
}

.look-check {
  margin-top: 10px;
}

.look-photo {
  margin: 14px 0 0;
}

.look-photo img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule-strong);
  background: var(--flatlay-bg);
}

.look-photo figcaption {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.fl-bg {
  fill: var(--flatlay-bg);
}

.cards {
  list-style: none;
  padding: 0;
  margin-top: 22px;
  border-bottom: 1px solid var(--rule);
}

.card {
  position: relative;
  padding: 18px 0 20px;
  border-top: 1px solid var(--rule);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.tag-hero {
  padding: 2px 7px;
  border-radius: 2px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

/* Marks the piece that carries the animal's print or texture. */
.tag-animal {
  padding: 1px 6px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.include {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding-left: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.include input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.card-body {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  margin-top: 6px;
  transition: opacity 0.2s ease;
}

.card.is-off .card-body {
  opacity: 0.42;
}

.swatch-wrap {
  position: relative;
  width: 64px;
}

.swatch-btn {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  cursor: pointer;
}

.swatch-btn::after {
  content: "";
  position: absolute;
  right: 6px;
  bottom: 6px;
  border: 5px solid transparent;
  border-top-color: currentColor;
  border-bottom-width: 0;
}

.picker {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  left: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: min(320px, calc(100vw - 2 * var(--gutter)));
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  box-shadow: var(--shadow-pop);
}

.picker-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  min-width: 0;
  padding: 0 8px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  text-align: left;
  font-size: 0.82rem;
  line-height: 1.2;
  cursor: pointer;
}

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

.picker-btn[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  font-weight: 600;
}

.picker-chip {
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
}

.picker-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-select {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
}

.card-color {
  margin-top: 4px;
  font-size: 0.92rem;
}

.card-size {
  font-size: 0.92rem;
  color: var(--ink-2);
}

.card-touch {
  font-size: 0.92rem;
}

.card-size .k,
.card-color .k,
.card-touch .k,
.card-pattern .k {
  margin-right: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.card-query {
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 8px;
}

/* The pattern button sits next to the shop link and stays the quieter of the two. */
.btn-quiet {
  border-color: var(--ink-3);
  color: var(--ink-2);
}

/* The animal touch switch and the "put the print here" action. */
.card-animal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  margin-top: 4px;
}

.touch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.touch-toggle input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.card-info > .print-file {
  margin-top: 8px;
}

.card-pattern {
  font-size: 0.92rem;
  color: var(--ink-2);
}

.card-pattern-note {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-3);
}

.tips {
  margin-top: 26px;
}

.tips ul {
  list-style: none;
  padding: 0;
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.tips li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-2);
}

.tips li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 1px;
  background: var(--ink);
}

.missing {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--ink-3);
  background: var(--paper-2);
  font-size: 0.92rem;
}

/* ---------- Sewing panel ---------- */

/* The page behind the panel does not scroll while it is open. */
html.has-sew {
  overflow: hidden;
}

/* A phone gets the whole screen. */
.sew {
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
}

.sew[open] {
  display: flex;
  flex-direction: column;
}

.sew::backdrop {
  background: var(--crop-dim);
}

/* A bigger screen gets a centered panel. */
@media (min-width: 720px) {
  .sew {
    width: min(760px, calc(100vw - 48px));
    height: auto;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    margin: auto;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    box-shadow: var(--shadow-pop);
  }
}

.sew-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px var(--gutter);
  border-bottom: 1px solid var(--rule-strong);
}

.sew-bar h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.sew-close {
  flex: none;
}

.sew-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sew-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  padding: 18px var(--gutter) 28px;
}

.sew-body > *,
.sew-main > * {
  min-width: 0;
}

.sew-pattern {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.15;
}

.sew-note,
.sew-estimate {
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  background: var(--paper-2);
  font-size: 0.92rem;
}

.sew-note {
  margin-top: 10px;
}

.sew-lede {
  margin-top: 10px;
  color: var(--ink-2);
}

.sew-status:not(:empty) {
  margin-top: 14px;
}

.sew-status:focus {
  outline: none;
}

.sew-status .btn {
  margin-top: 12px;
}

.sew-main,
.sew-form,
.sew-groups {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

.sew-groups {
  gap: 22px;
}

/* The legend is the group heading, with a rule under it. */
.sew-group > legend {
  display: block;
  width: 100%;
  padding-bottom: 6px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--rule);
}

.sew-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 20px 18px;
  margin-top: 14px;
}

.sew-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sew-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  margin-bottom: 4px;
}

.sew-field label {
  font-size: 0.95rem;
  font-weight: 600;
}

.sew-unit {
  font-weight: 400;
  color: var(--ink-3);
}

.sew-help {
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.sew-msg {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
}

.sew-msg:not(:empty) {
  margin-top: 4px;
}

/* Where a value came from. An estimate looks different on purpose: dashed. */
.sew-tag {
  flex: none;
  padding: 2px 7px;
  border: 1px solid var(--ink-3);
  border-radius: 2px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--ink-2);
}

.sew-tag.is-saved {
  border-color: var(--ink);
  color: var(--ink);
}

.sew-tag.is-yours {
  background: var(--paper-3);
}

.sew-tag.is-estimate {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}

.sew-field.is-estimate input {
  border: 2px dashed var(--accent);
  background-color: var(--paper-2);
}

.sew-options {
  grid-template-columns: minmax(0, 1fr);
  margin-top: 12px;
}

.sew-options .seg {
  align-self: flex-start;
}

@media (min-width: 560px) {
  .sew-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.sew-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.sew-section > .sub {
  margin-bottom: 10px;
}

/* The board is light in both themes, like the flat-lay. */
.sew-preview-img {
  display: block;
  width: 100%;
  height: clamp(220px, 60vw, 380px);
  object-fit: contain;
  border: 1px solid var(--rule-strong);
  background: var(--flatlay-bg);
}

.sew-preview-msg {
  padding: 10px 14px;
  border-left: 4px solid var(--ink-3);
  background: var(--paper-2);
  font-size: 0.92rem;
}

.sew-fabric {
  font-weight: 600;
}

.sew-tip {
  margin-top: 4px;
  font-size: 0.92rem;
  color: var(--ink-2);
}

/* ---------- Fabric guide (inside the sewing panel) ---------- */

/* One block per material: main fabric, lining, interfacing. */
.fab-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 26px;
  margin-bottom: 20px;
}

.fab-list:empty {
  display: none;
}

.fab-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.fab-block > * {
  min-width: 0;
}

.fab-head {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* The swatch is the real color, so its text color comes from Fauve.palette.textOn. */
.fab-color {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fab-swatch {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  min-height: var(--tap);
  padding: 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fab-color-name {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fab-pop,
.fab-note {
  font-size: 0.92rem;
  color: var(--ink-2);
}

/* The fabric choices are radios. The whole card is the label, so it is a big target. */
.fab-choices > legend {
  margin-bottom: 8px;
}

.fab-choice {
  position: relative;
}

.fab-choice + .fab-choice {
  margin-top: 8px;
}

.fab-choice input {
  position: absolute;
  top: 15px;
  left: 14px;
  z-index: 1;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.fab-choice label {
  display: grid;
  gap: 3px;
  min-height: var(--tap);
  padding: 12px 14px 12px 46px;
  border: 1px solid var(--ink-3);   /* at least 3:1 against the paper, so each card reads as a choice */
  border-radius: 2px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.fab-choice label:hover {
  border-color: var(--ink);
}

.fab-choice input:checked + label {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  background: var(--paper-2);
}

/* The card shows the focus ring, so the small radio inside it does not draw a second one. */
.fab-choice input:focus-visible {
  outline: none;
}

.fab-choice input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.fab-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}

.fab-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.fab-gsm {
  font-size: 0.82rem;
  color: var(--ink-2);
}

.fab-stretch {
  font-size: 0.85rem;
}

.fab-why {
  font-size: 0.88rem;
  color: var(--ink-2);
}

.fab-amount {
  font-weight: 600;
}

.fab-amount.is-missing {
  font-weight: 400;
  color: var(--ink-2);
}

/* Shop and help links look like links: underlined text, never a bordered button. */
.fab-shops {
  display: grid;
  gap: 2px;
}

.fab-find {
  font-size: 0.92rem;
  font-weight: 600;
}

.fab-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
}

.fab-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fab-link:hover {
  color: var(--accent);
}

.fab-fine {
  font-size: 0.82rem;
  color: var(--ink-2);
}

/* "Want this exact color?" and "Get this print as a fabric file" */
.fab-spoon,
.print-file {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 14px;
  border-left: 4px solid var(--accent);
  background: var(--paper-2);
  font-size: 0.92rem;
}

.fab-spoon > *,
.print-file > * {
  min-width: 0;
  max-width: 100%;
}

.fab-steps {
  padding-left: 1.4em;
  display: grid;
  gap: 4px;
}

/* Spoonflower, step by step: each step's words, then a drawing of what to look for. */
.spoon-steps {
  padding-left: 1.4em;
  display: grid;
  gap: 14px;
  margin: 12px 0 8px;
}

.spoon-step p {
  margin: 0;
}

.spoon-links {
  margin-top: 4px;
}

.sk {
  margin-top: 6px;
  max-width: 340px;
}

.sk svg {
  display: block;
  width: 100%;
  height: auto;
}

.sk-frame { fill: var(--field-bg); stroke: var(--rule); stroke-width: 1; }
.sk-btn { fill: var(--paper-2); stroke: var(--ink-3); stroke-width: 1; }
.sk-field { fill: var(--field-bg); stroke: var(--field-line); stroke-width: 1; }
.sk-ring { fill: none; stroke: var(--accent); stroke-width: 2; }
.sk-label { fill: var(--ink); font-size: 10px; font-weight: 600; font-family: inherit; }
.sk-typed { fill: var(--ink-2); font-size: 10px; font-family: inherit; }
.sk-title { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: inherit; }

.design-how {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--ink-2);
}

/* Where the print goes: a swatch of it, then the one choice. */
.design-place {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.design-swatch svg {
  display: block;
  border: 1px solid var(--rule-strong);
}

.design-place-body {
  flex: 1;
  min-width: 0;
}

.design-place-body select {
  margin-top: 6px;
  width: 100%;
  max-width: 420px;
}

.fab-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  max-width: 100%;
}

.fab-row .btn {
  max-width: 100%;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.25;
  text-align: center;
}

.fab-spoon-msg,
.fab-copy-msg {
  min-width: 0;
  font-size: 0.88rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.fab-copy {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.fab-copy-text {
  display: block;
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  background: var(--field-bg);
  color: var(--ink);
  border: 1px solid var(--field-line);
  border-radius: 2px;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: vertical;
}

.sew-result:not(:empty),
.sew-failure:not(:empty) {
  margin-top: 12px;
}

.sew-result {
  display: grid;
  gap: 2px;
  justify-items: start;
}

.sew-foot {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--ink-2);
}

.sew-foot a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sew-foot a:hover {
  color: var(--ink);
}

/* ---------- Footer ---------- */

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px var(--gutter) 48px;
  border-top: 1px solid var(--rule-strong);
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.foot a,
.prose a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.foot a:hover,
.prose a:hover {
  color: var(--ink);
}

/* ---------- Plain pages (privacy, not found) ---------- */

.wordmark-link {
  color: inherit;
  text-decoration: none;
}

.prose {
  max-width: 680px;
  margin: 0 auto;
  padding: 36px var(--gutter) 56px;
  line-height: 1.6;
}

.prose h2 {
  margin: 28px 0 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--ink);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose p,
.prose ul {
  margin-top: 8px;
}

.prose ul {
  padding-left: 1.2em;
}

/* ---------- Small screens ---------- */

@media (max-width: 420px) {
  .card-body {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 12px;
  }

  .swatch-wrap,
  .swatch-btn {
    width: 52px;
  }

  .swatch-btn {
    height: 52px;
  }

  .seg label {
    min-width: 56px;
    padding: 0 12px;
  }

  .picker {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
