* {
    box-sizing: border-box;
}

:root {
    --navy-900: #071426;
    --navy-800: #0d2340;
    --navy-700: #173a63;
    --navy-600: #245487;

    --blue-300: #9db9d6;
    --blue-200: #c8d9e8;
    --blue-100: #dce8f3;
    --ice: #f4f8fc;

    --text-main: #102033;
    --text-muted: #60738a;

    --white: #ffffff;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;

    background:
        linear-gradient(
            180deg,
            var(--navy-900) 0%,
            var(--navy-800) 38%,
            var(--ice) 38%,
            var(--ice) 100%
        );

    color: var(--text-main);
}

main {
    width: min(1120px, 92%);
    margin: 0 auto;
    padding: 54px 0 90px;
}

/* Header */

.hero {
    padding: 6px 0 30px;

    text-align: left;
}

.wordmark {
    margin: 0;

    color: var(--white);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 38px;
    font-style: normal;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.1;
}

.tagline {
    margin: 8px 0 0;

    color: var(--blue-200);

    font-family: Arial, Helvetica, sans-serif;
    font-size: 18px;
    font-style: normal;
    line-height: 1.4;
}

/* Search box */

.search-panel {
    background: rgba(255, 255, 255, 0.98);

    padding: 22px;
    border-radius: 16px;

    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 16px;

    box-shadow:
        0 18px 45px rgba(2, 12, 28, 0.28);

    margin-bottom: 24px;
}

label {
    color: var(--navy-700);
    font-size: 13px;
    font-weight: bold;
}

input {
    height: 48px;

    border: 1px solid #cbd8e6;
    border-radius: 9px;

    padding: 0 14px;

    color: var(--text-main);
    background: #fbfdff;

    font-size: 16px;
    outline: none;
}

input:focus {
    border-color: var(--navy-600);

    box-shadow:
        0 0 0 3px rgba(36, 84, 135, 0.10);
}

#origin {
    flex: 1;
    min-width: 180px;
}

.search-status {
    flex: 0 0 100%;

    margin: 0;

    color: var(--navy-600);

    font-size: 14px;
    line-height: 1.45;
}

.search-status.is-error {
    color: #9b2f3f;
}

button {
    height: 48px;

    border: none;
    border-radius: 9px;

    padding: 0 24px;

    background: var(--navy-700);
    color: var(--white);

    font-size: 15px;
    font-weight: bold;

    cursor: pointer;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

button:hover {
    background: var(--navy-600);
    transform: translateY(-1px);
}

button:disabled,
button:disabled:hover {
    background: var(--navy-700);

    cursor: not-allowed;
    opacity: 0.58;
    transform: none;
}

input:disabled,
select:disabled {
    color: var(--text-muted);
    background: var(--blue-100);

    cursor: not-allowed;
    opacity: 0.78;
}

/* Destination controls */

.destination-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

/* Transport mode filter */

.mode-filter {
    display: inline-flex;
    gap: 4px;

    padding: 4px;

    background: rgba(255, 255, 255, 0.92);

    border: 1px solid rgba(23, 58, 99, 0.12);
    border-radius: 12px;

    box-shadow:
        0 8px 20px rgba(5, 20, 40, 0.08);
}

.mode-filter-button {
    width: auto;
    height: 38px;

    padding: 0 18px;

    background: transparent;
    color: var(--navy-700);

    border-radius: 9px;

    font-size: 14px;

    transform: none;
}

.mode-filter-button:hover {
    background: var(--blue-100);
    color: var(--navy-800);

    transform: none;
}

.mode-filter-button.is-active,
.mode-filter-button.is-active:hover {
    background: var(--navy-700);
    color: var(--white);
}

.mode-filter-button:disabled,
.mode-filter-button:disabled:hover {
    background: var(--blue-100);
    color: var(--navy-700);
    opacity: 0.78;
}

.mode-filter-button.is-active:disabled,
.mode-filter-button.is-active:disabled:hover {
    background: var(--navy-700);
    color: var(--white);
}

.mode-filter-button:focus-visible {
    outline: 3px solid rgba(157, 185, 214, 0.65);
    outline-offset: 2px;
}

/* Destination sort */

.sort-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-width: 0;
    padding: 4px 6px 4px 12px;

    background: rgba(255, 255, 255, 0.92);

    border: 1px solid rgba(23, 58, 99, 0.12);
    border-radius: 12px;

    box-shadow:
        0 8px 20px rgba(5, 20, 40, 0.08);
}

.sort-control label {
    flex: 0 0 auto;

    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.sort-control select {
    min-width: 150px;
    height: 38px;

    padding: 0 32px 0 10px;

    background: #fbfdff;
    color: var(--navy-700);

    border: 1px solid #cbd8e6;
    border-radius: 8px;

    font: inherit;
    font-size: 14px;
    outline: none;
}

.sort-control select:focus-visible {
    border-color: var(--navy-600);

    box-shadow:
        0 0 0 3px rgba(36, 84, 135, 0.12);
}

/* Results */

#results h2 {
    color: var(--navy-900);
    font-size: 29px;

    margin-bottom: 6px;
}

#destination-count {
    margin-top: 0;
    margin-bottom: 28px;

    color: var(--text-muted);
}

#destination-list {
    display: grid;

    grid-template-columns:
        repeat(auto-fill, minmax(235px, 1fr));

    gap: 18px;
}

/* Destination cards */

.destination-card {
    min-height: 180px;

    padding: 22px;

    background: var(--white);

    border:
        1px solid rgba(23, 58, 99, 0.12);

    border-radius: 14px;

    box-shadow:
        0 4px 14px rgba(13, 35, 64, 0.05);

    cursor: default;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.destination-card.is-map-target {
    cursor: pointer;
}

.destination-card.is-map-target:hover {
    transform: translateY(-2px);

    border-color:
        rgba(23, 58, 99, 0.28);

    box-shadow:
        0 14px 30px rgba(13, 35, 64, 0.12);
}

.destination-card h3 {
    margin: 0 0 5px;

    color: var(--navy-800);
    font-size: 21px;
}

.destination-card p {
    margin: 10px 0;

    color: var(--text-muted);
    font-size: 14px;
}

.destination-card strong {
    color: var(--navy-700);
    font-size: 20px;
}

.destination-timing {
    margin-top: 18px;
}

.destination-timing p {
    margin: 4px 0;
}

.destination-journey-times {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.destination-timing-detail,
.destination-counts {
    color: var(--text-muted);
}

.destination-counts {
    margin-top: 14px;
}

/* Expandable city header */

.destination-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.destination-details-toggle {
    flex: 0 0 auto;

    width: 30px;
    height: 30px;

    padding: 0;

    background: transparent;
    color: var(--navy-600);

    border: 1px solid transparent;
    border-radius: 8px;

    font-size: 20px;
    font-weight: normal;
    line-height: 1;

    transform: none;
}

.destination-details-toggle:hover {
    background: var(--blue-100);
    color: var(--navy-700);

    transform: none;
}

.destination-details-toggle:focus-visible {
    outline: 3px solid rgba(36, 84, 135, 0.22);
    outline-offset: 2px;
}

.destination-card.expanded {
    grid-column: span 2;
    min-height: auto;

    border-color:
        rgba(23, 58, 99, 0.3);
}

.destination-card.is-selected {
    border-color: rgba(36, 84, 135, 0.62);

    box-shadow:
        0 0 0 3px rgba(36, 84, 135, 0.12),
        0 12px 26px rgba(13, 35, 64, 0.1);
}

.destination-details {
    margin-top: 20px;
}

.details-divider {
    margin-bottom: 20px;

    border-top:
        1px solid var(--blue-100);
}

/* Services */

.service-block {
    padding: 16px 0;
}

.service-block + .service-block {
    border-top:
        1px solid #e5edf5;
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 4px;
}

.service-header strong {
    color: var(--navy-800);
    font-size: 18px;
}

.service-meta {
    margin: 0 0 12px !important;

    color: var(--navy-600) !important;
}

.service-header span {
    padding: 5px 8px;

    border-radius: 6px;

    background: var(--blue-100);
    color: var(--navy-700);

    font-size: 11px;
    font-weight: bold;
}

.departure-info {
    display: flex;
    gap: 8px;

    margin-bottom: 12px;

    color: var(--text-muted);
    font-size: 14px;
}

.departure-info span:first-child {
    color: var(--navy-800);
    font-weight: bold;
}

.route-line {
    width: 2px;
    height: 14px;

    margin-left: 19px;

    background: var(--blue-300);
}

.arrival-stop {
    display: grid;
    grid-template-columns: 55px 1fr;
    gap: 10px;

    padding: 5px 0;

    font-size: 14px;
}

.arrival-time {
    color: var(--navy-800);
    font-weight: bold;
}

.station-name {
    color: var(--text-muted);
}

/* Mobile */

@media (max-width: 700px) {

    main {
        padding-top: 34px;
    }

    .hero {
        padding-top: 0;
        padding-bottom: 24px;
    }

    .wordmark {
        font-size: 30px;
    }

    .tagline {
        margin-top: 8px;
        font-size: 16px;
    }

    .search-panel {
        flex-direction: column;
        align-items: stretch;

        margin-bottom: 24px;
    }

    .search-status {
        width: 100%;
    }

    input,
    button {
        width: 100%;
    }

    .mode-filter {
        display: flex;
        width: 100%;
    }

    .mode-filter-button {
        flex: 1;
        width: auto;
    }

    .destination-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .sort-control {
        width: 100%;
        box-sizing: border-box;
    }

    .sort-control select {
        flex: 1;
        min-width: 0;
        width: 100%;
    }

    #destination-list {
        grid-template-columns: 1fr;
    }

    .destination-card.expanded {
        grid-column: span 1;
    }
}

/* Nightways — subtle night-rail atmosphere */

body {
  background:
    radial-gradient(
      ellipse at 72% 8%,
      rgba(90, 150, 220, 0.12) 0%,
      rgba(35, 75, 130, 0.05) 28%,
      transparent 55%
    ),
    linear-gradient(
      180deg,
      #071426 0%,
      #0b1c33 260px,
      #eef4fa 560px
    );
}

/* Nightways map */

#map {
  width: 100%;
  height: 440px;

  margin: 28px 0 36px;

  border-radius: 20px;
  overflow: hidden;

  box-shadow:
    0 16px 40px rgba(5, 20, 40, 0.12);
}

/* Nightways origin pin */

.origin-pin {
    width: 22px;
    height: 22px;

    background: #d94a5a;

    border: 2px solid #a72f3d;

    border-radius:
        50% 50% 50% 0;

    transform: rotate(-45deg);

    box-shadow:
        0 3px 8px rgba(100, 20, 35, 0.28);

    position: relative;
}


.origin-pin-center {
    width: 7px;
    height: 7px;

    background: #ffffff;

    border-radius: 50%;

    position: absolute;

    top: 50%;
    left: 50%;

    transform:
        translate(-50%, -50%);
}
