/* Hipster Census: Victorian trade-catalogue meets specialty café. Cream paper, espresso ink, brass and brick accents. */

/* The @font-face rules are in Pages/Shared/_Layout.cshtml, where the font URLs can be fingerprinted. */

:root {
    --paper: #f3e9d6;
    --paper-deep: #e8dabd;
    --ink: #3b2a20;
    --ink-soft: #6b5444;
    --leather: #8a5a3b;
    --brick: #9b3d2e;
    --brass: #b08a3e;

    --font-display: "Playfair Display", "Didot", Georgia, serif;
    --font-body: "Libre Baskerville", Baskerville, Georgia, "Times New Roman", serif;
    --font-type: "Special Elite", "Courier New", monospace;

    --measure: 44rem;
    --gutter: 1rem;
}

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.65;
}

/* Paper grain, laid over everything so flat cream panels and engravings share one texture. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: 0.09;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .23 0 0 0 0 .16 0 0 0 0 .12 0 0 0 1.2 -.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main {
    flex: 1;
    width: 100%;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--gutter) 3rem;
}

a {
    color: var(--brick);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a:hover {
    color: var(--ink);
}

:focus-visible {
    outline: 3px solid var(--brick);
    outline-offset: 3px;
}

h1,
h2 {
    font-family: var(--font-display);
    font-weight: 900;
    line-height: 1.1;
    margin: 0;
}

/* ---------- Masthead and colophon ---------- */

.masthead {
    max-width: var(--measure);
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem var(--gutter) 0.9rem;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    border-bottom: 3px double var(--ink);
    margin-bottom: 1.5rem;
}

.masthead__brand {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.masthead__tag {
    font-family: var(--font-type);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.colophon {
    max-width: var(--measure);
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem var(--gutter) 2rem;
    border-top: 3px double var(--ink);
    text-align: center;
    font-size: 0.85rem;
    color: var(--ink-soft);
}

.colophon p {
    margin: 0;
}

/* ---------- Engravings: black ink on white, blended onto the paper and tinted espresso ---------- */

.engraving {
    position: relative;
    display: block;
    isolation: isolate;
    background: var(--paper);
}

.engraving img {
    display: block;
    width: 100%;
    height: auto;
    mix-blend-mode: multiply;
}

.engraving::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--ink);
    mix-blend-mode: lighten;
    pointer-events: none;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--ink);
    border-radius: 2px;
    font-family: var(--font-type);
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.15s ease, color 0.15s ease;
}

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

.btn--primary {
    background: var(--ink);
    color: var(--paper);
    box-shadow: 4px 4px 0 var(--brass);
}

.btn--primary:hover {
    background: var(--brick);
    border-color: var(--brick);
    color: var(--paper);
}

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

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

/* ---------- Typewriter labels ---------- */

.stamp,
.kicker,
.fineprint {
    font-family: var(--font-type);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.stamp {
    margin: 0 0 1rem;
    font-size: 0.8rem;
}

.nowrap {
    white-space: nowrap;
}

/* ---------- Landing ---------- */

.landing {
    text-align: center;
}

.kicker {
    margin: 0;
    font-size: 0.9rem;
}

.display {
    font-size: clamp(2.75rem, 11vw, 5rem);
    margin: 0.1rem 0 0.5rem;
}

.hero {
    margin: 0 auto 1.25rem;
}

.lede {
    max-width: 34rem;
    margin: 0 auto 1.75rem;
    font-size: 1.05rem;
    font-style: italic;
}

.landing__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.fineprint {
    margin-top: 1.25rem;
    font-size: 0.75rem;
}

/* ---------- Progress meter: a penny farthing rides to the finish ---------- */

.meter {
    --bike: 64px;
    margin: 0 0 1.5rem;
}

.meter__track {
    position: relative;
    height: 72px;
    border-bottom: 3px solid var(--ink);
    background: repeating-linear-gradient(90deg, var(--ink) 0 8px, transparent 8px 18px) bottom / 100% 3px no-repeat;
    color: var(--ink);
}

.meter__track::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -9px;
    border-bottom: 1px dotted var(--ink-soft);
}

.meter__rider {
    position: absolute;
    bottom: 0;
    width: var(--bike);
    height: 55px;
    left: calc(var(--to) * (100% - var(--bike) - 36px));
    overflow: visible;
    animation: ride 0.9s cubic-bezier(0.3, 0.7, 0.3, 1) both;
}

.meter__rider .wheel {
    transform-box: fill-box;
    transform-origin: center;
    animation: spin 0.9s cubic-bezier(0.3, 0.7, 0.3, 1) both;
}

.meter__finish {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 28px;
    height: 40px;
    overflow: visible;
}

@keyframes ride {
    from { left: calc(var(--from) * (100% - var(--bike) - 36px)); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(-540deg); }
}

/* ---------- Quiz ---------- */

.form-card {
    background: var(--paper);
    border: 2px solid var(--ink);
    padding: 1.25rem 1.25rem 1.5rem;
    box-shadow: 6px 6px 0 var(--paper-deep), 6px 6px 0 1px var(--ink);
}

.question {
    font-size: clamp(1.6rem, 6vw, 2.25rem);
    margin-bottom: 1.25rem;
}

.answers {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.answer {
    display: flex;
    align-items: stretch;
    width: 100%;
    padding: 0;
    border: 1.5px solid var(--ink);
    border-radius: 2px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.1s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.answer__mark {
    flex: none;
    display: grid;
    place-items: center;
    width: 3rem;
    border-right: 1.5px solid var(--ink);
    background: var(--paper-deep);
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.4rem;
}

.answer__text {
    flex: 1;
    padding: 0.85rem 1rem;
}

.answer:hover {
    background: var(--paper-deep);
    box-shadow: 3px 3px 0 var(--brass);
    transform: translate(-1px, -1px);
}

.answer:active {
    transform: translate(0, 1px);
    box-shadow: none;
}

.answer--chosen {
    background: var(--paper-deep);
    box-shadow: inset 0 0 0 2px var(--brick);
}

.answer--chosen .answer__mark {
    background: var(--brick);
    color: var(--paper);
}

.quiz__nav {
    margin-top: 1.5rem;
    font-family: var(--font-type);
    font-size: 0.9rem;
}

/* ---------- Result certificate ---------- */

.certificate {
    position: relative;
    padding: 3rem 1.75rem 2rem;
    background: var(--paper);
    border: 3px double var(--ink);
    outline: 1px solid var(--ink);
    outline-offset: 5px;
    margin: 6px;
    text-align: center;
}

.certificate {
    --corner: clamp(64px, 18vw, 110px);
}

/* Keep the opening lines clear of the corner flourishes. */
.certificate .stamp,
.certificate__preface {
    padding-inline: max(0px, calc(var(--corner) - 1.5rem));
}

.certificate .stamp {
    margin-bottom: 0.75rem;
}

.certificate__preface {
    margin: 0 0 0.4rem;
    font-style: italic;
    color: var(--ink-soft);
}

.certificate__title {
    font-size: clamp(2rem, 8vw, 3.25rem);
    color: var(--brick);
    margin-bottom: 1.25rem;
}

.portrait {
    max-width: 26rem;
    margin: 0 auto 1.25rem;
}

.certificate__description {
    max-width: 32rem;
    margin: 0 auto;
    font-size: 1.05rem;
    font-style: italic;
}

.corner {
    position: absolute;
    width: var(--corner);
    aspect-ratio: 1;
    pointer-events: none;
    z-index: 1;
}

.corner--tl { top: -3px; left: -3px; }
.corner--tr { top: -3px; right: -3px; transform: scaleX(-1); }
.corner--bl { bottom: -3px; left: -3px; transform: scaleY(-1); }
.corner--br { bottom: -3px; right: -3px; transform: scale(-1, -1); }

.divider {
    max-width: 30rem;
    margin: 1.5rem auto;
}

.breakdown {
    max-width: 30rem;
    margin: 0 auto 1.5rem;
    text-align: left;
}

.breakdown__heading {
    font-size: 1.15rem;
    text-align: center;
    margin-bottom: 0.9rem;
}

.bars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "label value" "track track";
    gap: 0.15rem 0.75rem;
    font-size: 0.9rem;
}

.bar__label { grid-area: label; }

.bar__value {
    grid-area: value;
    font-family: var(--font-type);
}

.bar__track {
    grid-area: track;
    height: 0.7rem;
    border: 1.5px solid var(--ink);
    background: repeating-linear-gradient(45deg, transparent 0 3px, rgba(59, 42, 32, 0.12) 3px 4px);
}

.bar__fill {
    display: block;
    height: 100%;
    background: var(--leather);
}

.bar--top .bar__label { font-weight: 700; }
.bar--top .bar__fill { background: var(--brick); }

.certificate__nemesis {
    margin: 0;
    font-size: 0.95rem;
}

.seal {
    width: 10rem;
    margin: 1.5rem auto 0;
    border-radius: 50%;
    overflow: hidden;
    transform: rotate(-8deg);
}

.seal__text {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    fill: var(--ink);
    font-family: "Libre Baskerville", Georgia, serif;
    font-weight: 700;
    font-size: 32px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.result__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
}

.result__actions form {
    display: contents;
}

.result__actions [hidden] {
    display: none;
}

/* ---------- Prose pages (privacy, errors) ---------- */

.prose h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

.prose h2 {
    font-size: 1.35rem;
    margin: 1.75rem 0 0.5rem;
}

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
    .meter__rider,
    .meter__rider .wheel {
        animation: none;
    }

    .answer,
    .btn {
        transition: none;
    }
}

@media (min-width: 40rem) {
    .form-card {
        padding: 2rem 2.25rem 2.25rem;
    }

    .certificate {
        padding: 3.5rem 3rem 2.5rem;
    }
}
