/*
 * Ghostwriting — the public door of Assisted Writing.
 *
 * The page is built as an open book rather than as a landing page: a narrow verso of
 * running-head furniture (folio, section label, hairline rules) beside a recto of copy
 * at a readable measure, and one signature element — the blank first page, which shows
 * the title as he types it in the form below and waits for a caret. Everything else is
 * kept quiet so that element is the thing he remembers.
 *
 * Colours and the typeface are main.css's own custom properties, so this page sits in
 * the site's palette, follows the reader's theme (light, dark, sepia, high contrast) and
 * takes a White_Label_Instance override the same way the rest of the site does. No new
 * font is loaded: the difference from other pages here is layout, not a second typeface.
 *
 * Every offset is a logical property, because the page is offered in Arabic as well and
 * an Arabic author's book is written right-to-left.
 */

.gw-section {
    padding: 56px 24px 64px;
}

.gw-section--alt {
    background: var(--section-alt-bg);
}

.gw-inner {
    max-width: 1080px;
    margin-inline: auto;
}

/* ── the label that runs the page: folio furniture, not a badge ─────────────── */

.gw-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .17em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.gw-eyebrow::before {
    content: "";
    inline-size: 34px;
    border-block-start: 1px solid currentColor;
    opacity: .55;
}

/* ── the spread: copy on the recto, the page on the verso ───────────────────── */

.gw-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 56px;
    align-items: center;
    padding: 44px 0 8px;
}

.gw-h1 {
    margin: 0 0 18px;
    max-width: 20ch;
    font-family: var(--font-family-heading);
    font-size: clamp(2.1rem, 5vw, 3.35rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -.022em;
    color: var(--text-primary);
}

.gw-em {
    /* The one place the site's gradient is used, and only under the word it is about. */
    background: linear-gradient(90deg, var(--nav-accent), var(--nav-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gw-lede {
    max-width: 56ch;
    margin: 0 0 26px;
    font-size: 16.5px;
    line-height: 1.72;
    color: var(--text-secondary);
}

.gw-cta-row {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.gw-cta {
    padding: 14px 26px;
    font-size: 15.5px;
    font-weight: 600;
}

.gw-cta-note {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 26ch;
}

/* ── the signature: a blank first page that is not blank for long ───────────── */

.gw-leaf-wrap {
    display: grid;
    justify-items: center;
    gap: 12px;
}

.gw-leaf {
    inline-size: min(320px, 100%);
    aspect-ratio: 1 / 1.414;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 22px 24px 26px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color);
    /* The spine shadow, on the binding side: a page lying open, not a card floating. */
    border-inline-start-width: 3px;
    border-inline-start-color: var(--text-muted);
    box-shadow: 0 22px 44px -26px rgba(15, 23, 42, .4);
}

.gw-runthead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-block-end: 8px;
    border-block-end: 1px solid var(--border-color);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-muted);
    overflow: hidden;
    white-space: nowrap;
}

.gw-chapter {
    margin: 34px 0 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* His title, in the place a title belongs. Empty until he types it in the form below. */
.gw-leaf-title {
    margin: 0;
    font-family: var(--font-family-heading);
    font-size: 23px;
    font-weight: 600;
    line-height: 1.28;
    letter-spacing: -.012em;
    overflow-wrap: anywhere;
    color: var(--text-primary);
}

.gw-leaf-line {
    display: flex;
    align-items: flex-end;
    min-block-size: 30px;
}

.gw-caret {
    inline-size: 2px;
    block-size: 25px;
    margin-inline-start: 2px;
    background: var(--nav-accent-2);
    animation: gw-blink 1.15s steps(1, end) infinite;
}

.gw-leaf.is-typed .gw-caret {
    block-size: 17px;
}

@keyframes gw-blink {
    50% { opacity: 0; }
}

.gw-leaf-foot {
    margin-block-start: auto;
    text-align: center;
    font-size: 10px;
    letter-spacing: .18em;
    color: var(--text-muted);
}

.gw-leaf-caption {
    max-width: 30ch;
    margin: 0;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--text-muted);
}

/* ── the sequence: three stages, in order, because they are a sequence ──────── */

.gw-band {
    display: grid;
    grid-template-columns: minmax(0, 22ch) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

.gw-band-lede {
    max-width: 34ch;
    margin: 0;
    font-size: 15.5px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.gw-h2 {
    margin: 0 0 14px;
    font-family: var(--font-family-heading);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -.015em;
    color: var(--text-primary);
}

.gw-seq {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: gw-stage;
}

.gw-seq li {
    counter-increment: gw-stage;
    display: grid;
    grid-template-columns: 3ch 1fr;
    gap: 16px;
    padding: 18px 0;
    border-block-start: 1px solid var(--border-color);
}

.gw-seq li:last-child {
    border-block-end: 1px solid var(--border-color);
}

/* The number is a stage of his book being made, so printing it is information;
   it is drawn from the list counter, never typed, and cannot fall out of step. */
.gw-seq li::before {
    content: counter(gw-stage, decimal-leading-zero);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--text-muted);
    padding-block-start: 4px;
}

.gw-seq h3 {
    margin: 0 0 5px;
    font-size: 16.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.gw-seq p {
    margin: 0;
    max-width: 62ch;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* ── the four things he will be asked about, and what they become ────────────── */

.gw-asks {
    margin: 0;
    display: grid;
    gap: 0;
}

.gw-asks > div {
    display: grid;
    grid-template-columns: minmax(0, 20ch) minmax(0, 1fr);
    gap: 20px;
    padding: 15px 0;
    border-block-start: 1px solid var(--border-color);
}

.gw-asks dt {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.gw-asks dd {
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* ─ the wizard itself, which is the admin panel's and not a copy of it ─────── */

.gw-intake-head {
    margin: 0 0 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.gw-intake-body {
    min-width: 0;
}

.gw-intake .bi-form {
    max-width: none;
}

/* The step rail is a page edge on this door: it is where he is in the book. */
.gw-intake .bi-rail {
    margin-block-start: 20px;
    margin-block-end: 0;
    padding: 16px 16px 20px;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color);
    border-block-end: none;
    border-radius: 12px 12px 0 0;
}

/* The legends repeat the rail above — hide them; the fieldset keeps its border. */
.gw-intake .bi-step > legend {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.gw-intake .bi-step[data-step="1"] {
    border-radius: 0 0 12px 12px;
    margin-block-start: 0;
}

/* ── the questions he asks before handing a book to strangers ───────────────── */

.gw-faq {
    max-width: 76ch;
    margin: 0;
}

.gw-faq details {
    border-block-start: 1px solid var(--border-color);
    padding: 4px 0 14px;
}

.gw-faq details:last-of-type {
    border-block-end: 1px solid var(--border-color);
}

.gw-faq summary {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-block: 12px;
    cursor: pointer;
    list-style: none;
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.gw-faq summary::-webkit-details-marker {
    display: none;
}

/* The marker is a book's section mark, and it turns when the answer opens. */
.gw-faq summary::before {
    content: "§";
    flex: none;
    font-size: 13px;
    font-weight: 400;
    color: var(--nav-accent-2);
    transform: rotate(0deg);
    transition: transform .18s ease;
}

.gw-faq details[open] summary::before {
    transform: rotate(90deg);
}

.gw-faq summary:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 3px;
}

.gw-faq dd,
.gw-faq p {
    margin: 0;
    max-width: 66ch;
    font-size: 14.5px;
    line-height: 1.72;
    color: var(--text-secondary);
}

.gw-faq details > div {
    padding-inline-start: 25px;
}

/* ── the way out ───────────────────────────────────────────────────────────── */

.gw-close {
    display: grid;
    gap: 16px;
    justify-items: start;
    padding-block: 8px;
}

/* ── narrow: the spread closes, the verso goes above the recto ──────────────── */

@media (max-width: 900px) {
    .gw-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 34px;
        padding-block-start: 20px;
    }

    .gw-leaf-wrap {
        order: -1;
        justify-items: start;
    }

    .gw-leaf {
        inline-size: min(290px, 78%);
    }

    .gw-leaf-caption {
        text-align: start;
    }

    .gw-band {
        grid-template-columns: minmax(0, 1fr);
        gap: 20px;
    }
}

@media (max-width: 640px) {
    .gw-section {
        padding: 40px 16px 48px;
    }

    .gw-h1 {
        font-size: clamp(1.85rem, 8.4vw, 2.4rem);
    }

    .gw-asks > div,
    .gw-seq li {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .gw-seq li::before {
        padding-block-start: 0;
    }
}

/* The page must still read as a page when nothing is allowed to move. */
@media (prefers-reduced-motion: reduce) {
    .gw-caret {
        animation: none;
    }

    .gw-faq summary::before {
        transition: none;
    }
}
