:root {
    color-scheme: light;
    --color-brand-blue: #536be8;
    --color-brand-purple: #6540a6;
    --color-brand-dark: #3f378c;
    --color-text: #23242a;
    --color-muted: #686a75;
    --color-surface: #ffffff;
    --color-surface-soft: #f3f4f9;
    --color-border: #dfe1ea;
    --color-available: #198754;
    --color-occupied: #d5443e;
    --color-pending: #c88312;
    --color-focus: #1839d7;
    --color-shadow: rgba(27, 24, 72, 0.22);
    --page-width: 1240px;
    --radius-small: 9px;
    --radius-medium: 15px;
    --radius-large: 22px;
    --transition: 160ms ease;
}

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

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--color-text);
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.13), transparent 24rem),
        linear-gradient(125deg, var(--color-brand-blue), var(--color-brand-purple));
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
textarea,
select {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

.booking-app {
    min-height: 100vh;
}

.site-header {
    width: min(calc(100% - 40px), var(--page-width));
    min-height: 82px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.22);
}

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

.site-brand__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 21px;
}

.site-brand__text {
    display: grid;
    line-height: 1.1;
}

.site-brand__text strong {
    font-size: 17px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.site-brand__text small {
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    font-weight: 650;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.site-nav a {
    padding: 10px 14px;
    border-radius: var(--radius-small);
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
    transition:
        color var(--transition),
        background var(--transition);
}

.site-nav a:first-child,
.site-nav a:hover {
    color: var(--color-brand-blue);
    background: #ffffff;
}

main {
    width: min(calc(100% - 40px), var(--page-width));
    margin: 0 auto;
    padding: 48px 0 54px;
}

.booking-intro {
    max-width: 670px;
    margin-bottom: 26px;
    color: #ffffff;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--color-brand-blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.booking-intro .eyebrow {
    color: rgba(255, 255, 255, 0.78);
}

.booking-intro h1 {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    font-weight: 900;
    letter-spacing: -0.035em;
    line-height: 1.04;
}

.booking-intro > p:last-child {
    max-width: 590px;
    margin: 14px 0 0;
    color: rgba(255, 255, 255, 0.83);
    font-size: 17px;
}

.booking-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: var(--radius-large);
    background: rgba(255, 255, 255, 0.13);
    box-shadow: 0 24px 70px var(--color-shadow);
    backdrop-filter: blur(8px);
}

.booking-map-column {
    min-width: 0;
    padding: 22px;
}

.date-filter {
    display: flex;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
}

.form-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.form-field > span {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 800;
}

.date-filter .form-field > span {
    color: #ffffff;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    outline: none;
    color: var(--color-text);
    background: #ffffff;
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

.date-filter input {
    width: 160px;
}

.form-field textarea {
    min-height: 92px;
    resize: vertical;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px rgba(83, 107, 232, 0.18);
}

.form-field input[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
    border-color: var(--color-occupied);
}

.button {
    min-height: 44px;
    padding: 10px 17px;
    border: 0;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-weight: 850;
    transition:
        transform var(--transition),
        filter var(--transition),
        opacity var(--transition);
}

.button:hover:not(:disabled) {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

.button:active:not(:disabled) {
    transform: translateY(0);
}

.button:focus-visible,
.berth-marker:focus-visible,
.dialog-close:focus-visible,
.site-nav a:focus-visible,
.site-brand:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: 3px;
}

.button:disabled {
    cursor: wait;
    opacity: 0.58;
}

.button--primary {
    color: #ffffff;
    background: linear-gradient(110deg, var(--color-brand-blue), var(--color-brand-purple));
    box-shadow: 0 8px 20px rgba(83, 80, 190, 0.24);
}

.button--secondary {
    border: 1px solid var(--color-border);
    color: var(--color-brand-dark);
    background: #ffffff;
}

.button--full {
    width: 100%;
}

.availability-summary {
    margin: 0 0 0 auto;
    align-self: center;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

.harbour-map {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--radius-medium);
    background: #8eb0bd;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.harbour-map::after {
    position: absolute;
    inset: 0;
    z-index: 1;
    content: "";
    pointer-events: none;
    background: linear-gradient(180deg, transparent 65%, rgba(20, 26, 50, 0.14));
}

.harbour-layout {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.12), transparent 28%),
        linear-gradient(150deg, #b8dce5, #72adbd);
}

.harbour-layout__shore {
    position: absolute;
    top: -10%;
    bottom: -10%;
    left: -5%;
    width: 24%;
    transform: rotate(2deg);
    background:
        radial-gradient(circle at 85% 30%, rgba(255, 255, 255, 0.35) 0 2px, transparent 3px),
        #cbd0c2;
    background-size: 17px 17px;
    box-shadow: inset -9px 0 20px rgba(0, 0, 0, 0.18);
}

.harbour-layout__gate {
    position: absolute;
    left: 20%;
    z-index: 2;
    transform: translateX(-50%);
    padding: 6px 10px;
    border-radius: 7px;
    color: #ffffff;
    background: #4f5d85;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.27);
    font-size: 11px;
    font-weight: 850;
}

.harbour-layout__gate--1 {
    top: 12%;
}

.harbour-layout__gate--2 {
    top: 40%;
}

.harbour-layout__gate--3 {
    top: 68%;
}

.harbour-layout__pier {
    position: absolute;
    left: 21%;
    height: 16px;
    border: 1px solid #817861;
    border-radius: 2px;
    background: #e7e0ce;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
    z-index: 1;
}

.harbour-layout__pier::before {
    position: absolute;
    top: 3px;
    left: -34px;
    width: 39px;
    height: 8px;
    border: inherit;
    background: inherit;
    content: "";
}

.harbour-layout__finger {
    position: absolute;
    top: -39px;
    width: 15px;
    height: 94px;
    z-index: 0;
    display: block;
    transform: translateX(-50%);
    border: 1px solid #d7d0bd;
    background: #e7e0ce;
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.25));
}

.harbour-layout__finger--1 {
    left: var(--finger-1);
}

.harbour-layout__finger--2 {
    left: var(--finger-2);
}

.harbour-layout__finger--3 {
    left: var(--finger-3);
}

.harbour-layout__finger--4 {
    left: var(--finger-4);
}

.harbour-layout__pier--1 {
    --finger-1: 13.6%;
    --finger-2: 33.3%;
    --finger-3: 53%;
    --finger-4: 72.6%;
    top: 21%;
    width: 61%;
}

.harbour-layout__pier--2 {
    --finger-1: 16%;
    --finger-2: 39%;
    --finger-3: 62.1%;
    --finger-4: 85.2%;
    top: 49%;
    width: 52%;
}

.harbour-layout__pier--3 {
    --finger-1: 17.3%;
    --finger-2: 42.3%;
    --finger-3: 67.3%;
    --finger-4: 92.3%;
    top: 77%;
    width: 48%;
}

.harbour-layout__cross-pier {
    position: absolute;
    top: 21%;
    left: calc(21% + 61% - 8px);
    width: 15px;
    height: 19%;
    border: 1px solid #817861;
    border-radius: 2px;
    background: #e7e0ce;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
    z-index: 2;
}

.harbour-map__berths {
    position: absolute;
    inset: 0;
    z-index: 3;
}

.berth-marker {
    position: absolute;
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    transform: translate(-50%, -50%);
    border: 3px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    color: #ffffff;
    background: var(--color-available);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    transition:
        width var(--transition),
        height var(--transition),
        transform var(--transition),
        filter var(--transition);
}

.berth-marker:hover:not(:disabled) {
    transform: translate(-50%, -50%) scale(1.13);
    filter: brightness(1.08);
}

.berth-marker--occupied {
    cursor: not-allowed;
    background: var(--color-occupied);
}

.berth-marker--pending {
    cursor: not-allowed;
    background: var(--color-pending);
}

.berth-marker--selected {
    width: 38px;
    height: 38px;
    z-index: 2;
    color: var(--color-brand-dark);
    background: #ffffff;
    border-color: var(--color-brand-dark);
    box-shadow:
        0 0 0 4px rgba(255, 255, 255, 0.7),
        0 5px 14px rgba(0, 0, 0, 0.38);
    font-size: 12px;
}

.map-legend {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    color: var(--color-text);
    font-size: 11px;
    font-weight: 800;
}

.map-legend span {
    display: inline-flex;
    align-items: center;
}

.status-dot {
    width: 10px;
    height: 10px;
    margin-right: 6px;
    display: inline-block;
    border-radius: 50%;
}

.status-dot--available {
    background: var(--color-available);
}

.status-dot--occupied {
    background: var(--color-occupied);
}

.status-dot--pending {
    background: var(--color-pending);
}

.status-dot--selected {
    border: 2px solid var(--color-brand-dark);
    background: #ffffff;
}

.map-help {
    margin: 11px 2px 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
}

.berth-details {
    min-height: 100%;
    padding: 28px;
    border-left: 1px solid rgba(255, 255, 255, 0.52);
    background: var(--color-surface);
}

.berth-details h2 {
    margin: 6px 0 10px;
    font-size: 29px;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.berth-details__empty > p:last-child {
    color: var(--color-muted);
    font-size: 14px;
}

.berth-status {
    margin: 0;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.berth-status--available {
    color: var(--color-available);
}

.berth-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 24px 0;
}

.berth-facts > div {
    min-width: 0;
    padding: 12px;
    border-radius: var(--radius-small);
    background: var(--color-surface-soft);
}

.berth-facts dt {
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 750;
}

.berth-facts dd {
    margin: 4px 0 0;
    overflow-wrap: anywhere;
    font-size: 15px;
    font-weight: 850;
}

.site-footer {
    width: min(calc(100% - 40px), var(--page-width));
    margin: 0 auto;
    padding: 28px 0 42px;
    border-top: 1px solid rgba(255, 255, 255, 0.19);
    color: rgba(255, 255, 255, 0.73);
    text-align: center;
    font-size: 12px;
}

.site-footer p {
    margin: 3px 0;
}

.site-footer a {
    color: #ffffff;
}

dialog {
    width: min(calc(100% - 28px), 720px);
    max-height: calc(100vh - 36px);
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: var(--radius-large);
    color: var(--color-text);
    background: var(--color-surface);
    box-shadow: 0 30px 100px rgba(19, 13, 54, 0.48);
}

dialog::backdrop {
    background: rgba(24, 20, 52, 0.72);
    backdrop-filter: blur(5px);
}

.booking-dialog {
    padding: 28px;
}

.dialog-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 20px;
}

.dialog-header h2 {
    margin: 5px 0 0;
    font-size: 28px;
    line-height: 1.1;
}

.dialog-close {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-muted);
    background: var(--color-surface-soft);
    font-size: 27px;
    line-height: 1;
}

.dialog-intro {
    margin: 13px 0 24px;
    color: var(--color-muted);
    font-size: 14px;
}

.booking-form {
    display: grid;
    gap: 22px;
}

.booking-form fieldset {
    min-width: 0;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-medium);
}

.booking-form legend {
    padding: 0 8px;
    font-size: 14px;
    font-weight: 900;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-field--wide {
    grid-column: 1 / -1;
}

.field-error {
    min-height: 0;
    color: var(--color-occupied);
    font-size: 11px;
    font-weight: 700;
}

.field-error:empty {
    display: none;
}

.terms-field {
    display: flex;
    align-items: start;
    gap: 10px;
    color: var(--color-muted);
    font-size: 13px;
}

.terms-field input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin: 2px 0 0;
    accent-color: var(--color-brand-blue);
}

.form-message {
    min-height: 0;
    color: var(--color-occupied);
    font-size: 13px;
    font-weight: 750;
}

.form-message:empty {
    display: none;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.success-dialog {
    width: min(calc(100% - 28px), 450px);
    padding: 34px;
    text-align: center;
}

.success-dialog__icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #ffffff;
    background: var(--color-available);
    font-size: 30px;
    font-weight: 900;
}

.success-dialog h2 {
    margin: 0;
    font-size: 26px;
}

.success-dialog p {
    color: var(--color-muted);
}

.booking-reference {
    padding: 11px;
    border-radius: var(--radius-small);
    background: var(--color-surface-soft);
}

.global-message,
.noscript-message {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    max-width: 390px;
    padding: 13px 16px;
    border-radius: var(--radius-small);
    color: #ffffff;
    background: var(--color-occupied);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    font-size: 13px;
    font-weight: 750;
}

.global-message:empty {
    display: none;
}

@media (max-width: 900px) {
    .booking-workspace {
        grid-template-columns: 1fr;
    }

    .berth-details {
        min-height: auto;
        border-top: 1px solid var(--color-border);
        border-left: 0;
    }

    .date-filter {
        flex-wrap: wrap;
    }

    .availability-summary {
        width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 680px) {
    .site-header,
    main,
    .site-footer {
        width: min(calc(100% - 24px), var(--page-width));
    }

    .site-header {
        min-height: 70px;
    }

    .site-brand__text strong {
        font-size: 14px;
    }

    .site-nav a:first-child {
        display: none;
    }

    .site-nav a {
        padding: 8px 10px;
        border: 1px solid rgba(255, 255, 255, 0.28);
        color: #ffffff;
        background: rgba(255, 255, 255, 0.1);
        font-size: 12px;
    }

    main {
        padding: 32px 0 38px;
    }

    .booking-intro > p:last-child {
        font-size: 15px;
    }

    .booking-map-column,
    .berth-details {
        padding: 14px;
    }

    .date-filter {
        align-items: stretch;
    }

    .date-filter .form-field {
        width: calc(50% - 6px);
    }

    .date-filter input {
        width: 100%;
    }

    .date-filter .button {
        width: 100%;
    }

    .berth-marker {
        width: 27px;
        height: 27px;
        border-width: 2px;
        font-size: 9px;
    }

    .berth-marker--selected {
        width: 34px;
        height: 34px;
    }

    .map-legend {
        right: 10px;
        bottom: 10px;
        left: 10px;
        gap: 8px;
        justify-content: center;
    }

    .booking-dialog,
    .success-dialog {
        padding: 20px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-field--wide {
        grid-column: auto;
    }

    .dialog-actions {
        flex-direction: column-reverse;
    }

    .dialog-actions .button {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .site-brand__text small {
        display: none;
    }

    .site-nav a {
        font-size: 11px;
    }

    .date-filter .form-field {
        width: 100%;
    }

    .berth-facts {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
