/* Linen · the vision board creator. Tokens, faces, pills, the grain and the iPad frame come from
   the site (tokens.css, linked from site/static). This file holds only the creator's own parts. */

/* Header: the same chrome as the order page */
.site-header { position: relative; z-index: var(--z-sticky-nav); border-bottom: var(--rule-hair) solid var(--color-rule); }
.header-row { display: flex; align-items: center; gap: var(--space-lg); min-height: 72px; }
.header-row .wordmark { font-size: 2rem; }
.header-title { font-size: var(--text-sm); color: var(--color-muted); }
.header-row > .quiet-link { margin-inline-start: auto; }

#stage { outline: none; padding-block: var(--space-xl) var(--space-3xl); }
@keyframes settle { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) { .step-enter { animation: settle var(--dur-long) var(--ease-out); } }

/* One question at a time, like the order page */
.wizard { max-width: 760px; }
.wizard-top { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-xl); }
.wizard-count { margin: 0; flex: none; font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.wizard-bar { flex: 1; height: 2px; background: var(--color-rule); overflow: hidden; }
.wizard-bar span { display: block; height: 100%; background: var(--color-ink); transform-origin: right; transition: transform var(--dur-long) var(--ease-out); }
.wizard h1 { font-size: var(--text-display-s); margin-bottom: var(--space-sm); }
.wizard .lead { font-size: var(--text-lead); line-height: 1.5; color: var(--color-ink-2); max-width: 44ch; }
.wizard-nav { display: flex; align-items: center; gap: var(--space-lg); margin-top: var(--space-xl); }
.wizard-nav .pill-solid { min-width: 180px; }

/* The word: one large underlined line in the planner's display face */
.word-input {
  width: 100%; margin-top: var(--space-xl); min-height: 52px; padding: var(--space-xs) var(--space-3xs);
  border: 0; border-bottom: 2px solid var(--color-field-line); border-radius: 0; background: transparent;
  font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--text-display); line-height: 1.15;
  letter-spacing: var(--tracking-display); transition: border-color var(--dur-short) var(--ease-out);
}
.word-input:hover { border-bottom-color: var(--color-ink-2); }
.word-input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-bottom-color: var(--color-ink); }
.word-input::placeholder, .search::placeholder { color: var(--color-muted); opacity: .6; }

/* Goals: the search line, the results, and the ideas card beside them */
.goals-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: var(--space-2xl); align-items: start; max-width: 1120px; margin-inline: auto; }
.goals-layout .wizard { max-width: none; }
.search {
  width: 100%; min-height: 52px; margin-top: var(--space-lg); padding: var(--space-xs) var(--space-3xs);
  border: 0; border-bottom: 2px solid var(--color-field-line); border-radius: 0; background: transparent;
  font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--text-xl);
  transition: border-color var(--dur-short) var(--ease-out);
}
.search:hover { border-bottom-color: var(--color-ink-2); }
.search:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-bottom-color: var(--color-ink); }
.picked { display: flex; flex-wrap: wrap; gap: var(--space-xs); min-height: 48px; margin-top: var(--space-lg); }
.picked:empty::before { content: attr(data-empty); align-self: center; font-size: var(--text-sm); color: var(--color-muted); }
.results { display: flex; flex-wrap: wrap; gap: var(--space-xs); min-height: 120px; margin-top: var(--space-lg); }
.ideas { position: sticky; top: var(--space-lg); padding: var(--space-lg); border-radius: var(--radius-card); background: var(--color-paper-3); }
.ideas h2 { font-size: var(--text-title); margin-bottom: var(--space-sm); }
.ideas .chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.ideas .quiet-link { margin-top: var(--space-sm); }

/* A goal: the planner's choice pill. Chosen is ink; a typed one is outlined. */
.tag-btn {
  display: inline-flex; align-items: center; gap: var(--space-xs); min-height: 44px; padding: 0 var(--space-md);
  border: 0; border-radius: var(--radius-pill); background: var(--color-paper-2); cursor: pointer; font-size: var(--text-sm);
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.tag-btn:hover:not(:disabled):not([aria-pressed="true"]) { background: var(--color-field); }
.tag-btn[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); }
.tag-btn:active:not(:disabled) { opacity: .75; }
.tag-btn:disabled { opacity: .45; cursor: not-allowed; }
.tag-btn.add { background: transparent; box-shadow: inset 0 0 0 1px var(--color-stroke); }
.tag-btn .x { font-size: var(--text-md); line-height: 1; opacity: .7; }
.ideas .tag-btn { min-height: 40px; padding: 0 var(--space-sm); }

/* Shared controls: a choice is a real radio inside a pill, a tick is a real checkbox */
.choices { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.choice input, .tick-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice > span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-md); border-radius: var(--radius-pill);
  background: var(--color-paper-2); cursor: pointer; font-size: var(--text-sm);
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}
.choice:hover > input:not(:checked) + span { background: var(--color-field); }
.choice > input:checked + span { background: var(--color-ink); color: var(--color-paper); }
.choice:active > span { opacity: .75; }
.choice:has(input:focus-visible) > span, .tick-row:has(input:focus-visible) .tick { outline: 2px solid var(--color-focus); outline-offset: 4px; }
.fonts .choice > span { font-size: 1.25rem; padding: 0 var(--space-md); }
.fonts.is-off { opacity: .45; }
.field-title { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-sm); font-weight: var(--weight-strong); margin: 0 0 var(--space-sm); }
.field-title .num { font-weight: 400; color: var(--color-muted); }
.hint { font-size: var(--text-sm); color: var(--color-muted); margin: 0 0 var(--space-sm); }

.tick-row { display: flex; align-items: center; gap: var(--space-sm); min-height: 44px; cursor: pointer; }
.tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--color-stroke); background: var(--color-paper);
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}
.tick-row:hover .tick { border-color: var(--color-ink-2); }
.tick-row input:checked + .tick { background: var(--color-ink); border: 6px solid var(--color-ink); box-shadow: inset 0 0 0 2px var(--color-paper); }

/* The range: a hairline track with an ink thumb */
.range { width: 100%; height: 44px; margin: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 2px; background: var(--color-rule); }
.range::-moz-range-track { height: 2px; background: var(--color-rule); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -10px; border-radius: 50%; background: var(--color-ink); box-shadow: 0 0 0 4px var(--color-paper); }
.range::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--color-ink); box-shadow: 0 0 0 4px var(--color-paper); }
.range:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* Photo rows: hairlines between them, as on the order page */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: var(--space-sm); min-height: 52px; border-bottom: var(--rule-hair) solid var(--color-rule); }
.rows li:last-child { border-bottom: 0; }
.rows .name { flex: 1; min-width: 0; font-size: var(--text-md); line-height: 1.3; overflow-wrap: anywhere; }
.rows .num { font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.rows label.quiet-link { cursor: pointer; }
.rows input[type="file"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rows label:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 3px; }

/* The board: the screen fills the page. A toolbar above it, the size and export below. */
#stage.is-board { max-width: none; padding: 0; }
.board { display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; height: calc(100svh - 73px); min-height: 520px; position: relative; }

.board-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md);
  padding: var(--space-xs) var(--space-lg); border-bottom: var(--rule-hair) solid var(--color-rule);
}
.seg { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.seg.end { margin-inline-start: auto; }
.board-bar .choice > span { min-height: 44px; padding: 0 var(--space-sm); font-size: var(--text-sm); }
.board-bar .quiet-link { min-height: 44px; }

.wrap { position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; }
.wrap .device { line-height: 0; padding: var(--space-sm); }
.wrap .device.is-iphone { border-radius: 44px; }
.wrap .device.is-ipad { border-radius: var(--radius-device); }
.wrap .device.is-mac { border-radius: 14px; }
.wrap canvas { display: block; cursor: pointer; border-radius: var(--radius-screen); }
.wrap .device.is-iphone canvas { border-radius: 34px; }
.wrap.is-drop .device { outline: 2px dashed var(--color-accent); outline-offset: 8px; }

/* The drawer floats over the right edge: photos per goal, the word, the safe-area guide */
.drawer {
  position: absolute; inset-block: var(--space-sm); inset-inline-end: var(--space-sm); z-index: var(--z-dropdown);
  width: min(380px, calc(100% - 2 * var(--space-sm))); overflow: auto; padding: var(--space-lg);
  border-radius: var(--radius-card); background: var(--color-paper-3); box-shadow: var(--shadow-float);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.drawer .sub { margin-top: var(--space-lg); padding-top: var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule); }
.drawer .field-title { margin-top: var(--space-xs); }

/* The tray: photos waiting to be placed. Drag a thumbnail onto a block. */
.strip {
  display: flex; align-items: center; gap: var(--space-md); min-width: 0;
  padding: var(--space-xs) var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule);
}
.strip-title { margin: 0; flex: none; font-size: var(--text-sm); white-space: nowrap; }
.strip-title .num { color: var(--color-muted); font-variant-numeric: tabular-nums; }
.thumbs { display: flex; gap: var(--space-xs); min-width: 0; overflow-x: auto; padding-block: var(--space-2xs); }
.thumb { flex: none; width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-card); cursor: grab; user-select: none; }
.thumb:active { cursor: grabbing; opacity: .75; }

.board-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm) var(--space-md);
  padding: var(--space-sm) var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule);
}
.size { flex: 1 1 260px; display: flex; align-items: center; gap: var(--space-sm); min-width: 0; font-size: var(--text-sm); }
.size .range { flex: 1; }
.total { min-width: 2.5ch; text-align: center; font-weight: var(--weight-strong); font-variant-numeric: tabular-nums; }
.status { margin: 0; font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }

/* Shown on phones only. iPad portrait (820px) and every laptop get the full editor. */
.device-note {
  display: none; margin: 0; padding: var(--space-sm) var(--space-lg);
  border-bottom: var(--rule-hair) solid var(--color-rule); background: var(--color-paper-3);
  font-size: var(--text-sm); color: var(--color-ink); text-align: center;
}

@media (max-width: 47.5rem) {
  .device-note { display: block; }
  .goals-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
  .ideas { order: 2; }
}

@media (max-width: 60rem) {
  .board { height: auto; min-height: 0; grid-template-rows: auto auto auto auto; }
  .wrap { height: 68svh; }
  .drawer { width: calc(100% - 2 * var(--space-sm)); }
  .seg.end { margin-inline-start: 0; }
}

/* What used to be inline styles: the site's CSP does not allow them. */
.field-title.spaced { margin-top: var(--space-lg); }
/* One class per word face, the same faces as WORD_FONTS in data.js. */
.pf-frank { font: 300 20px "Frank Ruhl Libre", serif; }
.pf-bellefair { font: 400 20px "Bellefair", serif; }
.pf-assistant { font: 600 20px "Assistant", sans-serif; }
.pf-secular { font: 400 20px "Secular One", sans-serif; }
.pf-amatic { font: 700 20px "Amatic SC", cursive; }

/* Four steps in the progress bar */
.wizard-bar .fill-1 { transform: scaleX(0.25); }
.wizard-bar .fill-2 { transform: scaleX(0.5); }
.wizard-bar .fill-3 { transform: scaleX(0.75); }
.wizard-bar .fill-4 { transform: scaleX(1); }

/* The photo step: each chosen word with a tray of five places for its photos */
.goal-rows, .tray { list-style: none; margin: 0; padding: 0; }
.goal-rows { margin-top: var(--space-xl); }
.goal-row { padding: var(--space-md) 0; border-bottom: var(--rule-hair) solid var(--color-rule); }
.goal-row.is-drop { outline: 2px dashed var(--color-accent); outline-offset: 4px; }
.goal-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-xs); }
.goal-name { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--text-lg); overflow-wrap: anywhere; }
.goal-head .num { flex: none; font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.tray { display: grid; grid-template-columns: repeat(5, minmax(0, 104px)); gap: var(--space-xs); }
.shot { position: relative; aspect-ratio: 1; border-radius: var(--radius-card); overflow: hidden; background: var(--color-field); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot-x {
  position: absolute; top: 4px; inset-inline-end: 4px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: oklch(20% 0.01 70 / 0.72); color: var(--color-paper); font-size: 20px; line-height: 1; cursor: pointer;
}
.shot-x:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.shot.add { background: transparent; box-shadow: inset 0 0 0 1px var(--color-stroke); }
.shot.add:hover { background: var(--color-field); }
.shot.add label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--color-muted); font-size: var(--text-xl); }
.shot.add input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shot.add:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.photo-total { margin: var(--space-lg) 0 0; font-size: var(--text-sm); color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
.photo-msg { margin: var(--space-2xs) 0 0; min-height: 1.5em; font-size: var(--text-sm); color: var(--color-muted); }

/* The word's size, background and letter colour, in the drawer */
.word-tune { margin-top: var(--space-md); }
.word-tune.is-off { opacity: .45; }
.size-row { display: flex; align-items: center; gap: var(--space-sm); min-height: 44px; font-size: var(--text-sm); }
.size-row .range { flex: 1; min-width: 0; }
.size-row .num { min-width: 4ch; text-align: end; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.tune-title { margin-top: var(--space-md); }
.swatches { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw { display: block; width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--color-stroke); }
.swatch:hover .sw { box-shadow: inset 0 0 0 1px var(--color-ink-2); }
.swatch input:checked + .sw { outline: 2px solid var(--color-ink); outline-offset: 3px; }
.swatch:has(input:focus-visible) .sw { outline: 2px solid var(--color-focus); outline-offset: 3px; }
.sw-bg-auto, .sw-c-auto { background: linear-gradient(135deg, #F8F6F1 50%, #2E2A26 50%); }
.sw-bg-none { background: linear-gradient(135deg, transparent calc(50% - 1px), #6B655E calc(50% - 1px), #6B655E calc(50% + 1px), transparent calc(50% + 1px)); }
.sw-bg-paper { background: #F8F6F1; }
.sw-bg-ink, .sw-c-ink { background: #2E2A26; }
.sw-bg-clay { background: #C9A48A; }
.sw-bg-sage { background: #B5BFA3; }
.sw-bg-sky { background: #AFC0D0; }
.sw-c-white { background: #FFFFFF; }
.sw-c-clay { background: #8A4F36; }
.sw-c-sage { background: #44583C; }
.sw-c-sky { background: #2F4A66; }

/* The tool for the selected photo: beside the preview on a wide screen, over its lower edge on a narrow one */
.framebar {
  position: absolute; z-index: 1; inset-inline-start: var(--space-lg); top: 50%; transform: translateY(-50%);
  width: min(280px, 28%); display: grid; gap: var(--space-sm);
  padding: var(--space-lg); border-radius: var(--radius-card); background: var(--color-paper-3); box-shadow: var(--shadow-float);
}
.framebar[hidden] { display: none; }
.frame-title { margin: 0; font-size: var(--text-sm); font-weight: var(--weight-strong); line-height: 1.4; }
.frame-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-xs) var(--space-md); }
.frame-actions .quiet-link { min-height: 44px; }
@media (max-width: 60rem) {
  .framebar { top: auto; bottom: var(--space-sm); inset-inline: var(--space-sm); transform: none; width: auto; }
}
