/* Brand tokens taken from headstone.app */
:root {
  --ink: #0a0000;          /* brand brown-black */
  --text: #1a1414;
  --muted: #5b5252;
  --line: #e6e6e6;
  --surface: #ffffff;
  --wash: #f7f7f7;
  --gold: #a57f26;         /* brand gold */
  --gold-deep: #86661d;    /* brand gold, darkened so cream text passes contrast */
  --gold-press: #73591b;
  --cream: #fff1cc;        /* brand button text */
  --stage: #dfe6ea;
  --bar-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 "Montserrat", system-ui, sans-serif; color: var(--text); background: var(--surface); caret-color: var(--gold); }
::selection { background: var(--cream); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary, label.check { cursor: pointer; }

/* brand bar, mirrors the headstone.app header */
.brandbar { height: var(--bar-h); display: flex; align-items: center; gap: 16px; padding: 0 24px; background: #0a0a0a; color: #fff; }
.brand img { display: block; height: 30px; width: auto; }
.brand-sub { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.72); padding-left: 16px; border-left: 1px solid rgba(255,255,255,.2); }
.pill { margin-left: auto; background: var(--gold-deep); color: var(--cream); text-decoration: none; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; font-weight: 700; padding: 12px 20px; border-radius: 50px; transition: background-color .18s ease-out; }
.pill:hover { background: var(--gold-press); }

.app { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - var(--bar-h)); }
.stage { position: relative; background: var(--stage); min-height: 0; }
#view { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-bar { position: absolute; left: 20px; bottom: 20px; display: flex; gap: 6px; }
.stage-bar button { background: rgba(255,255,255,.9); border: 1px solid rgba(10,0,0,.12); box-shadow: 0 2px 10px rgba(10,0,0,.12); }
.bar-gap { width: 10px; }
.stage-bar button.on { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: var(--stage); font-weight: 500; transition: opacity .4s ease-out; }
.loading.done { opacity: 0; pointer-events: none; }

/* panel */
.panel { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); border-left: 1px solid var(--line); }
.panel-head { padding: 26px 26px 10px; }
.panel-head h1 { font-size: 22px; line-height: 1.2; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--ink); margin: 0; }
.panel-head h1::after { content: ""; display: block; width: 56px; height: 3px; margin: 12px 0 12px; background: linear-gradient(var(--gold), var(--gold)) top / 100% 1px no-repeat, linear-gradient(var(--gold), var(--gold)) bottom / 100% 1px no-repeat; }
.panel-head p { margin: 0; color: var(--muted); font-size: 14px; }
.steps { flex: 1; overflow-y: auto; padding: 4px 26px 20px; scrollbar-width: thin; scrollbar-color: #cfc7c7 transparent; }

details { border-bottom: 1px solid var(--line); padding: 14px 0 18px; }
summary { list-style: none; font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); display: flex; align-items: center; gap: 12px; padding: 4px 0; }
summary::-webkit-details-marker { display: none; }
summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease-out; }
details[open] > summary::after { transform: rotate(-135deg); }
summary span { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--gold-deep); color: var(--cream); font-size: 12px; letter-spacing: 0; }
details:not([open]) summary span { background: var(--wash); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }

.lbl { display: block; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .ghost { border: 1px solid #d9d4d4; background: var(--surface); border-radius: 50px; padding: 8px 15px; min-height: 38px; font-size: 14px; font-weight: 500; transition: background-color .18s ease-out, border-color .18s ease-out, color .18s ease-out; }
.chips button:hover:not(:disabled), .ghost:hover { border-color: var(--gold); }
.chips button.on { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.chips button:disabled { opacity: .38; cursor: not-allowed; }

input:not([type]), select, textarea { width: 100%; border: 1px solid #d9d4d4; border-radius: 6px; padding: 10px 12px; background: var(--surface); transition: border-color .18s ease-out; }
input:not([type]):hover, select:hover, textarea:hover { border-color: #bdb4b4; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
textarea { resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--gold-deep); margin-top: 12px; }
input[type=file] { margin-top: 12px; font-size: 14px; max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; border: 1px solid #d9d4d4; background: var(--wash); border-radius: 50px; padding: 6px 14px; margin-right: 10px; cursor: pointer; }
input[type=checkbox] { accent-color: var(--gold-deep); width: 18px; height: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-weight: 500; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button { width: 46px; height: 46px; border-radius: 50%; border: 0; padding: 0; background-size: cover; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); transition: box-shadow .18s ease-out; }
.swatches button:hover { box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 0 0 2px var(--surface), 0 0 0 3px #bdb4b4; }
.swatches button.on { box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 0 0 2px var(--surface), 0 0 0 4px var(--gold); }
#stoneName { font-weight: 600; color: var(--text); }
.swatches-sm { margin-top: 10px; }
.swatches-sm button { width: 34px; height: 34px; }

/* footer: the dark brand band */
.panel-foot { padding: 18px 26px 20px; background: var(--ink); color: #fff; }
.price { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price > div { min-width: 0; }
.price small { display: block; color: rgba(255,241,204,.75); font-size: 12px; font-weight: 500; letter-spacing: .04em; }
.price strong { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.primary { border: 0; cursor: pointer; background: var(--gold-deep); color: var(--cream); text-decoration: none; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; font-weight: 700; padding: 15px 20px; border-radius: 50px; white-space: nowrap; transition: background-color .18s ease-out; }
.primary:hover { background: var(--gold-press); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.panel-foot .ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.28); font-size: 14px; padding: 7px 13px; min-height: 36px; }
.panel-foot .ghost:hover { border-color: var(--gold); color: var(--cream); }
.toast { min-height: 1.2em; margin: 10px 0 0; font-size: 14px; color: var(--cream); }

@media (max-width: 860px) {
  :root { --bar-h: 56px; }
  .brandbar { padding: 0 16px; gap: 12px; }
  .brand img { height: 24px; }
  .brand-sub { display: none; }
  .pill { padding: 10px 14px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 44vh auto; height: auto; }
  body { overflow-x: hidden; }
  .stage { height: 44vh; position: sticky; top: 0; z-index: 2; }
  .stage-bar { left: 12px; bottom: 12px; }
  .panel { border-left: 0; }
  .steps { overflow: visible; padding: 4px 16px 16px; }
  .panel-head { padding: 20px 16px 6px; }
  .panel-foot { position: sticky; bottom: 0; padding: 12px 16px; z-index: 3; }
  .price strong { font-size: 22px; }
  .primary { padding: 12px 16px; }
  .actions { flex-wrap: nowrap; overflow-x: auto; margin-top: 10px; }
  .actions button { white-space: nowrap; min-height: 40px; }
  .chips button { min-height: 44px; }
  input:not([type]), select, textarea { font-size: 16px; }
  .toast:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* art library */
.art-list { display: grid; gap: 8px; margin-bottom: 10px; }
.art-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.art-row.editing { border-color: var(--gold); }
.art-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.art-sym { display: grid; place-items: center; width: 48px; height: 48px; background: var(--wash); border-radius: 6px; color: var(--gold-deep); font-size: 22px; }
.art-edit { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 4px; }
.art-edit .art-wrap { margin-top: 38px; }
.art-row img { width: 48px; height: 48px; object-fit: contain; background: var(--wash); border-radius: 6px; }
.art-row strong { display: block; font-size: 14px; font-weight: 600; }
.art-row small { color: var(--muted); font-size: 12px; }
.art-sheet { position: absolute; inset: 0; z-index: 5; background: var(--surface); display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; }
.art-sheet[hidden] { display: none; }
.art-sheet header { display: flex; align-items: center; justify-content: space-between; }
.art-sheet h2 { margin: 0; font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); }
.art-cats { max-height: 96px; overflow-y: auto; }
.art-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; align-content: start; }
.art-grid button { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 8px; background: var(--wash); padding: 6px; cursor: pointer; transition: border-color .18s ease-out; }
.art-grid button:hover { border-color: var(--gold); }
.art-grid button.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--gold); }
.art-grid img { width: 100%; height: 100%; object-fit: contain; }
.art-place { border-top: 1px solid var(--line); padding-top: 10px; }
.art-place p { margin: 0 0 8px; font-size: 14px; }
@media (max-width: 860px) { .art-sheet { position: fixed; z-index: 20; } }

/* Headstone's licensed monument lettering fonts */
@font-face { font-family: "DeLuxe Roman SR"; src: url("fonts/DeLuxe-Roman-SR.woff") format("woff"); font-display: block; }
@font-face { font-family: "Elbreco SS"; src: url("fonts/Elbreco-SS.woff") format("woff"); font-display: block; }
@font-face { font-family: "Heavy Bar SKS"; src: url("fonts/Heavy-Bar-SKS.woff") format("woff"); font-display: block; }
@font-face { font-family: "Modified Roman FAH"; src: url("fonts/Modified-Roman-FAH.woff") format("woff"); font-display: block; }
@font-face { font-family: "Modified Roman Presto Cut"; src: url("fonts/Modified-Roman-Presto-Cut.woff") format("woff"); font-display: block; }
@font-face { font-family: "Modified Roman SKS L"; src: url("fonts/Modified-Roman-SKS-L.woff") format("woff"); font-display: block; }
@font-face { font-family: "Modified Roman SKS S"; src: url("fonts/Modified-Roman-SKS-S.woff") format("woff"); font-display: block; }
@font-face { font-family: "Modified Roman Semi-Sans"; src: url("fonts/Modified-Roman-Semi-Sans.woff") format("woff"); font-display: block; }
@font-face { font-family: "Vermarco CR"; src: url("fonts/Vermarco-CR.woff") format("woff"); font-display: block; }
@font-face { font-family: "Vermarco PC"; src: url("fonts/Vermarco-PC.woff") format("woff"); font-display: block; }
@font-face { font-family: "Zapf Chancery"; src: url("fonts/Zapf-Chancery-Font.woff") format("woff"); font-display: block; }

/* per-line lettering controls */
.text-tools { margin-top: 8px; }
.ghost.mini { font-size: 12px; padding: 5px 12px; min-height: 32px; }
.text-edit .art-edit { border: 1px solid var(--gold); border-radius: 8px; padding: 4px 12px 12px; margin-top: 8px; }
.text-edit select { margin-bottom: 2px; }
.lbl output { color: var(--text); font-weight: 700; letter-spacing: 0; text-transform: none; }
.primary[aria-busy=true] { opacity: .7; cursor: progress; }

/* high-quality render progress */
.hd-busy { background: rgba(10, 0, 0, .55); color: #fff; z-index: 4; }
.hd-busy[hidden] { display: none; }
.hd-busy div { display: grid; gap: 6px; text-align: center; padding: 20px 26px; border-radius: 10px; background: rgba(10, 0, 0, .7); }
.hd-busy span { font-size: 22px; font-weight: 700; color: var(--cream); font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .stage-bar { flex-wrap: wrap; right: 12px; } .bar-gap { display: none; } }
