/* Colors: "Plum on Linen". Dark mode below swaps these values;
   theme.js decides which one to show (device setting or the ☀️/🌙 switch). */
:root {
  color-scheme: light;
  --bg: #f7f2ef;
  --surface: #ffffff;
  --wall: #ffffff;              /* the box the artwork hangs in */
  --text: #2b2229;
  --muted: #74666f;
  --line: #e6dcd9;
  --accent: #5c2a50;            /* plum */
  --accent-text: #ffffff;
  --art-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  --swatch-ring: rgba(0, 0, 0, 0.25);
  --outline: rgba(0, 0, 0, 0.35);          /* "My wall space" dashed outline */
  --outline-fill: rgba(247, 242, 239, 0.6);
  --ok-bg: #e7f4ec;   --ok-fg: #1f5f3a;   --ok-line: #b9dcc6;
  --warn-bg: #fff4d6; --warn-fg: #7a5600; --warn-line: #f0dca8;
  --bad-bg: #fde8e6;  --bad-fg: #9b2c1f;
  --heart: #c0392b;
  --backdrop: rgba(30, 26, 22, 0.45);
  --radius: 12px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171417;
  --surface: #221e22;
  --wall: #312c31;              /* lighter than the page so the art stands out */
  --text: #f3ecef;
  --muted: #b4a8b0;
  --line: #3a3339;
  --accent: #d6a8c9;            /* soft plum */
  --accent-text: #1d141a;
  --art-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  --swatch-ring: rgba(255, 255, 255, 0.45);
  --outline: rgba(255, 255, 255, 0.4);
  --outline-fill: rgba(255, 255, 255, 0.04);
  --ok-bg: #1f3a2b;   --ok-fg: #b9e6c8;   --ok-line: #3d6b4f;
  --warn-bg: #3d3218; --warn-fg: #f1d58a; --warn-line: #5a4a2a;
  --bad-bg: #432421;  --bad-fg: #f5b8ae;
  --heart: #f08a7e;
  --backdrop: rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

/* Anything marked hidden stays hidden, even if a rule below gives it a display style. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.top, main, footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.top { padding-top: 28px; }
.top h1 { margin: 0; font-size: 2rem; letter-spacing: -0.02em; }
.top p { margin: 4px 0 0; color: var(--muted); max-width: 52ch; }

section { margin-top: 32px; }
h2 { font-size: 1rem; margin: 0 0 12px; }
h3 { font-size: 0.875rem; margin: 16px 0 8px; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
footer { padding-top: 40px; padding-bottom: 32px; font-size: 0.875rem; }

button { font: inherit; color: inherit; cursor: pointer; }

/* Style picker */
.styles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}
.style-btn {
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.style-btn span { font-size: 0.85rem; color: var(--muted); }
.style-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* Size picker */
.sizes { display: flex; gap: 8px; }
.size-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 600;
}
.size-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* The wall */
.wall-backdrop {
  background: var(--wall);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 16px;
}
.wall { display: flex; justify-content: center; }
@media (max-width: 600px) {
  .wall-backdrop { padding: 24px 12px; }
}

/* The whole wall is one picture; each piece sits at its spot (set in app.js).
   Frame color and thickness are also set in app.js, in inches to scale. */
.wall-canvas { position: relative; flex-shrink: 0; }
.wall-canvas .piece { position: absolute; }
.piece { margin: 0; }
.piece .art {
  position: relative;
  overflow: hidden;
  box-shadow: var(--art-shadow);
}
.piece .art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Number on each piece, matching the list under the wall */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.wall-canvas .badge { position: absolute; top: -8px; left: -8px; }

/* Layout picker */
.modes { display: inline-flex; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; }
.mode-btn { background: none; border: none; border-radius: 999px; padding: 8px 18px; font-weight: 600; }
.mode-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.designs { margin-top: 12px; }

/* Numbered list under the wall: name, size, Keep and ♡ */
.piece-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.piece-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px 8px 12px;
}
.piece-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.piece-info span { color: var(--muted); font-size: 0.85rem; }

.why { margin: 14px 0 0; color: var(--muted); }
.kept-note { margin: 4px 0 0; font-size: 0.9rem; font-weight: 600; }
.kept-note:empty { display: none; }

/* Keep and ♡ buttons */
.chip {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 32px;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.heart { padding: 4px 10px; font-size: 1rem; line-height: 1; }
.chip.heart[aria-pressed="true"] { background: var(--surface); border-color: var(--heart); color: var(--heart); }
.piece.kept .art { box-shadow: 0 0 0 3px var(--wall), 0 0 0 6px var(--accent), var(--art-shadow); }

.wall-bar {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.total { font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: 0.6; cursor: default; }

/* Saved walls */
.saved-list { display: grid; gap: 10px; }
.saved-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.mini-wall { width: 140px; display: flex; justify-content: center; flex-shrink: 0; }
.mini-wall .art, .shop-thumb .art { box-shadow: none; }
.saved-info { display: flex; flex-direction: column; flex: 1; min-width: 120px; }
.saved-info span { color: var(--muted); font-size: 0.875rem; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 4px; }

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

/* Sizes */
.totals { display: flex; flex-direction: column; }
.wall-size { color: var(--muted); font-size: 0.9rem; }
.scale-note { margin: 8px 0 0; font-size: 0.8rem; }

/* Shop this wall */
.shop-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.shop-head h2 { margin: 0; }
.shop-intro { margin: 6px 0 12px; font-size: 0.9rem; }
.shop-note {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.875rem;
  margin: 0 0 12px;
}
.shop-list { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 8px; }
.shop-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.shop-thumb { width: 66px; display: flex; justify-content: center; flex-shrink: 0; }
.shop-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.shop-info .pick { color: var(--muted); font-size: 0.85rem; }
.btn.buy { white-space: nowrap; text-decoration: none; font-size: 0.9rem; padding: 8px 14px; }
.shop-row:not(.opened) .btn.buy { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.shop-row.opened .btn.buy { color: var(--ok-fg); border-color: var(--ok-line); }
.shop-row.opened strong { color: var(--muted); }
@media (max-width: 600px) {
  .shop-row { flex-wrap: wrap; }
  .shop-info { flex-basis: calc(100% - 80px); }
  .btn.buy { width: 100%; text-align: center; }
}

/* Mix sizes switch and piece-count note */
.mix { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-size: 0.9rem; cursor: pointer; }
.mix input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }
.sizes { flex-wrap: wrap; }
.sizes-note { margin: 8px 0 0; font-size: 0.85rem; }
.sizes-note:empty { display: none; }

/* Frame color choice */
.sub-heading { color: var(--text); font-size: 0.9rem; margin: 18px 0 8px; }
.frames { display: flex; flex-wrap: wrap; gap: 6px; }
.frame-chip { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--swatch-ring); }
.frames-note { margin: 8px 0 0; font-size: 0.85rem; }

/* Drag to arrange */
.arrange-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.arrange-bar .scale-note { margin: 0; }
.arrange-actions { display: flex; align-items: center; gap: 8px; }
.arrange-hint { margin: 8px 0 0; font-size: 0.875rem; font-weight: 600; }
.wall-canvas.arranging .piece { cursor: grab; touch-action: none; user-select: none; }
.wall-canvas.arranging .piece::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px dashed var(--accent);
  border-radius: 2px;
  pointer-events: none;
}
.wall-canvas .piece.dragging { cursor: grabbing; z-index: 2; }
.wall-canvas .piece.dragging .art { box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3); }
.wall-canvas .piece:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

/* My wall space */
.space {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.space-title { margin: 0; }
.space-help { margin: 2px 0 10px; font-size: 0.85rem; }
.space-inputs { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.space-inputs label { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; }
.space-inputs input {
  width: 86px;
  font: inherit;
  padding: 6px 8px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.space-inputs input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.space-feet { margin: 6px 0 0; font-size: 0.8rem; }
.space-feet:empty { display: none; }

.space-frame { position: relative; flex-shrink: 0; }
.space-outline {
  position: absolute;
  border: 2px dashed var(--outline);
  border-radius: 2px;
  background: var(--outline-fill);
}
.space-outline.no-width { border-left-color: transparent; border-right-color: transparent; }
.space-outline.no-height { border-top-color: transparent; border-bottom-color: transparent; }

.fit { margin: 6px 0 0; font-size: 0.9rem; padding: 6px 10px; border-radius: 8px; display: inline-block; }
.fit-fits { background: var(--ok-bg); color: var(--ok-fg); }
.fit-tight { background: var(--warn-bg); color: var(--warn-fg); }
.fit-big { background: var(--bad-bg); color: var(--bad-fg); }
.fit-tag { display: inline-block; margin-top: 4px; font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; width: fit-content; }
.fit-tag.fit-fits { color: var(--ok-fg); }
.fit-tag.fit-tight { color: var(--warn-fg); }
.fit-tag.fit-big { color: var(--bad-fg); }

/* Note when a style + subject + frame combination borrows from other styles */
.filter-note { margin: 4px 0 0; font-size: 0.85rem; color: var(--warn-fg); }
.filter-note:empty { display: none; }
.sub-heading .muted { font-weight: 400; }

/* Accounts */
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account .btn { padding: 8px 16px; }
.account-dialog {
  width: min(420px, calc(100vw - 32px));
  border: none;
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.account-dialog::backdrop { background: var(--backdrop); }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.account-head h2 { margin: 0; font-size: 1.1rem; }
.account-tabs { margin: 14px 0 4px; }
.account-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.account-form p { margin: 0; }
.account-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; }
.account-form label .muted { font-weight: 400; }
.account-form input {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.account-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.account-form .link-btn { align-self: flex-start; }
.account-message { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; font-size: 0.9rem; }
.account-message.info { background: var(--bg); }
.account-message.success { background: var(--ok-bg); color: var(--ok-fg); }
.account-message.error { background: var(--bad-bg); color: var(--bad-fg); }

/* Header buttons: dark mode switch and account */
.top-actions { display: flex; align-items: center; gap: 8px; }
.theme-btn { padding: 8px 12px; line-height: 1; font-size: 1.05rem; }

/* Wrapped canvas: no frame, deeper shadow (it stands ~1.5" off the wall), and
   a soft darker edge where the canvas wraps around. Floater frames: dark gap. */
.piece .art.canvas { box-shadow: 4px 8px 18px rgba(0, 0, 0, 0.28); }
:root[data-theme="dark"] .piece .art.canvas { box-shadow: 4px 8px 18px rgba(0, 0, 0, 0.6); }
.piece.kept .art.canvas { box-shadow: 0 0 0 3px var(--wall), 0 0 0 6px var(--accent), 4px 8px 18px rgba(0, 0, 0, 0.28); }
.canvas-edge, .floater-gap { position: absolute; inset: 0; pointer-events: none; }
.canvas-edge { box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.12), inset 2px 2px 0 rgba(255, 255, 255, 0.25); }
.mini-wall .art.canvas, .shop-thumb .art.canvas { box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3); }

/* Unframed posters: flat paper, so a softer, closer shadow than canvas */
.piece .art.poster { box-shadow: 1px 3px 7px rgba(0, 0, 0, 0.2); }
:root[data-theme="dark"] .piece .art.poster { box-shadow: 1px 3px 7px rgba(0, 0, 0, 0.5); }
.piece.kept .art.poster { box-shadow: 0 0 0 3px var(--wall), 0 0 0 6px var(--accent), 1px 3px 7px rgba(0, 0, 0, 0.2); }
.mini-wall .art.poster, .shop-thumb .art.poster { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }

/* The Wallset logo: three frames (sky, terracotta, sage) and the word in Outfit.
   The font file is stored with the site (fonts/), so it never depends on another server. */
@font-face { font-family: "Outfit"; font-weight: 400; font-display: swap; src: url("fonts/outfit-400.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 500; font-display: swap; src: url("fonts/outfit-500.woff2") format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 600; font-display: swap; src: url("fonts/outfit-600.woff2") format("woff2"); }
.top h1.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 600;
  color: var(--accent);
}
.logo-link { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo-mark { width: 38px; height: 32px; flex: none; }
.logo-mark rect { stroke: var(--accent); stroke-width: 2.6; }
