:root {
    --text: #222a32;
    --muted: #637083;
    --line: #e4e8ed;
    --panel: #ffffff;
    --soft: #f4f6f8;
    --blue: #2c83d6;
    --teal: #22b8c8;
    --green: #16c765;
    --orange: #f7a928;
    --red: #e94b42;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    background: #eef3f8;
    font-family: Arial, "Microsoft JhengHei", "PingFang TC", sans-serif;
    line-height: 1.6;
}

a {
    color: inherit;
}

.icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}

.site-header,
.site-footer {
    width: min(1080px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.site-logo {
    font-weight: 800;
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap: 18px;
    color: var(--muted);
    font-size: 0.95rem;
}

.site-nav a {
    text-decoration: none;
}

.site-footer {
    padding: 28px 0 36px;
    color: var(--muted);
}

.button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 8px;
    padding: 10px 16px;
    border: 1px solid var(--line);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.button.primary {
    color: #fff;
    background: #2082c7;
    border-color: #2082c7;
}

.button.secondary {
    color: var(--text);
    background: #fff;
}

.home-shell {
    width: min(1080px, calc(100% - 32px));
    margin: 40px auto;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 32px;
    align-items: start;
}

.home-shell.private-home {
    width: min(780px, calc(100% - 32px));
    grid-template-columns: minmax(0, 1fr);
}

.home-copy {
    padding: 44px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #2082c7;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.home-copy h1,
.message-page h1,
.cms-content h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 6vw, 3.8rem);
    line-height: 1.08;
}

.home-copy p {
    margin: 0;
    color: var(--muted);
    max-width: 620px;
}

.home-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.home-list {
    display: grid;
    gap: 12px;
}

.mini-card {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
}

.mini-card img,
.mini-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
}

.mini-avatar {
    display: grid;
    place-items: center;
    color: #fff;
    background: #2082c7;
    font-weight: 800;
}

.mini-card strong,
.mini-card small {
    display: block;
    overflow-wrap: anywhere;
}

.mini-card small {
    color: var(--muted);
}

.message-page,
.cms-content {
    width: min(860px, calc(100% - 32px));
    margin: 48px auto;
    padding: 34px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.cms-body {
    color: #344050;
    overflow-wrap: anywhere;
}

.ecard-page {
    background: #f3f5f5;
}

.ecard-page .site-header,
.ecard-page .site-footer {
    display: none;
}

.ecard-shell {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 0;
}

.ecard {
    width: min(100%, 420px);
    min-height: 100vh;
    background: #fff;
    overflow: hidden;
}

.card-banner {
    height: 176px;
    background-position: center;
    background-size: cover;
}

.card-banner-placeholder {
    position: relative;
    background:
        linear-gradient(110deg, #1176b7 0 29%, #a9dcd3 29% 72%, #a4cf4f 72% 100%);
}

.card-banner-placeholder::before {
    content: "";
    position: absolute;
    inset: 28px 28px 34px 64px;
    border: 10px solid rgba(255, 255, 255, 0.55);
    transform: rotate(-3deg);
}

.card-banner-placeholder::after {
    content: "EC";
    position: absolute;
    right: 54px;
    top: 54px;
    color: #1878be;
    font-size: 2rem;
    font-weight: 900;
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.75);
}

.avatar-wrap {
    position: relative;
    z-index: 1;
    height: 128px;
    display: flex;
    align-items: flex-start;
    padding-left: 26px;
    margin-top: -28px;
}

.avatar {
    width: 128px;
    height: 128px;
    border: 8px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    background: #e9eef3;
    box-shadow: 0 14px 28px rgba(30, 45, 60, 0.18);
}

.avatar-fallback {
    display: grid;
    place-items: center;
    color: #fff;
    background: #2082c7;
    font-size: 3rem;
    font-weight: 800;
}

.info-card {
    width: calc(100% - 40px);
    margin: 0 auto;
    padding: 34px 30px 28px;
    background: #f6f7f7;
    border: 1px solid #e8ecef;
    border-radius: 22px;
    box-shadow: 0 28px 34px rgba(30, 40, 48, 0.15);
}

.info-card h1 {
    margin: 0;
    font-size: 1.9rem;
    line-height: 1.15;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.name-line {
    width: 82px;
    height: 5px;
    margin: 14px 0 28px;
    border-radius: 999px;
    background: linear-gradient(90deg, #344e68 0 45%, var(--teal) 45% 100%);
}

.info-list {
    display: grid;
    gap: 17px;
}

.info-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    color: #314053;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.info-icon {
    display: inline-flex;
    justify-content: center;
    color: #6d7f84;
    padding-top: 2px;
}

.info-row.person .info-icon,
.info-row.mobile .info-icon {
    color: #2f99df;
}

.info-row.whatsapp .info-icon,
.info-row.website .info-icon {
    color: #10be73;
}

.info-row.email .info-icon {
    color: #f08320;
}

.info-row.address .info-icon {
    color: var(--red);
}

.quick-actions {
    width: min(240px, calc(100% - 84px));
    margin: 52px auto 28px;
    display: grid;
    grid-template-columns: repeat(3, 70px);
    justify-content: center;
    gap: 12px;
}

.quick-button {
    width: 70px;
    height: 70px;
    display: grid;
    place-items: center;
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    box-shadow: 0 12px 24px rgba(27, 42, 56, 0.13);
    border: 0;
    cursor: pointer;
    font: inherit;
}

.quick-button .icon {
    width: 32px;
    height: 32px;
}

.quick-button.contact {
    background: #6061d9;
}

.quick-button.call {
    background: #9ccc6b;
}

.quick-button.email {
    background: var(--orange);
}

.quick-button.whatsapp {
    background: #00cf57;
}

.quick-button.website {
    background: #79c9dd;
}

.quick-button.wechat {
    background: #08b86e;
}

.card-tools {
    width: calc(100% - 40px);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.tool-button {
    min-height: 58px;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 8px 4px;
    border: 1px solid #dce4e8;
    border-radius: 8px;
    color: #385064;
    background: #fff;
    font: inherit;
    font-size: 0.72rem;
    cursor: pointer;
}

.tool-button .icon {
    width: 18px;
    height: 18px;
    color: var(--card-accent);
}

.share-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 18px 0 28px;
    color: #637083;
    font-size: 0.82rem;
}

.share-links a {
    text-decoration: none;
}

.card-modal {
    position: fixed;
    z-index: 20;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15, 25, 35, 0.68);
}

.card-modal[hidden] {
    display: none;
}

.modal-open {
    overflow: hidden;
}

.modal-panel {
    position: relative;
    width: min(100%, 340px);
    padding: 28px;
    border-radius: 8px;
    color: #263242;
    text-align: center;
    background: #fff;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
}

.modal-panel h2 {
    margin: 0 24px 18px;
    font-size: 1.2rem;
}

.modal-panel p {
    margin: 16px 0 0;
    overflow-wrap: anywhere;
    font-size: 0.85rem;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    color: #536273;
    background: transparent;
    font-size: 1.8rem;
    cursor: pointer;
}

.qr-image {
    display: block;
    width: min(100%, 240px);
    aspect-ratio: 1;
    margin: 0 auto;
    object-fit: contain;
}

.wechat-id {
    font-size: 1.05rem !important;
}

/* Template 2: clean, centred business profile. */
.template-minimal {
    background: #fbfbfa;
}

.template-minimal .card-banner {
    height: 112px;
    filter: saturate(0.78);
}

.template-minimal .avatar-wrap {
    height: 116px;
    justify-content: center;
    padding: 0;
    margin-top: -54px;
}

.template-minimal .avatar {
    width: 116px;
    height: 116px;
    border-color: #fbfbfa;
    box-shadow: none;
}

.template-minimal .info-card {
    width: calc(100% - 52px);
    padding: 24px 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    text-align: center;
}

.template-minimal .name-line {
    margin: 12px auto 25px;
    background: var(--card-accent);
}

.template-minimal .info-list {
    gap: 0;
    text-align: left;
    border-top: 1px solid #e4e7e8;
}

.template-minimal .info-row {
    min-height: 52px;
    align-items: center;
    border-bottom: 1px solid #e4e7e8;
}

.template-minimal .quick-actions {
    margin-top: 32px;
}

/* Template 3: accent colour is the primary visual identity. */
.template-brand {
    background: #f1f5f8;
}

.template-brand .card-banner {
    height: 202px;
    position: relative;
}

.template-brand .card-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, color-mix(in srgb, var(--card-accent) 78%, transparent), rgba(9, 23, 38, 0.1));
}

.template-brand .avatar-wrap {
    height: 118px;
    padding-left: 34px;
    margin-top: -48px;
}

.template-brand .avatar {
    width: 118px;
    height: 118px;
    border-color: var(--card-accent);
    box-shadow: 0 12px 22px rgba(20, 36, 53, 0.22);
}

.template-brand .info-card {
    width: calc(100% - 32px);
    padding: 30px 26px 26px;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(35, 55, 72, 0.12);
}

.template-brand .name-line {
    background: var(--card-accent);
}

.template-brand .info-icon,
.template-brand .info-row.person .info-icon,
.template-brand .info-row.mobile .info-icon,
.template-brand .info-row.whatsapp .info-icon,
.template-brand .info-row.website .info-icon {
    color: var(--card-accent);
}

.template-brand .quick-button.contact,
.template-brand .quick-button.website {
    background: var(--card-accent);
}

.template-brand .card-tools,
.template-brand .intro-block {
    width: calc(100% - 32px);
}

/* Template 4: dark premium profile with high contrast details. */
.template-midnight {
    color: #e7eff6;
    background: #101a25;
}

.template-midnight .card-banner {
    height: 220px;
    filter: brightness(0.58) saturate(0.7);
}

.template-midnight .card-banner-placeholder {
    background: linear-gradient(125deg, #0c1520, var(--card-accent), #1d2b3a);
}

.template-midnight .avatar-wrap {
    height: 128px;
    padding-left: 30px;
    margin-top: -42px;
}

.template-midnight .avatar {
    border-color: #101a25;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.42);
}

.template-midnight .info-card {
    width: calc(100% - 32px);
    padding: 30px 26px 26px;
    border: 1px solid rgba(202, 221, 237, 0.16);
    border-radius: 8px;
    color: #edf5fa;
    background: #172534;
    box-shadow: none;
}

.template-midnight .name-line {
    background: var(--card-accent);
}

.template-midnight .info-row {
    color: #d7e2eb;
}

.template-midnight .info-icon,
.template-midnight .info-row.person .info-icon,
.template-midnight .info-row.mobile .info-icon,
.template-midnight .info-row.whatsapp .info-icon,
.template-midnight .info-row.website .info-icon {
    color: var(--card-accent);
}

.template-midnight .quick-button.contact,
.template-midnight .quick-button.website {
    background: var(--card-accent);
}

.template-midnight .tool-button {
    border-color: rgba(212, 230, 242, 0.18);
    color: #deebf3;
    background: #172534;
}

.template-midnight .share-links,
.template-midnight .intro-block {
    color: #c3d3df;
}

.template-midnight .card-tools,
.template-midnight .intro-block {
    width: calc(100% - 32px);
}

.intro-block {
    width: calc(100% - 40px);
    margin: 0 auto 54px;
    color: #263242;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .site-header {
        min-height: auto;
        padding: 18px 0;
        align-items: flex-start;
        flex-direction: column;
    }

    .home-shell {
        grid-template-columns: 1fr;
        margin: 16px auto 32px;
    }

    .home-copy,
    .message-page,
    .cms-content {
        padding: 24px;
    }
}

@media (max-width: 420px) {
    .card-banner {
        height: 174px;
    }

    .info-card {
        width: calc(100% - 40px);
        padding: 32px 30px 26px;
    }

    .quick-actions {
        margin-top: 50px;
    }
}
