:root {
  --bg: #150a08;
  --surface: #1e1210;
  --border: #382a27;
  --text: #fce1dd;
  --muted: #96817e;
  --primary: #fd8c7e;
  --secondary: #1eb9cb;
  --accent: #fea660;
  --primary-soft: rgb(253 140 126 / 12%);
  --secondary-soft: rgb(30 185 203 / 13%);
  --accent-soft: rgb(254 166 96 / 11%);
  --max: 1120px;
  --serif: Rockwell, "Courier New", serif;
  --sans: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 7% 9%, var(--primary-soft), transparent 23rem),
    radial-gradient(circle at 92% 25%, var(--secondary-soft), transparent 25rem),
    var(--bg);
  font-family: var(--sans);
  line-height: 1.5;
}

button, input, textarea { font: inherit; }
button, input, textarea, summary { color: inherit; }
a { color: var(--text); text-underline-offset: .22em; }
a:hover { color: var(--primary); }
:focus-visible { outline: 3px solid var(--secondary); outline-offset: 4px; }
[hidden] { display: none !important; }

.texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .26;
  background-image:
    repeating-linear-gradient(103deg, transparent 0 23px, rgb(252 225 221 / 3%) 24px 25px),
    radial-gradient(ellipse at 70% 6%, rgb(254 166 96 / 12%), transparent 24%),
    radial-gradient(ellipse at 31% 70%, rgb(30 185 203 / 9%), transparent 23%);
  mix-blend-mode: screen;
}

.masthead, main, footer { width: min(calc(100% - 40px), var(--max)); margin-inline: auto; }
.masthead {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}
.brand { font: 700 1.02rem/1 var(--serif); text-decoration: none; letter-spacing: -.03em; }
.brand span { color: var(--primary); margin-right: .35rem; }
.mast-note { color: var(--muted); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; }

main { position: relative; z-index: 1; }
.intro { max-width: 850px; padding: clamp(4rem, 10vw, 8.5rem) 0 clamp(5rem, 9vw, 8rem); }
.kicker, .step-stamp {
  display: inline-block;
  margin: 0 0 1.2rem;
  color: var(--accent);
  font-weight: 800;
  font-size: .74rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  transform: rotate(-1deg);
}
.intro h1 {
  max-width: 14ch;
  margin: 0 0 1.5rem;
  font: 700 clamp(2.9rem, 8.5vw, 6.9rem)/.88 var(--serif);
  letter-spacing: -.075em;
}
.intro h1 em { color: var(--primary); font-style: normal; position: relative; }
.intro h1 em::after {
  content: "";
  position: absolute;
  left: -.03em;
  right: -.09em;
  bottom: -.06em;
  height: .09em;
  background: var(--secondary);
  transform: rotate(-2deg);
}
.intro > p:not(.kicker) { max-width: 620px; margin: 0 0 2rem; color: #d7bbb7; font-size: clamp(1.05rem, 2vw, 1.25rem); }
.scribble-link { display: inline-flex; min-height: 44px; align-items: center; gap: .65rem; font-weight: 800; }
.scribble-link span { color: var(--secondary); }

.maker {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5rem);
  padding: 3rem 0 7rem;
  border-top: 1px solid var(--border);
  align-items: start;
}
.maker-form { min-width: 0; }
.form-heading { margin-bottom: 2.2rem; }
.form-heading h2, .finished h2 { margin: 0 0 .5rem; font: 700 clamp(2rem, 4vw, 3rem)/1 var(--serif); letter-spacing: -.05em; }
.form-heading p, .finished > p, details p { color: #c5aaa6; }
.field, fieldset { margin: 0 0 1.75rem; }
.field label, legend, .link-row label { font-weight: 800; }
.label-row { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.label-row output { color: var(--muted); font-size: .72rem; white-space: nowrap; }
input, textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: .55rem;
  padding: .75rem .85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #604c48;
  border-radius: 0;
}
textarea { resize: vertical; min-height: 112px; }
input:hover, textarea:hover { border-color: var(--muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--primary); box-shadow: inset 4px 0 var(--primary); }
.hint { margin: .45rem 0 0; color: var(--muted); font-size: .78rem; }
.error { min-height: 0; margin: .35rem 0 0; color: #ffafa4; font-size: .8rem; font-weight: 700; }
.error:empty { display: none; }
fieldset { padding: 0; border: 0; min-width: 0; }
legend { margin-bottom: .7rem; }
legend span { color: var(--muted); font-weight: 400; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.choice-grid label { position: relative; cursor: pointer; }
.choice-grid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-grid label > span {
  min-height: 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .1rem;
  padding: .55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}
.choice-grid small { color: var(--muted); font-size: .67rem; }
.choice-grid input:checked + span { color: var(--bg); background: var(--primary); border-color: var(--primary); box-shadow: 4px 4px 0 var(--secondary); transform: translate(-2px, -2px) rotate(-1deg); }
.choice-grid input:checked + span small { color: #3b1814; }
.choice-grid input:focus-visible + span { outline: 3px solid var(--secondary); outline-offset: 3px; }
.ornaments label > span { min-height: 52px; font: 700 1.5rem/1 var(--serif); }
.links-fieldset { padding-top: .4rem; }
.link-row { display: grid; grid-template-columns: .75fr 1.25fr; gap: .6rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }
.link-row label { font-size: .74rem; }
.link-row input { font-size: .85rem; font-weight: 400; }
.link-error { grid-column: 1 / -1; }

.primary-button {
  width: 100%;
  min-height: 54px;
  padding: .8rem 1.1rem;
  color: var(--bg);
  background: var(--primary);
  border: 2px solid var(--primary);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 6px 6px 0 var(--secondary);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--secondary); }
.primary-button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--secondary); }
.primary-button.is-celebrating { animation: nudge 320ms ease; }

.preview-panel { position: sticky; top: 1rem; min-width: 0; }
.preview-topline { display: flex; justify-content: space-between; color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .14em; }
.site-card {
  --card-pad: clamp(1.5rem, 5vw, 4rem);
  position: relative;
  width: 100%;
  aspect-ratio: 760 / 500;
  max-height: 500px;
  display: grid;
  gap: clamp(.65rem, 2vw, 1.5rem);
  overflow: hidden;
  padding: var(--card-pad);
  color: var(--text);
  background:
    radial-gradient(circle at 90% 10%, var(--secondary-soft), transparent 31%),
    radial-gradient(circle at 5% 91%, var(--primary-soft), transparent 27%),
    var(--surface);
  border: 2px solid #6b5550;
  box-shadow: 10px 10px 0 rgb(30 185 203 / 32%);
  clip-path: polygon(0 14px, 14px 0, 100% 0, 100% calc(100% - 15px), calc(100% - 17px) 100%, 0 100%);
}
.card-eyebrow { margin: 0; color: var(--accent); font-size: clamp(.55rem, 1vw, .7rem); font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.site-card h2 { max-width: 14ch; margin: 0; font: 700 clamp(2rem, 5vw, 4.6rem)/.88 var(--serif); letter-spacing: -.065em; overflow-wrap: anywhere; }
.card-hello { max-width: 35rem; margin: 0; font-size: clamp(.8rem, 1.7vw, 1.15rem); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-interest { margin: 0; padding: .65rem .8rem; background: var(--primary-soft); border: 1px solid rgb(253 140 126 / 40%); font-size: clamp(.68rem, 1.3vw, .9rem); overflow-wrap: anywhere; }
.card-interest strong { display: block; margin-bottom: .15rem; color: var(--primary); font-size: .62rem; letter-spacing: .11em; text-transform: uppercase; }
.card-links { display: flex; flex-wrap: wrap; gap: .45rem 1.2rem; align-items: end; }
.card-links a { font-size: clamp(.68rem, 1.3vw, .9rem); font-weight: 800; overflow-wrap: anywhere; }
.card-ornament { position: absolute; top: 5%; right: 5%; color: var(--primary); font: 700 clamp(1.8rem, 6vw, 4.2rem)/1 var(--serif); transform: rotate(9deg); }

.site-card.layout-note { grid-template-rows: auto 1fr auto auto; }
.site-card.layout-note .card-hello { align-self: center; }
.site-card.layout-shelf { grid-template-columns: minmax(0, 1.15fr) minmax(9rem, .85fr); align-content: center; }
.site-card.layout-shelf .card-eyebrow, .site-card.layout-shelf .card-links { grid-column: 1 / -1; }
.site-card.layout-shelf .card-interest { align-self: end; border-left: 4px solid var(--secondary); }
.site-card.layout-flyer { align-content: center; text-align: center; }
.site-card.layout-flyer h2 { justify-self: center; text-transform: uppercase; transform: rotate(-2deg); }
.site-card.layout-flyer .card-hello { justify-self: center; }
.site-card.layout-flyer .card-interest { justify-self: center; transform: rotate(1deg); }
.site-card.layout-flyer .card-links { justify-content: center; }

.finished { max-width: 760px; margin: 0 auto 7rem; padding: clamp(1.5rem, 5vw, 3rem); background: var(--surface); border: 1px solid var(--border); box-shadow: -8px 8px 0 var(--accent-soft); }
.has-result .maker { grid-template-columns: minmax(0, 760px); justify-content: center; padding-bottom: 2rem; }
.has-result .maker-form { display: none; }
.has-result .preview-panel { position: static; }
.has-result .preview-topline { display: none; }
.finish-actions { display: grid; grid-template-columns: minmax(14rem, 1fr) auto auto; gap: 1rem; align-items: center; margin: 1.7rem 0; }
.text-button { min-height: 44px; padding: .4rem; border: 0; background: transparent; text-decoration: underline; text-underline-offset: .23em; cursor: pointer; }
.text-button:hover { color: var(--primary); }
.download-status { min-height: 1.5rem; color: var(--accent); font-weight: 700; }
details { border-top: 1px dashed var(--border); padding-top: 1.2rem; }
summary { min-height: 44px; cursor: pointer; font-weight: 800; }
code { color: var(--accent); }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 2rem 0; color: var(--muted); border-top: 1px solid var(--border); font-size: .78rem; }
.noscript { position: fixed; inset: auto 1rem 1rem; z-index: 5; padding: 1rem; color: var(--bg); background: var(--accent); font-weight: 700; }

@keyframes nudge { 33% { transform: rotate(-1deg) translateX(-4px); } 66% { transform: rotate(1deg) translateX(4px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

@media (max-width: 820px) {
  .maker { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
  .finish-actions { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .masthead, main, footer { width: min(calc(100% - 28px), var(--max)); }
  .mast-note { display: none; }
  .intro { padding-top: 4.5rem; }
  .maker { padding-top: 2rem; gap: 2.5rem; }
  .link-row { grid-template-columns: 1fr; }
  .link-error { grid-column: 1; }
  .site-card { aspect-ratio: 4 / 5; max-height: none; --card-pad: clamp(1.2rem, 8vw, 2.4rem); }
  .site-card { gap: .55rem; }
  .site-card h2 { font-size: clamp(1.55rem, 8vw, 2.5rem); line-height: .92; }
  .card-hello { font-size: .7rem; line-height: 1.35; }
  .card-interest, .card-links a { font-size: .65rem; }
  .card-interest { padding: .4rem .55rem; }
  .card-links { gap: .3rem .7rem; }
  .site-card.layout-shelf { grid-template-columns: 1fr; align-content: center; }
  .site-card.layout-shelf .card-eyebrow, .site-card.layout-shelf .card-links { grid-column: 1; }
  .choice-grid small { display: none; }
  footer { flex-direction: column; }
}
