.site-header {
    position: relative;
}

.site-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #d7e0eb;
}

.site-navigation a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 13px;
    border: 1px solid #9dacbf;
    border-radius: 4px;
    background: #f7f9fc;
    color: #244f78;
    font-weight: 700;
    text-decoration: none;
}

.site-navigation a:hover {
    border-color: #2d5f91;
    background: #eaf1f9;
}

.site-navigation a[aria-current="page"] {
    border-color: #2d5f91;
    background: #2d5f91;
    color: #ffffff;
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #d7e0eb;
}

.site-footer nav a {
    color: #244f78;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.site-footer nav a:hover {
    text-decoration-thickness: 2px;
}

nav.page-controls.page-controls-secondary {
    display: none;
}

/* Unicodeの飛行機記号を非表示にし、端末依存しない単色SVGとして描画する */
.route-plane {
    width: 2rem;
    height: 2rem;
    font-size: 0;
    text-shadow: none;
}

.route-plane::before {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9L2 14v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5L21 16z%22/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22%3E%3Cpath d=%22M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9L2 14v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5L21 16z%22/%3E%3C/svg%3E") center / contain no-repeat;
    transform: rotate(90deg);
    transform-origin: center;
}

/* フライトストリップを参考にした便情報の強調 */
.direction-panel tbody tr {
    position: relative;
}

.direction-panel tbody td:first-child {
    position: relative;
    border-left-width: 5px;
    border-left-color: #7d9a90;
    box-shadow: inset 0 0 0 2px rgb(45 77 69 / 10%);
    letter-spacing: 0.025em;
}

.direction-panel tbody tr:has(.note-ref) td:first-child {
    border-left-color: #a83c4c;
    background: #f3ddd9;
    box-shadow: inset 0 0 0 2px rgb(145 44 58 / 12%);
}

.direction-panel tbody tr:has(.note-ref) td:first-child::after {
    content: "NOTE";
    position: absolute;
    top: 2px;
    right: 3px;
    padding: 1px 2px;
    border: 1px solid #a83c4c;
    background: #fff8f7;
    color: #8f2435;
    font-family: Arial, sans-serif;
    font-size: 0.4rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    line-height: 1;
}

.direction-panel tbody tr:last-child:not(:has(.empty)) td {
    background-color: #e8f0fa;
}

.direction-panel tbody tr:last-child:not(:has(.empty)) td:first-child {
    border-left-color: #4f78aa;
    background-color: #dbe9f8;
    box-shadow: inset 0 0 0 2px rgb(63 102 150 / 14%);
}

.direction-panel tbody tr:last-child:not(:has(.empty)):has(.note-ref) td:first-child {
    border-left-color: #a83c4c;
    background-color: #eadfe8;
}

.direction-panel td.time::before {
    display: block;
    margin-bottom: 2px;
    color: #607086;
    font-family: Arial, sans-serif;
    font-size: 0.48rem;
    font-weight: 900;
    letter-spacing: 0.14em;
    line-height: 1;
}

.direction-panel tbody td:nth-child(4).time::before {
    content: "DEP";
}

.direction-panel tbody td:nth-child(5).time::before {
    content: "ARR";
}

.direction-panel tbody tr:hover td {
    background-image: linear-gradient(rgb(109 137 169 / 6%), rgb(109 137 169 / 6%));
}

@media (max-width: 700px) {
    .site-navigation {
        display: grid;
        grid-template-columns: auto auto minmax(0, 1fr);
        gap: 4px;
        margin-top: 12px;
        padding-top: 10px;
    }

    .site-navigation:has(a[href="/connections.php"]) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .site-navigation a {
        justify-content: center;
        min-height: 32px;
        padding: 5px 7px;
        font-size: 0.78rem;
        line-height: 1.2;
        text-align: center;
        white-space: nowrap;
    }

    .site-navigation:has(a[href="/connections.php"]) a {
        padding-inline: 4px;
        font-size: 0.72rem;
        white-space: normal;
    }

    .page-controls-primary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-controls-primary .page-control-secondary {
        display: none;
    }

    nav.page-controls.page-controls-secondary {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        justify-content: stretch;
        margin-top: 10px;
    }

    .page-controls-secondary a,
    .page-controls-secondary button {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 0.86rem;
    }

    .page-controls-secondary button {
        min-width: 72px;
    }

    .route-plane {
        width: 1.6rem;
        height: 1.6rem;
    }

    .direction-panel tbody tr:has(.note-ref) td:first-child::after {
        display: none;
    }
}

@media print {
    .site-navigation,
    .site-footer nav,
    nav.page-controls.page-controls-secondary {
        display: none !important;
    }

    .direction-panel tbody tr:hover td {
        background-image: none;
    }
}
