/* Shared professional layer for the homepage and tutor surfaces.
   Loaded last. Does not change ids, handlers, or data calls. */

:root {
    --sys-ink: #1c2b2e;
    --sys-muted: #5c6d71;
    --sys-line: rgba(28, 43, 46, .12);
    --sys-paper: #f6f5f2;
    --sys-accent: #1f6f64;
    --sys-radius: 12px;
    --sys-shadow: 0 1px 2px rgba(28, 43, 46, .05);
    --sys-width: min(1120px, calc(100% - 48px));
}

body {
    color: var(--sys-ink);
    background: var(--sys-paper);
}

h1, h2, h3 {
    font-family: "Noto Serif HK", "Noto Serif TC", "PingFang TC", serif;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--sys-ink);
}

.nihao-senior-badge {
    background: #f3f1ea !important;
    color: var(--sys-ink) !important;
    border: 1px solid var(--sys-line);
    font-weight: 700 !important;
}

.tutor-mark,
.teacher-profile-mark,
.results .mark,
.profile-hero .mark,
.match-result .tutor-mark {
    position: relative;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    overflow: hidden;
    border-radius: 50%;
    background: #24383c;
    color: #fff;
    font-family: "Noto Serif HK", serif;
    font-size: 1.15rem;
    font-weight: 600;
}

.tutor-mark img,
.results .mark img,
.profile-hero .mark img,
.match-result .tutor-mark img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Homepage frame ---------- */
.site-header {
    background: rgba(255, 255, 255, .94) !important;
    border-bottom: 1px solid var(--sys-line) !important;
    box-shadow: none !important;
}

.nav {
    width: var(--sys-width) !important;
    gap: 18px !important;
}

.nav-links a {
    font-weight: 600;
    font-size: .84rem;
    padding: 6px 10px;
}

.nav-socials { gap: 2px; }

.nav-socials .social-link,
.nav-mobile-socials .social-link {
    min-width: 22px !important;
    height: 22px !important;
    padding: 0 5px !important;
    border-color: transparent !important;
    background: transparent !important;
    color: #8aa0a4 !important;
    font-size: .62rem !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.nav-socials .social-link:hover,
.nav-mobile-socials .social-link:hover {
    background: transparent !important;
    color: var(--sys-ink) !important;
    transform: none;
}

.hero:not(.profile-hero) {
    width: var(--sys-width) !important;
    min-height: 0 !important;
    margin: 36px auto 0 !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1.08fr) minmax(280px, .92fr) !important;
    align-items: stretch !important;
    gap: 64px !important;
    background: transparent !important;
}

.hero-copy {
    padding: 8px 0 12px !important;
}

.hero-copy h1,
.hero h1 {
    max-width: 11em !important;
    margin-bottom: 16px !important;
    font-size: clamp(2rem, 3vw, 2.65rem) !important;
    line-height: 1.28 !important;
    letter-spacing: 0 !important;
}

.hero-line {
    background-image: linear-gradient(var(--sys-accent), var(--sys-accent));
    background-repeat: no-repeat;
    background-size: 100% 1px;
    background-position: 0 100%;
    padding-bottom: 3px;
}

.hero-copy > p:not(.kicker) {
    max-width: 34em !important;
    margin-bottom: 22px !important;
    color: var(--sys-muted) !important;
    font-size: 1rem !important;
    line-height: 1.7 !important;
}

.hero .hero-art {
    position: relative;
    min-height: 0 !important;
    height: auto;
    align-self: stretch;
    padding: 0;
}

.hero-art::before,
.art-note-float { display: none !important; }

.hero .hero-panda-wrap {
    position: absolute;
    top: 4%;
    bottom: 4%;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto !important;
    height: auto !important;
    margin: 0;
    transform: none !important;
}

.hero .hero-panda {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 auto !important;
}

.tutor-price {
    color: var(--sys-ink);
    font-size: .78rem;
    font-weight: 700;
}

.trust-bar {
    width: var(--sys-width) !important;
    margin: 28px auto 8px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.trust-bar ul {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 18px 0 8px;
    list-style: none;
    border-top: 1px solid var(--sys-line);
}

.trust-bar li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    color: var(--sys-ink);
}

.trust-bar svg {
    flex: 0 0 auto;
    margin-top: 1px;
    color: var(--sys-accent);
}

.trust-bar strong {
    font-family: "Noto Sans HK", sans-serif;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.45;
}

.match-result {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr) auto !important;
    gap: 14px !important;
    align-items: center !important;
    min-height: 96px;
    padding: 14px 16px !important;
    border: 1px solid var(--sys-line) !important;
    border-radius: var(--sys-radius) !important;
    background: #fff !important;
    box-shadow: var(--sys-shadow);
}

.match-result h3 { margin: 0 0 4px !important; font-size: 1.05rem !important; }
.match-result p { margin: 0 !important; color: var(--sys-muted) !important; }
.match-score {
    color: var(--sys-ink);
    font-size: .78rem;
    font-weight: 700;
    text-align: right;
}

.section-inner,
.review-marquee-head,
.review-marquee-window,
.teacher-marquee-label,
body:has(#results) .shell,
#content.shell {
    width: var(--sys-width) !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.review-marquee {
    width: 100% !important;
}

.review-marquee-window {
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent);
}

.match-layout,
.faq-layout,
.section-heading {
    align-items: start !important;
}

.match-intro-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 56px;
    column-gap: 8px;
    align-items: center;
}

.match-intro-head > div { display: contents; }

.match-intro-head .kicker {
    grid-column: 1;
    grid-row: 1;
    min-height: 36px;
    margin: 0 0 8px !important;
    display: flex;
    align-items: center;
}

.match-intro-head h2 {
    grid-column: 1 / -1;
    grid-row: 2;
}

.match-intro .nihao-mascot {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    max-height: 48px !important;
    margin: 0 !important;
    object-fit: contain;
}

h1, h2, h3, h4 { text-wrap: balance; }
p, li, blockquote { text-wrap: pretty; }
.hero-copy > p,
.match-intro > p,
.match-question p,
.review-marquee-head p,
.section-heading p,
.steps-head p,
.intro {
    text-wrap: balance;
}

#about-us .about-with-mascot { display: block !important; }
.about-head { align-items: start !important; }

.match-intro,
.match-intro h2,
.match-layout {
    min-width: 0;
    max-width: 100%;
}
.match-intro h2 {
    white-space: normal !important;
    overflow-wrap: break-word;
}
.match-intro h2,
.review-marquee-head h2,
.faq-intro h2,
.steps-head h2,
.about-head h2,
section.feature-band h2,
.section-heading h2,
#pageTitle,
.page-hero-mascot h1,
h2 {
    max-width: none !important;
}

.match-intro > p,
.review-marquee-head p:not(.kicker),
.faq-intro > p,
.steps-head p:not(.kicker),
.section-heading p,
.intro,
.hero-copy > p:not(.kicker) {
    max-width: none !important;
}

.nihao-nowrap { white-space: nowrap; }

/* ---------- Public tutor list ---------- */
.page-freeze,
.page-freeze-inner {
    background: var(--sys-paper) !important;
    box-shadow: none !important;
}

.header {
    background: #fff !important;
    border-bottom: 1px solid var(--sys-line) !important;
    box-shadow: none !important;
}

.teachers-page .nav,
body:has(#results) .nav,
body:has(#content.shell) .nav {
    width: var(--sys-width);
}

.page-hero-mascot .nihao-mascot {
    width: 44px !important;
    max-width: 44px !important;
    max-height: 52px !important;
    animation: none !important;
}

#pageTitle,
.page-hero-mascot h1 {
    max-width: 16em !important;
    font-size: clamp(1.7rem, 2.5vw, 2.15rem) !important;
}

.results {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 16px !important;
    align-items: stretch;
}

.results .card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 236px;
    padding: 16px !important;
    border: 1px solid var(--sys-line) !important;
    border-radius: var(--sys-radius) !important;
    background: #fff !important;
    box-shadow: var(--sys-shadow) !important;
}

.results .card-facts { margin-top: auto; }
.results .card-foot {
    margin-top: 12px;
    background: #fafaf8 !important;
    border-top: 1px solid var(--sys-line) !important;
}
.results .card-foot b { color: var(--sys-ink) !important; }
.results .mark { background: #24383c !important; }
.nav-btn.register,
a.button.primary {
    background: var(--sys-ink) !important;
    color: #fff !important;
}
body:has(#content.shell) .nav-btn.register,
.profile-cta,
#booking .booking-calendar-day.selected {
    background: var(--sys-accent) !important;
    color: #fff !important;
    border-color: var(--sys-accent) !important;
}
body:has(#content.shell) .nav-btn.register:hover,
.profile-cta:hover,
#booking .booking-calendar-day.selected:hover {
    background: #17887c !important;
    color: #fff !important;
    border-color: #17887c !important;
}

/* ---------- Tutor profile ---------- */
body:has(#content.shell) { background: var(--sys-paper) !important; }

#content.shell {
    width: min(880px, calc(100% - 48px));
}

.profile-hero {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 16px 24px !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 28px !important;
    border: 1px solid var(--sys-line) !important;
    border-radius: var(--sys-radius) !important;
    background: #fff !important;
    box-shadow: var(--sys-shadow) !important;
}

.profile-hero .mark {
    width: 88px;
    height: 88px;
    font-size: 1.8rem;
}

.profile-hero h1 { font-size: clamp(1.6rem, 3vw, 2rem) !important; }
.profile-hero .card-top { justify-content: flex-start; flex-wrap: wrap; }
.profile-hero .card-stars { flex-direction: row; align-items: center; }

.profile-cta {
    min-height: 44px !important;
    padding: 0 18px !important;
    border-radius: 999px;
    font-size: .9rem !important;
}

.profile-about,
#content .panel {
    border: 1px solid var(--sys-line) !important;
    border-radius: var(--sys-radius) !important;
    background: #fff !important;
    box-shadow: var(--sys-shadow) !important;
}

.profile-about { margin-top: 16px; padding: 22px 24px; }
.profile-about h2,
#content .panel h2 { font-size: 1.2rem; }

#content .stack { max-width: none !important; gap: 16px !important; }
#booking .booking-slot {
    background: #fff !important;
    color: var(--sys-ink) !important;
    border: 1px solid var(--sys-line) !important;
}
#booking .booking-calendar-day.available {
    background: #f7f6f3 !important;
    border-color: var(--sys-accent) !important;
}
#booking .booking-calendar-day.selected {
    background: var(--sys-accent) !important;
    color: #fff !important;
    border-color: var(--sys-accent) !important;
}

/* ---------- Teacher dashboard ---------- */
body:has(#portalView) { background: var(--sys-paper) !important; }

#loginView.login-card {
    border-radius: var(--sys-radius) !important;
    box-shadow: var(--sys-shadow) !important;
}

#loginView .auth-mascot {
    width: 64px !important;
    max-width: 64px !important;
    max-height: 78px !important;
}

#portalView h1 { font-size: 1.5rem !important; line-height: 1.3 !important; }
#portalView h2 { font-size: 1.15rem !important; }
#portalView h3 { font-size: 1rem !important; }

#portalView .student-id-card,
#portalView .partner-card {
    background: #fff !important;
    color: var(--sys-ink) !important;
    border: 1px solid var(--sys-line) !important;
    border-radius: var(--sys-radius) !important;
    box-shadow: var(--sys-shadow) !important;
}

#portalView .student-id-panda {
    width: 40px !important;
    max-width: 40px !important;
    max-height: 48px !important;
    animation: none !important;
}

#portalView .card,
#portalView .sec-card,
#portalView section.card {
    border-radius: var(--sys-radius);
    border-color: var(--sys-line);
    box-shadow: var(--sys-shadow);
}

#portalView table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: .88rem;
}

#portalView th,
#portalView td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(28, 43, 46, .08);
    text-align: left;
    vertical-align: top;
}

#portalView th {
    font-size: .75rem;
    font-weight: 700;
    color: var(--sys-muted);
}

@media (max-width: 1100px) {
    .results { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 780px) {
    .nav,
    .hero:not(.profile-hero),
    .trust-bar,
    .section-inner,
    .review-marquee-head,
    .review-marquee-window,
    .teacher-marquee-label,
    #content.shell,
    .page-freeze-inner,
    body:has(#results) .shell,
    .shell {
        width: min(100% - 28px, 640px) !important;
    }
    .hero:not(.profile-hero) {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        margin-top: 12px !important;
    }
    .hero-copy h1,
    .hero h1 { font-size: 1.85rem !important; max-width: none !important; }
    .hero-actions .button { flex: 1 1 auto; }
    .hero .hero-art {
        position: relative;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 0 0 8px;
        overflow: visible;
    }
    .hero .hero-panda-wrap {
        position: relative;
        top: auto;
        bottom: auto;
        left: auto;
        right: auto;
        width: min(118px, 34%) !important;
        height: auto !important;
        max-height: none !important;
    }
    .hero .hero-panda {
        width: 100% !important;
        height: auto !important;
        max-height: 150px !important;
    }
    .trust-bar { margin-top: 16px !important; }
    .trust-bar ul { grid-template-columns: 1fr; gap: 14px; }
    .match-result { grid-template-columns: 44px minmax(0, 1fr) !important; }
    .match-score { grid-column: 2; text-align: left; }
    .results { grid-template-columns: 1fr !important; }
    .profile-hero { grid-template-columns: 1fr !important; padding: 18px !important; }
    .profile-cta { justify-self: start; }
    .profile-hero .mark { width: 72px; height: 72px; }
}

/* Login, register, and set-new-password modal on the homepage.
   Scoped to #authModalOverlay so the public page is unchanged. */
#authModalOverlay {
    background: rgba(28, 43, 46, .46) !important;
}
#authModalOverlay .modal-card {
    background: #fff !important;
    border: 1px solid var(--sys-line) !important;
    border-radius: var(--sys-radius) !important;
    box-shadow: 0 24px 60px -32px rgba(28, 43, 46, .4) !important;
    color: var(--sys-ink);
    text-align: left;
}
#authModalOverlay .modal-mascot-wrap { justify-items: start; }
#authModalOverlay .auth-mascot {
    width: 64px !important;
    max-width: 64px !important;
    max-height: 80px !important;
    margin: 0 !important;
}
#authModalOverlay .kicker {
    color: var(--sys-accent) !important;
    text-align: left !important;
}
#authModalOverlay .modal-card h3 {
    font-family: "Noto Serif HK", "Noto Serif TC", "PingFang TC", serif;
    color: var(--sys-ink);
    text-align: left !important;
    text-wrap: balance;
}
#authModalOverlay .modal-card label { color: var(--sys-muted); }
#authModalOverlay .modal-card input {
    border: 1px solid var(--sys-line) !important;
    border-radius: 10px !important;
    color: var(--sys-ink);
}
#authModalOverlay .modal-card input:focus { outline-color: var(--sys-accent); }
#authModalOverlay .button.primary,
#authModalOverlay #authSubmitButton,
#authModalOverlay #chooseClientPortal {
    background: var(--sys-ink) !important;
    color: #fff !important;
    border-radius: 999px !important;
}
#authModalOverlay .button.secondary,
#authModalOverlay #chooseTeacherPortal {
    background: #fff !important;
    color: var(--sys-ink) !important;
    border: 1px solid var(--sys-line) !important;
    border-radius: 999px !important;
}
#authModalOverlay .modal-divider,
#authModalOverlay .modal-status { color: var(--sys-muted); text-align: left; }
