/* ============ TOKENS ============ */
:root {
    --stage: #FBE0D3;
    /* slightly deeper beige for surrounding */
    --paper: #FEE9DF;
    /* dominant beige canvas */
    --paper-2: #FBE0D3;
    /* slightly deeper beige */
    --paper-3: #F6D8C9;
    /* deeper beige variant */
    --paper-deep: #FCF3EC;
    /* lifted paper panel */
    --panel: #FCF3EC;
    /* lifted paper panel */
    --panel-warm: #FFF6F0;
    /* warm panel variant */
    --ink: #2a2823;
    /* charcoal ink */
    --ink-soft: #6f6a5c;
    /* muted ink for captions/hints */
    --line: #E4C9BB;
    /* hairline on beige */
    --line-soft: #EAD3C6;
    /* soft line variant */
    --line-strong: rgba(42, 40, 35, 0.28);
    /* strong line for emphasis */
    --blue: #00BAB2;
    /* teal accent */
    --blue-deep: #00928C;
    /* deep teal */
    --blue-tint: #E0F7F6;
    --rust: #a14730;
    /* warm error tone */
    --rust-tint: #f3e3dd;
    --radius: 3px;
    --shadow: 0 1px 2px rgba(42, 40, 35, 0.05), 0 18px 40px -18px rgba(42, 40, 35, 0.28);
    font-size: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: #FFF6F0;
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

button {
    font-family: inherit;
}

::selection {
    background: var(--blue);
    color: var(--paper);
}

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

/* ============ GRAIN (fractal noise overlay) ============ */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    filter: url(#fractalGrain);
    opacity: 0.08;
    mix-blend-mode: overlay;
}

/* ============ STAGE / LAYOUT ============ */
.stage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 64px;
    position: relative;
    z-index: 1;
}

.sheet {
    position: relative;
    width: min(760px, 94vw);
    aspect-ratio: 5 / 7;
    /* fixed editorial / print-page proportion */
    max-height: 92vh;
    background: var(--panel-warm);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: sheetIn 700ms cubic-bezier(.16, .84, .32, 1) both;
}

@keyframes sheetIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-height:760px),
(max-width:640px) {
    .sheet {
        aspect-ratio: auto;
        max-height: none;
        height: auto;
    }
}

/* ---- folio header ---- */
.folio {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px 18px;
    flex: 0 0 auto;
}

.folio__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.folio__mark {
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    background: var(--blue);
    color: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bitter', serif;
    font-weight: 700;
    font-size: 15px;
    border-radius: 2px;
}

.folio__name {
    font-family: 'Bitter', serif;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}

.folio__sub {
    font-size: 11px;
    letter-spacing: .04em;
    color: var(--ink-soft);
    margin-top: 1px;
}

.folio__count {
    font-family: 'Bitter', serif;
    font-size: 13px;
    color: var(--ink-soft);
    letter-spacing: .02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

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

/* ---- progress rail ---- */
.rail {
    padding: 0 28px;
    flex: 0 0 auto;
}

.rail__track {
    position: relative;
    height: 1px;
    background: var(--line-strong);
    width: 100%;
}

.rail__fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 1px;
    background: var(--blue);
    width: 0%;
    transition: width 520ms cubic-bezier(.16, .84, .32, 1);
}

.rail__ticks {
    list-style: none;
    display: flex;
    justify-content: space-between;
    padding: 7px 0 16px;
    margin: 0;
}

.rail__ticks li {
    font-family: 'Bitter', serif;
    font-size: 11px;
    color: var(--ink-soft);
    letter-spacing: .04em;
    position: relative;
    padding-left: 11px;
}

.rail__ticks li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--line-strong);
}

.rail__ticks li.is-done {
    color: var(--blue);
}

.rail__ticks li.is-done::before {
    background: var(--blue);
}

.rail__ticks li.is-current {
    color: var(--ink);
    font-weight: 600;
}

.rail__ticks li.is-current::before {
    background: var(--ink);
}

/* ---- scrollable body ---- */
.sheet__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 28px 24px;
    scrollbar-width: thin;
}

.sheet__body::-webkit-scrollbar {
    width: 8px;
}

.sheet__body::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 4px;
}

.panel {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.panel[hidden] {
    display: none;
}

.panel__eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--blue);
}

.panel__eyebrow svg {
    width: 14px;
    height: 14px;
    stroke: var(--blue);
}

.panel__heading {
    font-family: 'Bitter', serif;
    font-weight: 600;
    font-size: 27px;
    line-height: 1.18;
    letter-spacing: -.01em;
}

.panel__sub {
    font-size: 14.5px;
    color: var(--ink-soft);
    line-height: 1.55;
    max-width: 46ch;
}

/* ============ STAGGER ANIMATION ============ */
@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel.is-active .stagger {
    animation: riseIn 460ms cubic-bezier(.16, .84, .32, 1) both;
}

@media (prefers-reduced-motion:reduce) {

    .sheet,
    .panel.is-active .stagger {
        animation: none !important;
    }
}

/* ============ FIELDS ============ */
.field {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.field__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.field__label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 6px;
}

.field__label .icon {
    width: 14px;
    height: 14px;
    stroke: var(--ink-soft);
    flex: 0 0 auto;
}

.req {
    color: var(--blue);
    font-weight: 600;
}

.field__hint {
    font-size: 12px;
    color: var(--ink-soft);
}

.field__error {
    display: none;
    font-size: 12.5px;
    color: var(--rust);
}

.field.is-invalid .field__error {
    display: block;
}

.field.is-invalid .field__input,
.field.is-invalid .pillset,
.field.is-invalid .chipset,
.field.is-invalid select {
    border-color: var(--rust) !important;
}

.row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width:520px) {
    .row2 {
        grid-template-columns: 1fr;
    }
}

.field__input,
select.field__input,
textarea.field__input {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 11px 13px;
    font-size: 14.5px;
    color: var(--ink);
    font-family: 'Inter', sans-serif;
}

.field__input::placeholder {
    color: #aba582;
}

textarea.field__input {
    resize: vertical;
    min-height: 74px;
    line-height: 1.5;
}

select.field__input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236f6a5c' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
}

.field__input:focus,
select.field__input:focus,
textarea.field__input:focus {
    border-color: var(--blue);
    background: #fff;
}

/* ---- pill (single select) ---- */
.pillset {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.pill {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 9px 16px;
    border-radius: 99px;
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color 150ms, color 150ms, background 150ms;
}

.pill:hover {
    border-color: var(--blue);
}

.pill.is-selected {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* ---- chip (multi select) ---- */
.chipset {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 9px 16px;
    border-radius: 99px;
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color 150ms, color 150ms, background 150ms;
}

.chip:hover {
    border-color: var(--blue);
}

.chip.is-selected {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

/* ---- toggle ---- */
.field--toggle {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: #fff;
}

.field--toggle .field__label {
    margin-bottom: 2px;
}

.switch {
    width: 42px;
    height: 24px;
    border-radius: 99px;
    border: 1px solid var(--line-strong);
    background: #e3dcc6;
    position: relative;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 150ms, border-color 150ms;
}

.switch__knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
    transition: transform 150ms;
}

.switch.is-on {
    background: var(--blue);
    border-color: var(--blue);
}

.switch.is-on .switch__knob {
    transform: translateX(18px);
}

/* ---- accordion (step 3) ---- */
.accordion {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}

.accordion__head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: none;
    padding: 15px 16px;
    cursor: pointer;
    text-align: left;
}

.accordion__icon {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    border-radius: 6px;
    background: var(--blue-tint);
    display: flex;
    align-items: center;
    justify-content: center;
}

.accordion__icon svg {
    width: 14px;
    height: 14px;
    stroke: var(--blue-deep);
}

.accordion__title {
    flex: 1;
    font-size: 13.5px;
    font-weight: 600;
}

.accordion__badge {
    font-family: 'Bitter', serif;
    font-size: 12px;
    color: var(--blue-deep);
    background: var(--blue-tint);
    min-width: 22px;
    text-align: center;
    border-radius: 99px;
    padding: 2px 7px;
}

.accordion__chevron {
    width: 9px;
    height: 9px;
    border-right: 1.5px solid var(--ink-soft);
    border-bottom: 1.5px solid var(--ink-soft);
    transform: rotate(45deg);
    transition: transform 180ms;
    margin: 0 2px 0 4px;
}

.accordion.is-open .accordion__chevron {
    transform: rotate(225deg);
    margin-top: 4px;
}

.accordion__body {
    padding: 4px 16px 18px;
    border-top: 1px solid var(--line);
}

.accordion__body[hidden] {
    display: none;
}

.accordion.is-invalid {
    border-color: var(--rust);
}

.accordion__error {
    display: none;
    font-size: 12.5px;
    color: var(--rust);
    padding: 0 16px 14px;
}

.accordion.is-invalid .accordion__error {
    display: block;
}

/* ---- tone cards (step 4) ---- */
.cardset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width:520px) {
    .cardset {
        grid-template-columns: 1fr;
    }
}

.tonecard {
    text-align: left;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius);
    padding: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tonecard__icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--paper);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
}

.tonecard__icon svg {
    width: 13px;
    height: 13px;
    stroke: var(--ink-soft);
}

.tonecard__title {
    font-size: 13.5px;
    font-weight: 600;
}

.tonecard__desc {
    font-size: 12px;
    color: var(--ink-soft);
}

.tonecard.is-selected {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}

.tonecard.is-selected .tonecard__title {
    color: #fff;
}

.tonecard.is-selected .tonecard__desc {
    color: rgba(255, 255, 255, 0.85);
}

.tonecard.is-selected .tonecard__icon {
    background: rgba(255, 255, 255, 0.2);
}

.tonecard.is-selected .tonecard__icon svg {
    stroke: #fff;
}

/* ---- color swatches (step 4) ---- */
.swatchset {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width:520px) {
    .swatchset {
        grid-template-columns: 1fr;
    }
}

.swatch {
    display: flex;
    align-items: center;
    gap: 11px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius);
    padding: 11px 13px;
    cursor: pointer;
    font-size: 13.5px;
}

.swatch__chip {
    width: 26px;
    height: 26px;
    border-radius: 4px;
    flex: 0 0 auto;
    border: 1px solid var(--line);
}

.swatch.is-selected {
    border-color: var(--blue);
    background: var(--blue);
    color: #fff;
}

/* ============ NAV / BUTTONS ============ */
.sheet__nav {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px 22px;
    border-top: 1px solid var(--line);
    gap: 12px;
}

.btn {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius);
    padding: 11px 22px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    transition: opacity 150ms, transform 100ms;
}

.btn:active {
    transform: translateY(1px);
}

.btn--ghost {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn--ghost:hover {
    background: var(--paper-deep);
}

.btn--solid {
    background: var(--blue);
    color: #fff;
}

.btn--solid:hover {
    background: var(--blue-deep);
}

.btn[hidden] {
    visibility: hidden;
}

.btn svg {
    width: 13px;
    height: 13px;
}

/* ============ COMPLETION ============ */
.done {
    align-items: center;
    text-align: center;
    padding-top: 18px;
}

.done__check {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--blue-tint);
    border: 1px solid var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.done__check svg {
    width: 22px;
    height: 22px;
    stroke: var(--blue-deep);
}

.done__heading {
    font-family: 'Bitter', serif;
    font-size: 24px;
    font-weight: 600;
}

.done__sub {
    font-size: 14px;
    color: var(--ink-soft);
    max-width: 42ch;
    line-height: 1.55;
}

.templates {
    display: flex;
    gap: 13px;
    width: 100%;
    margin-top: 6px;
}

@media (max-width:560px) {
    .templates {
        flex-direction: column;
    }
}

.tplcard {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    text-align: left;
    background: var(--paper);
}

.tplcard.is-recommended {
    border-color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
}

.tplcard__swatch {
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Bitter', serif;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.tplcard__body {
    padding: 11px 13px;
}

.tplcard__name {
    font-size: 13.5px;
    font-weight: 600;
}

.tplcard__tag {
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-top: 2px;
}

.tplcard__tag.rec {
    color: var(--blue-deep);
}

.tplcard__tag.alt {
    color: var(--ink-soft);
}

.done__note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-align: left;
    background: var(--rust-tint);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.55;
    color: #5c3322;
}

.done__note svg {
    width: 16px;
    height: 16px;
    stroke: #8a4326;
    flex: 0 0 auto;
    margin-top: 2px;
}

.done__restart {
    font-size: 12.5px;
    color: var(--ink-soft);
    text-decoration: underline;
    cursor: pointer;
    margin-top: 4px;
    background: none;
    border: none;
    font-family: inherit;
}

/* ---- caption under the page, like a figure caption ---- */
.stage__caption {
    font-family: 'Bitter', serif;
    font-style: italic;
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 16px;
    letter-spacing: .01em;
}