/* ---------------------------------------------------------------------------
   East Dorset Sailing Club — membership enquiry wizard.
   A faithful re-creation of the Typeform "Splash Raspberry" theme used by
   https://edsc.typeform.com/to/b0SAqy. Colours, radius and font come from the
   theme block of Forms/membership-application.json and are injected as custom
   properties by Index.cshtml, so re-theming is a JSON edit, not a CSS edit.
--------------------------------------------------------------------------- */

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

html,
body {
    height: 100%;
    margin: 0;
}

body.tf {
    background: var(--tf-background);
    color: var(--tf-question);
    font-family: var(--tf-font);
    font-size: 16px;
    line-height: 1.4;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.tf-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* --- deck & screens ------------------------------------------------------ */

.tf-deck {
    position: relative;
    height: 100%;
    overflow: hidden;
}

.tf-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 72px 24px 96px;
    will-change: transform, opacity;
}

.tf-screen[hidden] { display: none; }

.tf-screen.is-active {
    transform: translateY(0);
    opacity: 1;
}

.tf-screen.is-entering-forward  { animation: tf-in-up   var(--tf-slide, 520ms) cubic-bezier(.25, .8, .35, 1) both; }
.tf-screen.is-entering-backward { animation: tf-in-down var(--tf-slide, 520ms) cubic-bezier(.25, .8, .35, 1) both; }
.tf-screen.is-leaving-forward   { animation: tf-out-up  var(--tf-slide, 520ms) cubic-bezier(.25, .8, .35, 1) both; }
.tf-screen.is-leaving-backward  { animation: tf-out-down var(--tf-slide, 520ms) cubic-bezier(.25, .8, .35, 1) both; }

@keyframes tf-in-up    { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes tf-in-down  { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes tf-out-up   { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-100%); opacity: 0; } }
@keyframes tf-out-down { from { transform: translateY(0); opacity: 1; } to { transform: translateY(100%); opacity: 0; } }

.tf-screen__inner {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    align-items: center;
    gap: 40px 64px;
}

.tf-screen__inner--solo { max-width: 760px; grid-template-columns: minmax(0, 1fr); }
.tf-screen__inner--split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

.tf-block { min-width: 0; }

/* Screens (welcome / thank-you) are centred and set x-small; question fields
   are left aligned and set medium — mirroring theme.screens vs theme.fields. */
.tf-screen--welcome .tf-block,
.tf-screen--thankyou .tf-block { text-align: center; }

.tf-screen--welcome .tf-title,
.tf-screen--thankyou .tf-title { font-size: 1.625rem; }

.tf-screen--welcome .tf-description,
.tf-screen--thankyou .tf-description { font-size: 1rem; }

.tf-screen--welcome .tf-actions,
.tf-screen--thankyou .tf-actions { justify-content: center; }

/* --- heading ------------------------------------------------------------- */

.tf-heading { position: relative; }

.tf-number {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 0.875rem;
    line-height: 1;
    color: var(--tf-question);
    opacity: 0.75;
}

.tf-number svg { display: block; }
.tf-required { margin-left: 2px; }

.tf-title {
    margin: 0;
    font-size: 1.875rem;
    font-weight: 400;
    line-height: 1.35;
}

.tf-title p,
.tf-description p { margin: 0 0 0.5em; }

.tf-title p:last-child,
.tf-description p:last-child { margin-bottom: 0; }

.tf-title strong,
.tf-description strong { font-weight: 700; }

.tf-title ul,
.tf-description ul {
    margin: 0.5em 0 0;
    padding-left: 1.15em;
}

.tf-description {
    margin-top: 12px;
    font-size: 1.25rem;
    line-height: 1.45;
    opacity: 0.85;
}

.tf-recall { font-weight: inherit; }

/* A screen body pulled from the club wiki arrives as ordinary paragraphs,
   headings and lists rather than a single Typeform title, so it is set a step
   smaller than a title and given heading sizes of its own. */
.tf-wiki { font-size: 1.375rem; }
.tf-wiki h1, .tf-wiki h2, .tf-wiki h3, .tf-wiki h4 {
    margin: 0 0 0.4em;
    font-weight: 700;
    line-height: 1.3;
}
.tf-wiki h1 { font-size: 1.875rem; }
.tf-wiki h2 { font-size: 1.625rem; }
.tf-wiki h3, .tf-wiki h4 { font-size: 1.375rem; }
.tf-wiki p + h1, .tf-wiki p + h2, .tf-wiki p + h3,
.tf-wiki ul + h2, .tf-wiki ul + h3 { margin-top: 0.8em; }
.tf-wiki ul, .tf-wiki ol { margin: 0.5em 0; padding-left: 1.15em; }
.tf-wiki li { margin: 0.15em 0; }
.tf-wiki a { color: inherit; }
.tf-wiki table { border-collapse: collapse; margin: 0.5em 0; font-size: 0.9em; }
.tf-wiki th, .tf-wiki td {
    padding: 0.25em 0.6em;
    border: 1px solid color-mix(in srgb, var(--tf-question) 45%, transparent);
    text-align: left;
}
.tf-wiki img { max-width: 100%; height: auto; }

/* --- links (e.g. the Google Maps pin on the welcome screen) -------------- */

.tf-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.tf-screen--welcome .tf-links,
.tf-screen--thankyou .tf-links { justify-content: center; }

.tf-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid color-mix(in srgb, var(--tf-question) 55%, transparent);
    border-radius: var(--tf-radius);
    color: var(--tf-question);
    font-size: 0.9375rem;
    font-weight: 700;
    text-decoration: none;
    transition: background-color 120ms ease;
}

.tf-link:hover,
.tf-link:focus-visible { background: color-mix(in srgb, var(--tf-question) 14%, transparent); }

.tf-link__icon { display: block; width: 20px; height: 20px; }

/* --- answers ------------------------------------------------------------- */

.tf-answer:empty { display: none; }
.tf-answer { margin-top: 28px; }

.tf-input-wrap { position: relative; }

.tf-input {
    width: 100%;
    padding: 4px 0 8px;
    border: 0;
    border-bottom: 2px solid color-mix(in srgb, var(--tf-answer) 35%, transparent);
    background: transparent;
    color: var(--tf-answer);
    font-family: inherit;
    font-size: 1.875rem;
    line-height: 1.4;
    outline: none;
    transition: border-color 120ms ease;
}

.tf-input::placeholder {
    color: var(--tf-answer);
    opacity: 0.35;
}

.tf-input:focus { border-bottom-color: var(--tf-answer); }

/* A long answer (the contact message): a few lines high, set a step smaller
   than a one-line answer, with a character count underneath. */
.tf-input--long {
    display: block;
    min-height: 5.6em;
    max-height: 40vh;
    font-size: 1.375rem;
    resize: vertical;
}

.tf-input__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.8125rem;
    opacity: 0.75;
}

.tf-counter { white-space: nowrap; }
.tf-counter.is-full { font-weight: 700; opacity: 1; }
.tf-hint--inline { position: static; margin: 0; }

/* --- choices ------------------------------------------------------------- */

.tf-choices {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    gap: 8px;
}

.tf-choices--stacked { flex-direction: column; align-items: flex-start; }
.tf-choices--inline { flex-flow: row wrap; }

.tf-choice {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    max-width: 100%;
    padding: 9px 12px;
    border: 1px solid color-mix(in srgb, var(--tf-answer) 55%, transparent);
    border-radius: var(--tf-radius);
    background: color-mix(in srgb, var(--tf-answer) 10%, transparent);
    color: var(--tf-answer);
    font-family: inherit;
    font-size: 1.25rem;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.tf-choice:hover { background: color-mix(in srgb, var(--tf-answer) 20%, transparent); }
.tf-choice:focus-visible { outline: 2px solid var(--tf-answer); outline-offset: 2px; }

.tf-choice.is-selected {
    background: color-mix(in srgb, var(--tf-answer) 32%, transparent);
    border-color: var(--tf-answer);
}

.tf-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 2px;
    background: color-mix(in srgb, var(--tf-answer) 22%, transparent);
    color: var(--tf-answer);
    font-size: 0.8125rem;
    font-weight: 700;
    line-height: 1;
}

.tf-choice:hover .tf-key,
.tf-choice.is-selected .tf-key {
    background: var(--tf-answer);
    color: var(--tf-background);
}

.tf-choice__label { flex: 1 1 auto; }

.tf-choice__tick {
    flex: 0 0 auto;
    display: inline-flex;
    opacity: 0;
    transition: opacity 120ms ease;
}

.tf-choice.is-selected .tf-choice__tick { opacity: 1; }

/* picture choice */

.tf-choices--picture { flex-flow: row wrap; gap: 12px; }

.tf-choice--picture {
    flex-direction: column;
    gap: 0;
    min-width: 0;
    width: 150px;
    padding: 0;
    overflow: hidden;
}

.tf-choices--supersized .tf-choice--picture { width: 230px; }

.tf-choice__image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    padding: 18px;
    background: color-mix(in srgb, var(--tf-answer) 6%, transparent);
}

.tf-choice__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.tf-choice__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border-top: 1px solid color-mix(in srgb, var(--tf-answer) 30%, transparent);
    font-size: 1.0625rem;
}

/* --- rating -------------------------------------------------------------- */

.tf-rating {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tf-rating__step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--tf-radius);
    background: transparent;
    color: var(--tf-answer);
    font-family: inherit;
    cursor: pointer;
}

.tf-rating__step:hover { background: color-mix(in srgb, var(--tf-answer) 12%, transparent); }
.tf-rating__step:focus-visible { outline: 2px solid var(--tf-answer); outline-offset: 2px; }

.tf-rating__number { font-size: 0.8125rem; opacity: 0.7; }

.tf-rating.is-lit .tf-rating__step.is-lit .tf-rating__shape path { fill: currentColor; }

/* --- actions ------------------------------------------------------------- */

.tf-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 28px;
}

.tf-actions:empty { display: none; }

.tf-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border: 0;
    border-radius: var(--tf-radius);
    background: var(--tf-button);
    color: var(--tf-background);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
    font-family: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 120ms ease;
}

.tf-button:hover { opacity: 0.88; }
.tf-button:active { box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12); transform: translateY(2px); }
.tf-button:focus-visible { outline: 2px solid var(--tf-button); outline-offset: 3px; }
.tf-button[disabled] { opacity: 0.6; cursor: default; }

.tf-button__tick { display: block; }

.tf-hint {
    font-size: 0.75rem;
    letter-spacing: 0.01em;
    opacity: 0.75;
}

.tf-hint strong { font-weight: 700; }
.tf-hint__key { font-weight: 700; }

.tf-error {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    margin: 16px 0 0;
    padding: 6px 12px;
    border-radius: var(--tf-radius);
    background: #dc3f4b;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 700;
}

.tf-error[hidden] { display: none; }

/* --- media --------------------------------------------------------------- */

.tf-media {
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
}

.tf-media img {
    max-width: 100%;
    max-height: 66vh;
    border-radius: var(--tf-radius);
    object-fit: contain;
}

/* The small line-art attachments are 64px originals — showing them at column
   width would just blur them, which is not how the original form looks. */
.tf-media--icon img {
    max-width: 168px;
    border-radius: 0;
}

/* --- chrome: nav, progress, branding ------------------------------------- */

.tf-nav {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    gap: 2px;
    z-index: 3;
}

.tf-nav__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 34px;
    padding: 0;
    border: 0;
    background: var(--tf-button);
    color: var(--tf-background);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: opacity 120ms ease;
}

.tf-nav__button:first-child { border-radius: var(--tf-radius) 0 0 var(--tf-radius); }
.tf-nav__button:last-child { border-radius: 0 var(--tf-radius) var(--tf-radius) 0; }
.tf-nav__button:hover:not([disabled]) { opacity: 0.88; }
.tf-nav__button[disabled] { opacity: 0.45; cursor: default; }

.tf-progress {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 5px;
    background: rgba(0, 0, 0, 0.14);
    z-index: 3;
}

.tf-progress__fill {
    width: 0;
    height: 100%;
    background: var(--tf-answer);
    transition: width 320ms cubic-bezier(.25, .8, .35, 1);
}

.tf-branding {
    position: fixed;
    left: 16px;
    bottom: 18px;
    padding: 6px 10px;
    border-radius: var(--tf-radius);
    background: #fff;
    color: #111;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    z-index: 3;
}

.tf-branding:hover { opacity: 0.9; }

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 860px) {
    .tf-screen { padding: 56px 20px 96px; }

    .tf-screen__inner--split {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
    }

    /* Typeform stacks the attachment above the question on narrow screens. */
    .tf-screen__inner--split .tf-block { order: 2; }
    .tf-screen__inner--split .tf-media { order: 1; }

    .tf-media img { max-height: 32vh; }
    .tf-media--icon img { max-width: 108px; }

    .tf-title { font-size: 1.5rem; }
    .tf-description { font-size: 1.0625rem; }
    .tf-input { font-size: 1.5rem; }
    .tf-choice { font-size: 1.0625rem; min-width: 0; }
    .tf-button { font-size: 1.0625rem; }

    /* Keyboard hints are meaningless on touch, exactly as on the original. */
    .tf-hint { display: none; }

    .tf-branding { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .tf-screen { --tf-slide: 1ms; }
    .tf-progress__fill { transition: none; }
}
