/* ── Slide-in Form Panel ───────────────────────────────────────────────────── */

.core-theme-form-panel__body .gform-theme--foundation .gform_fields {
    display: flex !important;
    flex-direction: column !important;
}

.core-theme-form-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.35s ease,
        visibility 0.35s ease;
}

.core-theme-form-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.core-theme-form-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 720px;
    background: var(--wp--preset--color--core-theme-white);
    z-index: 99999;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -8px 0 40px color-mix(in srgb, var(--wp--preset--color--core-theme-neutral-darkest) 18%, transparent);
}

.core-theme-form-panel.is-open {
    transform: translateX(0);
}

/* ── Header ──────────────────────────────────────────────────────────────────── */

.core-theme-form-panel__header {
    background: var(--wp--preset--color--core-theme-tiber);
    color: var(--wp--preset--color--core-theme-white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    flex-shrink: 0;
}

.core-theme-form-panel__phone {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--wp--preset--font-size--core-theme-medium);
    font-weight: 700;
    line-height: 1.5;
    color: var(--wp--preset--color--core-theme-white);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.core-theme-form-panel__phone:hover {
    color: var(--wp--preset--color--core-theme-white);
    opacity: 0.85;
    text-decoration: none;
}

.core-theme-form-panel__close {
    background: none;
    border: none;
    color: var(--wp--preset--color--core-theme-white);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    border-radius: 0;
}

.core-theme-form-panel__close:hover {
    background: none;
    color: var(--wp--preset--color--core-theme-white);
    opacity: 0.7;
}

/* ── Body ────────────────────────────────────────────────────────────────────── */

.core-theme-form-panel__body {
    flex: 1;
    overflow-y: auto;

    /* 80px sides put the content in a 560px column inside the 720px panel, as
       drawn. Far too generous on a phone — see the narrow-screen block below. */
    padding: 32px 80px 56px;
    -webkit-overflow-scrolling: touch;
}

.core-theme-form-panel__title {
    font-family: var(--wp--preset--font-family--titling-gothic-fb-wide);
    font-size: var(--wp--preset--font-size--core-theme-heading-four);
    font-weight: 500;
    line-height: 1.3;
    color: var(--wp--preset--color--core-theme-tiber);
    margin: 0 0 16px;
}

/* The closing full stop, in Mantis like every section heading's. */
.core-theme-form-panel__accent {
    color: var(--wp--preset--color--core-theme-mantis);
}

.core-theme-form-panel__desc {
    font-size: var(--wp--preset--font-size--core-theme-medium);
    line-height: 1.5;
    color: var(--wp--preset--color--core-theme-neutral-dark);
    margin: 0 0 24px;
}

/* Small print under the submit button. */
.core-theme-form-panel__note {
    font-size: var(--wp--preset--font-size--core-theme-small);
    line-height: 1.5;
    color: var(--wp--preset--color--core-theme-neutral);
    margin: 12px 0 0;
}

/* On a phone the panel is the whole screen, so the 80px column of the design
   would leave the fields barely half the width. */
@media (max-width: 600px) {
    .core-theme-form-panel__header {
        padding: 16px 20px;
    }

    .core-theme-form-panel__body {
        padding: 28px 20px 40px;
    }
}

/* ── Body scroll lock ────────────────────────────────────────────────────────── */

body.core-theme-panel-open {
    overflow: hidden;
}

/* ── Gravity Forms fields ───────────────────────────────────────────────────── */

/* Instrument Sans across every Gravity Form. GF's font variables all resolve back to
   --gf-font-family-base: controls and placeholders through -primary, labels
   through -secondary, descriptions through -tertiary, buttons and validation
   direct. Setting that one variable therefore covers the lot.

   The element rule after it is for the no-framework theme, which predates the
   CSS API and does not read those variables. */
.gform_wrapper {
    --gf-font-family-base: var(--wp--preset--font-family--instrument-sans, "Instrument Sans", sans-serif);
}

.gform_wrapper input,
.gform_wrapper select,
.gform_wrapper textarea,
.gform_wrapper button,
.gform_wrapper label,
.gform_wrapper legend,
.gform_wrapper .gfield_description,
.gform_wrapper .gform_button {
    font-family: var(--wp--preset--font-family--instrument-sans, "Instrument Sans", sans-serif) !important;
}

/* Field metrics come from Gravity Forms' own CSS API custom properties rather
   than from per-element overrides. GF derives the height, radius, font size and
   padding of every control from these, so input, select and textarea stay in
   step — and the select keeps its native chevron, which GF sizes and positions
   from these same variables. Scoped to --framework so the no-framework
   subscription form in style.css is left alone; the doubled class is needed to
   out-specify GF's own defaults, which are declared on `.gform-theme--framework`
   in a stylesheet that loads after this one. */
.gform_wrapper.gform-theme--framework {
    --gf-ctrl-size: 52px;
    --gf-ctrl-size-md: 52px;
    --gf-ctrl-line-height: 52px;
    --gf-ctrl-font-size: 16px;
    --gf-ctrl-padding-x: 16px;
    --gf-ctrl-radius: 3px;
    --gf-ctrl-select-icon-size: 12px;

    /* GF caps the radius on larger controls via `min()`, so the textarea would
       otherwise disagree with every other field. */
    --gf-ctrl-radius-max-lg: 3px;
}

.gform-theme--foundation .gform_fields {
    row-gap: 20px !important;
}

.gform-body.gform_body input,
.gform-body.gform_body textarea,
.gform-body.gform_body select {
    width: 100%;
    border-color: #d8d8d8 !important;
    background-color: #ffffff !important;
    outline: none;
    box-shadow: none !important;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    box-sizing: border-box;
    border-radius: 12px !important;
}

/* A select ignores the control line-height GF gives inputs, so its text sits
   high in the taller box — set it explicitly to centre the value. The chevron is
   pinned by `right 10px center !important` in style.css; re-align it to the
   field's own padding. Both need to out-specify that rule. */
.gform-theme--framework .gform-body.gform_body select {
    line-height: var(--gf-ctrl-line-height);
    background-position: right var(--gf-ctrl-padding-x) center !important;
    padding-right: calc(var(--gf-ctrl-padding-x) * 2 + var(--gf-ctrl-select-icon-size)) !important;
}

.gfield_label {
    color: #515353 !important;
    font-weight: 400 !important;
}

.gform_body input::placeholder,
.gform_body textarea::placeholder {
    color: #838484 !important;
}

.gform_body input:focus,
.gform_body textarea:focus,
.gform_body select:focus {
    border-color: #2a3136 !important;
    outline-color: rgba(37, 57, 89, 0.15) !important;
}

/* ── Panel fields ───────────────────────────────────────────────────────────

   The slide-in panel draws its fields differently from the forms sitting in
   page content: 56px boxes with an 8px corner and a light border, semibold
   Tiber labels with a Mantis asterisk. All of it is scoped to the panel body so
   the subscription forms on the page keep the metrics set above.

   Each selector here carries one class more than the rule it overrides, which
   is what lets it win — several of those rules are !important. */

.core-theme-form-panel__body .gform_wrapper.gform-theme--framework {
    --gf-ctrl-size: 56px;
    --gf-ctrl-size-md: 56px;
    --gf-ctrl-line-height: 56px;
    --gf-ctrl-padding-x: 16px;
    --gf-ctrl-radius: 8px;

    /* GF caps the radius of taller controls separately, so without this the
       textarea would stay at the smaller corner. */
    --gf-ctrl-radius-max-lg: 8px;
}

.core-theme-form-panel__body .gform-theme--foundation .gform_fields {
    row-gap: 24px !important;
}

.core-theme-form-panel__body .gform-body.gform_body input,
.core-theme-form-panel__body .gform-body.gform_body textarea,
.core-theme-form-panel__body .gform-body.gform_body select {
    border-color: var(--wp--preset--color--core-theme-neutral-lighter) !important;
    border-radius: 8px !important;
    color: var(--wp--preset--color--core-theme-neutral-dark);
}

/* 160px as drawn. Gravity Forms sizes its "large" textarea with a 192px
   min-block-size, so both lengths need !important to come down to it. */
.core-theme-form-panel__body .gform-body.gform_body textarea {
    height: 160px !important;
    min-block-size: 160px !important;
    padding: 16px;
}

.core-theme-form-panel__body .gform_body input::placeholder,
.core-theme-form-panel__body .gform_body textarea::placeholder {
    color: var(--wp--preset--color--core-theme-neutral) !important;
}

.core-theme-form-panel__body .gform_body input:focus,
.core-theme-form-panel__body .gform_body textarea:focus,
.core-theme-form-panel__body .gform_body select:focus {
    border-color: var(--wp--preset--color--core-theme-tiber) !important;
}

.core-theme-form-panel__body .gfield_label {
    display: flex;
    gap: 4px;
    color: var(--wp--preset--color--core-theme-tiber) !important;
    font-size: var(--wp--preset--font-size--core-theme-medium) !important;
    font-weight: 600 !important;
    line-height: 1.5;
    margin: 0 0 8px !important;
}

/* The required asterisk, in Mantis Dark as drawn. */
.core-theme-form-panel__body .gfield_required {
    display: inline;
    margin: 0;
    color: var(--wp--preset--color--core-theme-mantis-dark) !important;
    font-size: inherit !important;
    font-weight: inherit !important;
}

.core-theme-form-panel__body .gform-footer {
    margin-top: 32px !important;
    padding: 0 !important;
}

/* Primary button, as drawn: the theme's default button (Mantis, 4px corner,
   12px / 42px padding, bold). The site-wide submit style further down is the
   older Tiber pill with an arrow, so the panel restates the default here. */
.core-theme-form-panel__body .gform_button.button {
    background-color: var(--wp--preset--color--core-theme-mantis) !important;
    background-image: none !important;
    color: var(--wp--preset--color--core-theme-white) !important;
    padding: 12px 42px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
}

.core-theme-form-panel__body .gform_button.button:hover,
.core-theme-form-panel__body .gform_button.button:focus {
    background-color: var(--wp--preset--color--core-theme-mantis-dark) !important;
}

/* ── Submit button ──────────────────────────────────────────────────────────

   Matches the theme's default button. A block button gets that look from the
   `wp-element-button` class, which is what theme.json's `styles.elements.button`
   compiles to — but Gravity Forms renders the submit as an `<input>` we cannot
   add a class to, so the values are restated here. They are read from the same
   presets theme.json uses, so a change to the palette or type scale still
   reaches this button.

   Kept in step with theme.json > styles.elements.button. */
.gform_button.button {
    background-color: var(--wp--preset--color--core-theme-tiber, #04262f) !important;
    color: var(--wp--preset--color--core-theme-white, #ffffff) !important;
    padding: 10px 20px !important;
    border: 0 !important;
    border-radius: 100px !important;
    font-family: var(--wp--preset--font-family--instrument-sans, "Instrument Sans", sans-serif) !important;
    font-size: var(--wp--preset--font-size--core-theme-medium, 16px) !important;
    font-style: normal !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;
    width: auto !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Repeats the resting colour to override Gravity Forms' own hover background. */
.gform_button.button:hover,
.gform_button.button:focus {
    background-color: var(--wp--preset--color--core-theme-tiber-dark, #031e25) !important;
    color: var(--wp--preset--color--core-theme-white, #ffffff) !important;
}

.gform_button.button:focus-visible {
    outline: 2px solid var(--wp--preset--color--core-theme-neutral-dark, #4c4d4d) !important;
    outline-offset: 2px !important;
}

/* The trailing arrow.

   An `<input>` cannot carry a pseudo-element, so the arrow is a background
   image rather than an `::after` — the same artwork the theme's own arrow
   buttons use, which already ships white and so needs no tinting. The right
   padding is the button's own 20px plus room for the arrow and its gap. */
.gform_button.button {
    background-image: url('../svg/button-arrow.svg') !important;
    background-repeat: no-repeat !important;
    background-position: right 20px center !important;
    background-size: 20px auto !important;
    padding-right: 52px !important;
    max-height: fit-content;
}

/* ── Radio choices ──────────────────────────────────────────────────────────

   The design draws each choice as a pill with a square tick box, so `.gchoice`
   becomes the pill and the input is restyled into the box. `:has()` is what
   lets the pill react to its own input being checked — Gravity Forms adds no
   class for the selected state. */

/* The orbital theme lays choices out as a grid of equal columns, which both
   stretches every pill to the widest one and wraps the longest label onto two
   lines. These undo that, and need !important because that grid is declared at
   a higher specificity in a stylesheet that loads after this one. */
.gform_wrapper .gfield_radio {
    display: flex !important;

    /* Gravity Forms stacks radio choices with `flex-direction: column`, so
       simply switching the container back to flex left them one per line, each
       stretched across the row by the cross-axis stretch. The row direction is
       what actually puts the pills side by side; `wrap` then only comes into
       play in a container too narrow to hold all three. */
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    grid-template-columns: none !important;
}

.gform_wrapper .gfield_radio .gchoice {
    display: inline-flex !important;
    align-items: center;
    gap: 10px !important;
    grid-template-columns: none !important;

    /* Sized by its own label, as in the design, rather than stretching to the
       row. `width` alone is not enough — as a flex item it would still grow. */
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 12px 20px;
    border: 1px solid #d1d4db;
    border-radius: 100px;
    background: #ffffff;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.gform_wrapper .gfield_radio .gchoice:hover {
    border-color: var(--wp--preset--color--core-theme-tiber, #04262f);
}

.gform_wrapper .gfield_radio .gchoice:has(input:checked) {
    border-color: var(--wp--preset--color--core-theme-tiber, #04262f);
    background: #edf5ff;
}

.gform_wrapper .gfield_radio .gchoice:has(input:focus-visible) {
    outline: 2px solid var(--wp--preset--color--core-theme-tiber, #04262f);
    outline-offset: 2px;
}

/* The radio, redrawn as the design's rounded square. */
.gform_wrapper .gfield_radio .gchoice input[type='radio'] {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0 !important;
    padding: 0;
    border: 1.5px solid #c9ccd4;
    border-radius: 5px;
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;

    /* The generic field rule above sets `border-color` and `background-color`
       with !important on every input, so the box has to answer in kind. */
    border-color: #c9ccd4 !important;
    background-color: #ffffff !important;
}

/* The mark inside the box is Gravity Forms' own `::before`, which it centres in
   the control and leaves transparent. Reshaped from GF's dot into a white
   check: two borders on a rotated rectangle, so the tick costs no image and
   scales with nothing but these numbers. */
.gform_wrapper .gfield_radio .gchoice input[type='radio']::before {
    width: 5px;
    height: 9px;
    border-radius: 0;
    background-color: transparent !important;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;

    /* The rotation pivots around the centre, which leaves the tick sitting low
       and right of it; the translate puts it back. */
    transform: rotate(45deg) translate(-1px, -1px);
}

.gform_wrapper .gfield_radio .gchoice input[type='radio']:checked {
    border-color: var(--wp--preset--color--core-theme-tiber, #04262f) !important;
    background-color: var(--wp--preset--color--core-theme-tiber, #04262f) !important;
}

.gform_wrapper .gfield_radio .gchoice label {
    margin: 0 !important;
    padding: 0 !important;
    color: var(--wp--preset--color--core-theme-neutral-dark, #4c4d4d);
    font-size: 16px;
    line-height: 1.3;
    cursor: pointer;
    transition: color 0.2s ease;

    /* One line per pill, as drawn. Without this the longest choice breaks and
       that pill grows taller than its neighbours. */
    white-space: nowrap;
}

.gform_wrapper .gfield_radio .gchoice:has(input:checked) label {
    color: var(--wp--preset--color--core-theme-tiber, #04262f);
}

/* The pills keep their labels on one line, so on a narrow phone the longest
   choice would otherwise be wider than the screen and push the page sideways.
   Scaling the type and padding down keeps it inside a 320px viewport; the
   choices still stack one per row there, which is what the layout wants. */
@media (max-width: 600px) {
    .gform_wrapper .gfield_radio {
        gap: 8px !important;
    }

    .gform_wrapper .gfield_radio .gchoice {
        padding: 10px 16px;
        gap: 8px !important;
    }

    .gform_wrapper .gfield_radio .gchoice input[type='radio'] {
        width: 18px;
        height: 18px;
    }

    .gform_wrapper .gfield_radio .gchoice label {
        font-size: 14px;
    }
}

label.gfield_label.gform-field-label {
    flex-wrap: nowrap !important;
}

p.gform_required_legend {
    display: none !important;
}

/* ── Inline subscribe form ──────────────────────────────────────────────────

   The one-line "Enter your email → Subscribe" bar: a pill-shaped field with a
   transparent fill sitting on the same row as the button.

   Matched structurally rather than by form id, so any Gravity Form whose only
   field is an email address gets the inline treatment and a second one needs no
   new CSS. A form with more fields — the full subscription form above — keeps
   the stacked layout.

   Both the border and the placeholder derive from the inherited text colour, so
   the bar reads correctly on a dark section (white on black, as drawn) and on a
   light one without being told which it is on. `--core-theme-subscribe-border`
   overrides the border alone where a section wants it stronger or softer. */

.gform_wrapper:has(.gform_fields > .gfield--type-email:only-child) {
    /* Gravity Forms derives control height and radius from these, so the field
       is sized through its own API rather than by overriding it afterwards. */
    --gf-ctrl-size: 52px;
    --gf-ctrl-size-md: 52px;
    --gf-ctrl-line-height: 52px;
    --gf-ctrl-radius: 100px;
    --gf-ctrl-padding-x: 20px;
}

.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) {
    display: flex;
    align-items: stretch;
    gap: 12px;

    /* Only ever relevant when Gravity Forms prepends a validation summary,
       which then takes a row of its own rather than squeezing the bar. */
    flex-wrap: wrap;
}

.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) .gform_validation_errors {
    flex: 0 0 100%;
}

/* The field takes the free space; 260px is the narrowest it stays usable at,
   below which the button drops to its own line. */
.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) .gform-body {
    flex: 1 1 260px;
    margin: 0;
}

.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) .gform-footer {
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 !important;
}

.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) input[type='email'] {
    height: 52px;
    border-radius: 100px !important;
    color: #fff !important;

    /* Both answer !important rules on every field earlier in this file. */
    background-color: transparent !important;
    border: 1px solid var(--core-theme-subscribe-border, #fff) !important;
}

.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) input[type='email']::placeholder {
    color: inherit !important;
    opacity: 0.7;
}

.gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) input[type='email']:focus {
    border-color: currentColor !important;
}

/* Too narrow for the two to share a row: the button goes full width beneath
   the field rather than shrinking to a stub. */
@media (max-width: 600px) {
    .gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) {
        flex-direction: column;
    }

    .gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) .gform_button.button {
        width: 100% !important;
    }

    .gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) .gform-body {
        flex: auto !important;
    }
    .gform_wrapper form:has(.gform_fields > .gfield--type-email:only-child) .gform-footer {
        gap: 0 !important;
        line-height: 0 !important;
    }
}
