/* ==========================================================================
   yfamily design system
   Neutral, quiet, refined. One ink colour, hairline borders, soft depth.
   ========================================================================== */

:root {
    color-scheme: light dark;

    /* Palette — text >= 4.5:1, form-field edges >= 3:1 (WCAG 2.2 AA).
       Card edges stay hairline: they are decoration, the label identifies the control. */
    --page: #f7f7f5;
    --surface: #ffffff;
    --surface-soft: #f2f2ef;
    --surface-hover: #fcfcfb;
    --surface-active: #eeeeeb;
    --text: #18181b;            /* 16.5:1 */
    --text-soft: #3f3f46;       /*  9.7:1 */
    --muted: #62626a;           /*  5.6:1 */
    --subtle: #8a8a91;          /*  3.4:1 – chevrons, dots */
    --accent: #18181b;
    --accent-hover: #3f3f46;
    --accent-soft: #f2f2ef;
    --on-accent: #ffffff;
    --signal: #c2410c;
    --ok: #15803d;
    --live: #16a34a;            /*  3.3:1 – status dot */
    --border: rgb(24 24 27 / 8%);
    --border-strong: rgb(24 24 27 / 16%);
    --border-input: #8a8a90;    /*  3.4:1 – form fields */
    --focus: #18181b;
    --ring: 0 0 0 4px rgb(24 24 27 / 7%);
    --glass: rgb(247 247 245 / 84%);
    --highlight: 0 0 #0000;

    /* Depth */
    --shadow-sm: 0 1px 2px rgb(24 24 27 / 4%);
    --shadow-md: 0 1px 2px rgb(24 24 27 / 4%), 0 10px 24px -12px rgb(24 24 27 / 14%);
    --shadow-popover: 0 1px 2px rgb(24 24 27 / 6%), 0 18px 40px -12px rgb(24 24 27 / 22%);

    /* Shape & rhythm */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --content: 1080px;
    --prose: 720px;
    --bar-h: 56px;
    --pad-top: 40px;
    --pad-x: 32px;
    --ease: cubic-bezier(.2, .7, .2, 1);

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        /* Cards sit clearly above the page; edges and hover are visible, still quiet */
        --page: #08080a;
        --surface: #19191c;         /* 1.14:1 vs page */
        --surface-soft: #202024;
        --surface-hover: #222226;
        --surface-active: #2b2b30;
        --text: #f4f4f5;            /* 16.1:1 on card */
        --text-soft: #d4d4d8;       /* 12.0:1 */
        --muted: #a1a1aa;           /*  6.8:1 */
        --subtle: #7c7c85;          /*  4.2:1 */
        --accent: #f4f4f5;
        --accent-hover: #ffffff;
        --accent-soft: #202024;
        --on-accent: #08080a;
        --signal: #fb923c;
        --ok: #4ade80;
        --live: #4ade80;
        --border: #3a3a41;          /*  1.55:1 vs card, 1.77:1 vs page */
        --border-strong: #56565f;   /*  2.4:1 – hover */
        --border-input: #71717a;    /*  3.6:1 – form fields */
        --focus: #f4f4f5;
        --ring: 0 0 0 4px rgb(255 255 255 / 10%);
        --glass: rgb(8 8 10 / 84%);
        --highlight: inset 0 1px 0 rgb(255 255 255 / 5%);
        --shadow-sm: inset 0 1px 0 rgb(255 255 255 / 5%), 0 1px 2px rgb(0 0 0 / 50%);
        --shadow-md: inset 0 1px 0 rgb(255 255 255 / 7%), 0 1px 2px rgb(0 0 0 / 50%), 0 16px 32px -14px rgb(0 0 0 / 80%);
        --shadow-popover: inset 0 1px 0 rgb(255 255 255 / 7%), 0 1px 2px rgb(0 0 0 / 60%), 0 24px 48px -12px rgb(0 0 0 / 85%);
    }
}

/* Users who ask for more contrast get crisper lines and darker secondary text */
@media (prefers-contrast: more) {
    :root {
        --muted: var(--text-soft);
        --subtle: var(--muted);
        --border: var(--border-input);
        --border-strong: var(--text-soft);
    }
}

/* Base ---------------------------------------------------------------- */

html {
    background: var(--page);
    color: var(--text);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: clip;
    scroll-padding-top: calc(var(--bar-h) + 16px);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
    accent-color: var(--accent);
}

body {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--content);
    margin: 0 auto;
    padding: var(--pad-top) var(--pad-x) 56px;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6, p {
    margin-top: 0;
}

h1, h2, h3, h4, h5 {
    color: var(--text);
    font-weight: 600;
    line-height: 1.35;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(26px, 3.6vw, 32px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

h1, h2, h3 {
    text-wrap: balance;
}

p, li {
    text-wrap: pretty;
}

h2 {
    margin-bottom: 16px;
    font-size: 22px;
    letter-spacing: -0.02em;
}

h3 {
    margin-bottom: 12px;
    font-size: 18px;
    letter-spacing: -0.015em;
}

h4, h5 {
    margin-bottom: 8px;
    font-size: 16px;
}

p {
    margin-bottom: 16px;
}

a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    transition: color 160ms var(--ease), text-decoration-color 160ms var(--ease);
}

a:hover {
    color: var(--text);
    text-decoration-color: currentColor;
}

button, input, select, textarea {
    box-sizing: border-box;
    font: inherit;
    color: inherit;
}

button, input[type="button"], select {
    cursor: pointer;
}

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

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

::selection {
    background: var(--text);
    color: var(--page);
}

img {
    max-width: 100%;
}

hr {
    border: 0;
}

/* Legacy <br> spacers: spacing now comes from the type scale */
:where(body, main) > br,
.content-container > br {
    display: none;
}

/* Ads: breathe only when something is actually rendered */
ins.adsbygoogle[data-ad-status="filled"] {
    margin-block: 24px;
}

/* Top bar --------------------------------------------------------------
   The breadcrumb list is shown as an iOS-style navigation bar: the parent
   page on the left as a back button, the current page title centred.
   Once the page scrolls, the bar turns to glass and the title fades in. */

@property --bar-bg {
    syntax: "<color>";
    inherits: false;
    initial-value: transparent;
}

@property --bar-line {
    syntax: "<color>";
    inherits: false;
    initial-value: transparent;
}

/* Full-bleed without widening the page: the glass and the hairline are
   painted outside the box (shadow / border-image outset), which never
   creates horizontal scroll. */
body > nav:has(> .breadcrumb) {
    --bar-bg: var(--glass);
    --bar-line: var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
    box-sizing: border-box;
    height: var(--bar-h);
    margin: calc(-1 * var(--pad-top)) 0 28px;
    border-bottom: 1px solid transparent;
    border-image: linear-gradient(var(--bar-line), var(--bar-line)) 0 0 1 0 / 0 0 1px 0 / 0 100vmax;
    background: var(--bar-bg);
    box-shadow: 0 0 0 100vmax var(--bar-bg);
    clip-path: inset(0 -100vmax);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    view-transition-name: topbar;
}

.breadcrumb {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
    line-height: 1.4;
}

.breadcrumb li {
    display: none;
    min-width: 0;
}

/* Back button: the parent page */
.breadcrumb li:nth-last-child(2) {
    display: flex;
    grid-column: 1;
    justify-self: start;
    min-width: 0;
}

.breadcrumb li:nth-last-child(2) a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-sizing: border-box;
    max-width: 100%;
    height: 36px;
    margin-left: -10px;
    padding: 0 12px 0 10px;
    overflow: hidden;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 450;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: background-color 160ms var(--ease), color 160ms var(--ease);
}

.breadcrumb li:nth-last-child(2) a::before {
    content: "";
    flex: 0 0 auto;
    width: 7px;
    height: 7px;
    margin: 0 1px 0 4px;
    border-bottom: 1.75px solid currentColor;
    border-left: 1.75px solid currentColor;
    transform: rotate(45deg);
    transition: transform 160ms var(--ease);
}

.breadcrumb li:nth-last-child(2) a:hover {
    background: var(--surface-active);
    color: var(--text);
}

.breadcrumb li:nth-last-child(2) a:hover::before {
    transform: translateX(-2px) rotate(45deg);
}

/* Title: the current page */
.breadcrumb li:last-child {
    display: block;
    grid-column: 2;
    max-width: min(56vw, 520px);
}

.breadcrumb li:last-child a {
    display: block;
    overflow: hidden;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: center;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
}

@supports (animation-timeline: scroll()) {
    body > nav:has(> .breadcrumb) {
        --bar-bg: transparent;
        --bar-line: transparent;
        animation: bar-raise linear both;
        animation-timeline: scroll(root);
        animation-range: 0 32px;
    }

    .breadcrumb li:last-child {
        opacity: 0;
        animation: bar-title linear both;
        animation-timeline: scroll(root);
        animation-range: 56px 128px;
    }
}

@keyframes bar-raise {
    from {
        --bar-bg: transparent;
        --bar-line: transparent;
    }
    to {
        --bar-bg: var(--glass);
        --bar-line: var(--border);
    }
}

@keyframes bar-title {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* Page-to-page: a short cross-fade, the bar stays put */
@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 180ms;
    animation-timing-function: cubic-bezier(.2, .7, .2, 1);
}

/* Page header --------------------------------------------------------- */

.page-header {
    margin-bottom: 28px;
}

.page-header > :last-child {
    margin-bottom: 0;
}

.page-header h1 img,
:where(body, main) > h1 img {
    flex: 0 0 auto;
    box-sizing: border-box;
    width: 44px;
    height: 44px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    object-fit: contain;
}

/* Any page title that carries an icon lays out the same way */
.page-header h1:has(> img) {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Line icons (SVG) sit on the same soft tile as the home cards */
.page-header h1 img[src$=".svg"],
:where(body, main) > h1 img[src$=".svg"] {
    padding: 9px;
    background: var(--surface-soft);
}

/* Official App Store icons fill their tile: no inner padding, iOS-like corners */
.page-header h1 img[src*="/IMG/app-"],
:where(body, main) > h1 img[src*="/IMG/app-"] {
    padding: 0;
    border-radius: 10px;
    object-fit: cover;
}

.page-description {
    max-width: var(--prose);
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

/* Section label: quiet, small, with a hairline -------------------------- */

.section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 48px 0 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.06em;
    line-height: 1.5;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.site-divider {
    height: 1px;
    margin: 28px 0;
    border: 0;
    background: var(--border);
}

/* "机场推荐" bell: replace the endless shake with a calm status dot */
span[style*="bellShake"] {
    flex: 0 0 auto;
    animation: none !important;
    width: 6px;
    height: 6px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--live);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--live) 20%, transparent);
    font-size: 0;
    line-height: 0;
    vertical-align: middle;
}

/* Pill links (机场推荐, 代理规则 …) — one component, fixed height, top-aligned.
   font-size: 0 on the row swallows the &nbsp; spacers between pills. */
.page-intro:has(a),
.home-notice,
.page-header .page-description:has(> a:only-child) {
    font-size: 0;
    line-height: 0;
}

:is(.page-intro, .home-notice) a,
.page-header .page-description > a:only-child {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    height: 30px;
    margin: 0 8px 8px 0;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 450;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: top;
    transition: border-color 160ms var(--ease), background-color 160ms var(--ease), color 160ms var(--ease);
}

:is(.page-intro, .home-notice) a:hover,
.page-header .page-description > a:only-child:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    color: var(--text);
}

/* Footer -------------------------------------------------------------- */

.site-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

.site-contact > a,
.site-contact > button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--highlight);
    cursor: pointer;
    transition: border-color 160ms var(--ease), background-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}

.site-contact > a:hover,
.site-contact > button:hover {
    border-color: var(--border-strong);
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.site-contact > a,
.site-contact > button {
    color: var(--muted);
}

.site-contact > a:hover,
.site-contact > button:hover {
    color: var(--text);
}

.contact-icon {
    display: block;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    transition: color 160ms var(--ease);
}

/* Responsive ---------------------------------------------------------- */

@media (max-width: 600px) {
    :root {
        --bar-h: 52px;
        --pad-top: 24px;
        --pad-x: 18px;
    }

    body {
        padding: var(--pad-top) var(--pad-x) 40px;
    }

    .breadcrumb li:last-child {
        max-width: 52vw;
    }

    .section-title {
        margin-top: 40px;
    }
}

/* Windows high-contrast / forced colours: keep every surface outlined */
@media (forced-colors: active) {
    .myButton,
    .app-card,
    .search-bar input,
    .site-contact > a,
    .site-contact > button {
        border: 1px solid CanvasText;
    }
}

@media (prefers-reduced-motion: reduce) {
    body > nav:has(> .breadcrumb) {
        --bar-bg: var(--glass);
        --bar-line: var(--border);
        animation: none;
    }

    .breadcrumb li:last-child {
        animation: none;
        opacity: 1;
    }

    @view-transition {
        navigation: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
