/* The CMS and builder sign-in palette: gold, warm paper, ink, 6px corners. */
:root {
    --bg-color: #F4F2EC;
    --text-color: #0a0a0a;
    --muted-text: #6c757d;
    --panel-bg: #fff;
    --panel-border: #d5d0c4;
    --gold: #c48f3b;
    --gold-hover: #b07e2f;
    --gold-tint: #fbf7f0;
    --error: #b42318;
    --success: #2f6f3a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0a0a0a;
        --text-color: #F4F2EC;
        --muted-text: #8a8a8a;
        --panel-bg: #161616;
        --panel-border: #3d3320;
        --gold-tint: rgba(196, 143, 59, 0.12);
        --error: #f08a80;
        --success: #8fcf99;
    }
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px clamp(16px, 4vw, 48px);
    border-bottom: 1px solid var(--panel-border);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-logo { width: 40px; height: 40px; display: block; }

.brand-name {
    font-family: 'Newsreader', serif;
    font-size: 1.5rem;
    font-weight: 400;
    letter-spacing: 0.01em;
}

.tagline {
    margin: 0;
    color: var(--gold);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: right;
}

/* ---------- middle ---------- */
.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: clamp(48px, 10vh, 120px) 16px;
    /* The headline's shatter canvas reaches past the screen edge on a phone.
       Clipped here, sideways only: on html or body a phone browser widens the
       page to fit the overflow anyway (measured), which is sideways scrolling. */
    overflow-x: clip;
}

.hero-title {
    /* Full width, so the reserved height is measured at the width text really wraps at. */
    width: 100%;
    position: relative;   /* the shatter canvas is placed over it */
    margin: 0;
    font-family: 'Newsreader', serif;
    font-weight: 400;
    /* Small enough on a phone that each line of the headline stays on one line. */
    font-size: clamp(1.75rem, 7vw, 4rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

/* On very narrow screens a line may still wrap: balance it rather than orphan a word. */
.hero-line {
    display: block;
    text-wrap: balance;
    /* Depth for the letters' 3D turn (js/headline.js). */
    perspective: 700px;
    perspective-origin: 50% 40%;
}
.hero-line + .hero-line { color: var(--gold); }

/* A word never splits across lines, though its letters animate one by one. */
.hero-word { display: inline-block; white-space: nowrap; }
.hero-char {
    display: inline-block;
    transform-origin: 50% 85%;
    backface-visibility: hidden;
    will-change: transform, opacity, filter;
}

.hero-shatter {
    position: absolute;
    pointer-events: none;
}

/* The old headline, laid exactly over the lines while it fades into the mesh. */
.hero-ghost {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hero-rule {
    width: 64px;
    border: 0;
    border-top: 1px solid var(--text-color);
    margin: 2rem auto;
}

.hero-lead {
    margin: 0 0 1rem;
    font-size: clamp(1.05rem, 2.2vw, 1.25rem);
}

.hero-body {
    margin: 0 0 2.5rem;
    color: var(--muted-text);
}

/* ---------- buttons ---------- */
.btn-gold,
.btn-outline {
    display: inline-block;
    border-radius: 6px;
    border: 2px solid var(--gold);
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.65rem 1.75rem;
    cursor: pointer;
}

.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-hover); border-color: var(--gold-hover); }
.btn-gold:disabled { opacity: 0.6; cursor: default; }

.btn-outline { background: transparent; color: var(--gold); }
.btn-outline:hover { background: var(--gold-tint); }

.btn-gold:focus-visible,
.btn-outline:focus-visible,
.contact-close:focus-visible,
.brand:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(196, 143, 59, 0.35);
}

/* ---------- footer ---------- */
.site-footer {
    padding: 20px 16px;
    border-top: 1px solid var(--panel-border);
    text-align: center;
    color: var(--muted-text);
    font-size: 0.85rem;
}

/* ---------- contact dialog ---------- */
.contact {
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    background: var(--panel-bg);
    color: var(--text-color);
}

.contact::backdrop { background: rgba(10, 10, 10, 0.55); }

.contact-form {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.contact-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.contact-head h2 {
    margin: 0;
    font-family: 'Newsreader', serif;
    font-weight: 400;
    font-size: 1.75rem;
}

.contact-close {
    border: 0;
    background: none;
    color: var(--muted-text);
    font-size: 1.75rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
}

.contact-close:hover { background: var(--gold-tint); color: var(--gold); }

.contact-intro {
    margin: 0.25rem 0 1.25rem;
    color: var(--muted-text);
    font-size: 0.9rem;
}

.contact-form label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.optional { color: var(--muted-text); font-weight: 400; }

.contact-form input,
.contact-form textarea {
    font: inherit;
    font-size: 0.95rem;
    color: var(--text-color);
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
}

.contact-form textarea { resize: vertical; min-height: 120px; }

.contact-form input:focus,
.contact-form textarea:focus {
    outline: 0;
    border-color: var(--gold);
    box-shadow: 0 0 0 0.2rem rgba(196, 143, 59, 0.25);
}

.contact-form [aria-invalid="true"] { border-color: var(--error); }

.hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.contact-status {
    min-height: 1.4em;
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.contact-status.is-error { color: var(--error); }
.contact-status.is-success { color: var(--success); }

/* Cancel is last and rightmost, as on every other GriotGallery screen. */
.contact-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ---------- progress / result dialog ---------- */
.send-status { width: min(400px, calc(100vw - 32px)); }

.send-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
}

.send-body h2 {
    margin: 1rem 0 0.25rem;
    font-family: 'Newsreader', serif;
    font-weight: 400;
    font-size: 1.6rem;
}

.send-body p {
    margin: 0 0 1.5rem;
    color: var(--muted-text);
}

.send-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.send-icon.is-busy {
    border: 3px solid var(--panel-border);
    border-top-color: var(--gold);
    animation: send-spin 0.9s linear infinite;
}

.send-icon.is-success { background: var(--gold); color: #fff; }
.send-icon.is-error { border: 2px solid var(--error); color: var(--error); }

@keyframes send-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .send-icon.is-busy { animation-duration: 3s; }
}

.send-actions { justify-content: center; width: 100%; }
.send-actions[hidden], .send-actions [hidden] { display: none; }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
    .site-header { flex-direction: column; gap: 8px; }
    .tagline { text-align: center; font-size: 0.7rem; letter-spacing: 0.18em; }
    .contact-actions .btn-gold,
    .contact-actions .btn-outline { flex: 1; padding-left: 0; padding-right: 0; }
    .send-actions .btn-gold,
    .send-actions .btn-outline { max-width: 50%; }
}
