/* Brand tokens live in caredesk-theme.css (shared with post-login app) */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.cd-landing,
body.cd-login {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--cd-ink);
    background: var(--cd-white);
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Nav ---------- */
.cd-nav {
    position: absolute;
    z-index: 20;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
}

.cd-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
}

.cd-brand-mark {
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 0.35rem;
    background:
        linear-gradient(135deg, var(--cd-leaf) 0%, var(--cd-leaf-deep) 100%);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.cd-brand-text {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cd-white);
}

.cd-brand-text em {
    font-style: normal;
    font-weight: 500;
    opacity: 0.85;
}

.cd-nav-cta {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.55rem 1.1rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(247, 250, 248, 0.45);
    color: var(--cd-white);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.cd-nav-cta:hover {
    background: rgba(247, 250, 248, 0.12);
    border-color: rgba(247, 250, 248, 0.8);
}

/* ---------- Hero ---------- */
.cd-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: flex-end;
    padding: clamp(5.5rem, 12vh, 8rem) clamp(1.25rem, 4vw, 3rem) clamp(2.5rem, 6vh, 4rem);
    overflow: hidden;
}

.cd-hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #0f3d2e;
}

.cd-hero-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 68% center;
    transform: scale(1.04);
    animation: cd-hero-ken 22s ease-in-out infinite alternate;
}

.cd-hero-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(
            105deg,
            rgba(15, 61, 46, 0.94) 0%,
            rgba(15, 61, 46, 0.82) 32%,
            rgba(15, 61, 46, 0.42) 55%,
            rgba(15, 61, 46, 0.18) 78%,
            rgba(15, 61, 46, 0.28) 100%
        ),
        linear-gradient(180deg, rgba(15, 61, 46, 0.35) 0%, transparent 28%, transparent 72%, rgba(15, 61, 46, 0.55) 100%);
    pointer-events: none;
}

.cd-hero-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.16;
    background-image:
        linear-gradient(rgba(247, 250, 248, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(247, 250, 248, 0.06) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(180deg, transparent 0%, #000 25%, #000 75%, transparent 100%);
    animation: cd-grid-drift 28s linear infinite;
    pointer-events: none;
}

.cd-hero-inner {
    position: relative;
    z-index: 2;
    max-width: 36rem;
    color: var(--cd-white);
    animation: cd-rise 0.9s ease-out both;
}

.cd-brand-hero {
    margin: 0 0 0.85rem;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.cd-hero h1 {
    margin: 0 0 1rem;
    font-family: var(--font-display);
    font-size: clamp(1.85rem, 4.5vw, 2.85rem);
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.03em;
    max-width: 14ch;
}

.cd-lede {
    margin: 0 0 1.75rem;
    font-size: 1.05rem;
    line-height: 1.55;
    color: rgba(247, 250, 248, 0.82);
    max-width: 34ch;
}

.cd-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.65rem 1.35rem;
    border-radius: 0.45rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.cd-btn:hover {
    transform: translateY(-1px);
}

.cd-btn-primary {
    background: var(--cd-amber);
    color: #fffaf3;
}

.cd-btn-primary:hover {
    background: #9a5714;
}

.cd-btn-ghost {
    border-color: rgba(247, 250, 248, 0.4);
    color: var(--cd-white);
}

.cd-btn-ghost:hover {
    border-color: var(--cd-white);
    background: rgba(247, 250, 248, 0.08);
}

/* ---------- Section ---------- */
.cd-section {
    padding: clamp(3.5rem, 8vw, 5.5rem) clamp(1.25rem, 4vw, 3rem);
    background:
        linear-gradient(180deg, #f0f5f2 0%, var(--cd-white) 100%);
}

.cd-section h2 {
    margin: 0 0 0.65rem;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--cd-leaf-deep);
}

.cd-section-lede {
    margin: 0 0 2.25rem;
    max-width: 38rem;
    color: var(--cd-muted);
    line-height: 1.55;
}

.cd-flow {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 1.5rem 2rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cd-flow li {
    padding-top: 1rem;
    border-top: 2px solid var(--cd-leaf);
}

.cd-flow strong {
    display: block;
    margin-bottom: 0.4rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--cd-leaf-deep);
}

.cd-flow span {
    color: var(--cd-muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

.cd-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
    border-top: 1px solid rgba(20, 32, 28, 0.08);
    font-size: 0.85rem;
    color: var(--cd-muted);
    background: var(--cd-white);
}

/* ---------- Login ---------- */
body.cd-login {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    min-height: 100vh;
    min-height: 100dvh;
}

.cd-login-visual {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(165deg, rgba(15, 61, 46, 0.92) 0%, rgba(20, 32, 28, 0.7) 100%),
        linear-gradient(120deg, #0f3d2e, #1f4638 50%, #2a3832);
    color: var(--cd-white);
    padding: clamp(2rem, 5vw, 3.5rem);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    animation: cd-fade-in 0.8s ease both;
}

.cd-login-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(247, 250, 248, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(247, 250, 248, 0.08) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: cd-grid-drift 24s linear infinite;
}

.cd-login-visual-inner {
    position: relative;
    z-index: 1;
    max-width: 26rem;
    margin-top: auto;
    margin-bottom: auto;
    animation: cd-rise 0.95s ease-out 0.1s both;
}

.cd-login-visual .cd-brand-text {
    font-size: 1.5rem;
}

.cd-login-visual h1 {
    margin: 1.5rem 0 0.85rem;
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 3vw, 2.4rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.03em;
}

.cd-login-visual p {
    margin: 0;
    color: rgba(247, 250, 248, 0.8);
    line-height: 1.55;
}

.cd-login-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.75rem, 4vw, 3rem);
    background:
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(31, 107, 79, 0.08), transparent 55%),
        var(--cd-white);
    animation: cd-fade-in 0.7s ease 0.15s both;
}

.cd-login-panel-inner {
    width: 100%;
    max-width: 24rem;
    margin: 0 auto;
}

.cd-login-panel h2 {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--cd-leaf-deep);
    letter-spacing: -0.02em;
}

.cd-login-panel .cd-sub {
    margin: 0 0 1.75rem;
    color: var(--cd-muted);
    font-size: 0.95rem;
}

.cd-field {
    margin-bottom: 1.1rem;
}

.cd-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cd-ink);
}

.cd-field input[type="text"],
.cd-field input[type="password"] {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(20, 32, 28, 0.18);
    border-radius: 0.45rem;
    background: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--cd-ink);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cd-field input:focus {
    outline: none;
    border-color: var(--cd-leaf);
    box-shadow: 0 0 0 3px rgba(31, 107, 79, 0.15);
}

.cd-pass-wrap {
    position: relative;
}

.cd-pass-wrap input {
    padding-right: 2.75rem;
}

.cd-pass-toggle {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--cd-muted);
    padding: 0.45rem 0.55rem;
    cursor: pointer;
}

.cd-login-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
}

.cd-captcha {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 0.45rem;
    background: var(--cd-surface);
    border: 1px solid rgba(31, 107, 79, 0.12);
}

.cd-captcha strong {
    font-size: 0.85rem;
    color: var(--cd-leaf-deep);
}

.cd-captcha .captcha-label {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cd-captcha input {
    width: 5rem;
    min-height: 2.35rem;
    margin-left: 0.35rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(20, 32, 28, 0.18);
    border-radius: 0.35rem;
    font-family: inherit;
}

.cd-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--cd-muted);
    cursor: pointer;
}

.cd-check input {
    accent-color: var(--cd-leaf);
}

.cd-link {
    color: var(--cd-leaf);
    font-weight: 600;
}

.cd-link:hover {
    text-decoration: underline;
}

.cd-login-submit {
    width: 100%;
    min-height: 2.85rem;
    border: 0;
    border-radius: 0.45rem;
    background: var(--cd-leaf);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.cd-login-submit:hover {
    background: var(--cd-leaf-deep);
    transform: translateY(-1px);
}

.cd-login-foot {
    margin-top: 1.75rem;
    font-size: 0.8rem;
    color: var(--cd-muted);
    text-align: center;
}

.cd-back-home {
    display: inline-block;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--cd-leaf);
}

.cd-back-home:hover {
    text-decoration: underline;
}

@keyframes cd-rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cd-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cd-bg-shift {
    from { filter: saturate(1); }
    to { filter: saturate(1.08) brightness(1.03); }
}

@keyframes cd-hero-ken {
    from { transform: scale(1.04) translate(0, 0); }
    to { transform: scale(1.1) translate(-1.5%, 1%); }
}

@keyframes cd-grid-drift {
    from { background-position: 0 0; }
    to { background-position: 48px 48px; }
}

@media (max-width: 900px) {
    .cd-hero-photo {
        object-position: center 40%;
    }

    .cd-hero-bg::before {
        background:
            linear-gradient(
                180deg,
                rgba(15, 61, 46, 0.72) 0%,
                rgba(15, 61, 46, 0.55) 40%,
                rgba(15, 61, 46, 0.88) 100%
            );
    }

    body.cd-login {
        grid-template-columns: 1fr;
    }

    .cd-login-visual {
        min-height: 38vh;
        padding-bottom: 2rem;
    }

    .cd-login-visual h1 {
        font-size: 1.65rem;
    }

    .cd-flow {
        grid-template-columns: 1fr;
    }

    .cd-nav .cd-brand-text {
        color: var(--cd-white);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
