/* =====================================================================
   ТЕПЛА ТУРБОТА — приватна практика
   Warm cream · grounded sage · clay accent · Lora / Manrope / IBM Plex Mono
   Light is the default; dark is applied via [data-theme="dark"] (toggle + localStorage).
   ===================================================================== */

/* === TOKENS === */
:root {
    --bg: #F4EDE1;
    --surface: #FCF8F1;
    --surface-alt: #EBE1D1;
    --primary: #5E7259;          /* sage (deepened for AA as large text / underlines) */
    --primary-hover: #4B5E47;
    --accent: #C07C63;           /* clay — decorative / large only, rationed */
    --text: #322E29;
    --text-muted: #635C51;
    --border: #E0D6C4;
    --hero-from: #F1EADD;
    --hero-to: #E8EEE3;
    --on-primary: #FCF8F1;       /* ink-on-sage: use dark ink for AA at button size */

    --serif: 'Lora', 'PT Serif', Georgia, 'Times New Roman', serif;
    --sans: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'Segoe UI', monospace;

    --shadow-soft: 0 1px 2px rgba(74, 56, 36, 0.05), 0 10px 30px rgba(74, 56, 36, 0.09);
    --shadow-lift: 0 2px 6px rgba(74, 56, 36, 0.07), 0 18px 44px rgba(74, 56, 36, 0.14);
    --radius: 16px;
    --radius-sm: 12px;
    --section-py: clamp(64px, 8vw, 104px);
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --transition: 0.25s var(--ease);
    --scrollbar: #cbb89b;
    --scrollbar-hover: #b59f7d;
}

[data-theme="dark"] {
    --bg: #201C18;
    --surface: #2A2521;
    --surface-alt: #332D27;
    --primary: #A0B394;
    --primary-hover: #B6C9AA;
    --accent: #D89A80;
    --text: #F0E8DB;
    --text-muted: #A99E8E;
    --border: #3B342D;
    --hero-from: #231F1B;
    --hero-to: #26261F;
    --on-primary: #23281F;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 18px 44px rgba(0, 0, 0, 0.55);
    --scrollbar: #4a4238;
    --scrollbar-hover: #5e544759;
}

/* === BASE === */
html { scroll-behavior: smooth; }

* { scrollbar-width: thin; scrollbar-color: var(--scrollbar) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--scrollbar);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); background-clip: padding-box; }

body {
    overflow-x: hidden;
    font-family: var(--sans);
    color: var(--text);
    background: var(--bg);
    margin: 0;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

.py-section { padding: var(--section-py) 0; }
.bg-alt { background: var(--surface-alt); }

/* Full-viewport sections: each block fills the screen like its own "page",
   adapting to any monitor height instead of only feeling right at ~1080p.
   Content is centred vertically; min-height (not height) lets tall sections
   grow past the viewport rather than clip. Desktop only — on narrow screens
   the stacked layout is naturally tall, so we leave it flowing. */
@media (min-width: 992px) {
    .hero-section,
    .about-section,
    .services-section,
    .education-section,
    .certificates-section,
    .contact-section {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* Global keyboard focus — visible in both themes, not just the form */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}
[data-theme="dark"] :focus-visible { outline-color: var(--primary-hover); }

/* === TYPE HELPERS === */
.font-serif { font-family: var(--serif); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Masthead kicker: mono index + hairline rule + small-caps label */
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.kicker .k-index { color: var(--accent); font-variant-numeric: tabular-nums; }
.kicker::after {
    content: "";
    width: 34px;
    height: 1px;
    background: var(--border);
}

.section-header { margin-bottom: 48px; }
.section-title {
    font-family: var(--serif);
    font-size: clamp(1.7rem, 3.2vw, 2.4rem);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0 0 12px;
    text-wrap: balance;
}
.section-subtitle {
    color: var(--text-muted);
    font-size: 1.02rem;
    max-width: 56ch;
    margin: 0;
}
.section-header.text-center .section-subtitle { margin: 0 auto; }
.section-header.text-center .kicker { justify-content: center; }

/* === BUTTONS === */
.btn-accent {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: var(--on-primary);
    border-radius: 100px;
    font-weight: 600;
    font-family: var(--sans);
    padding: 0.6rem 1.4rem;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-accent:hover, .btn-accent:focus-visible {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--on-primary);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(94, 114, 89, 0.28);
}
[data-theme="dark"] .btn-accent:hover { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }

.btn-ghost {
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--primary) 45%, transparent);
    color: var(--primary);
    border-radius: 100px;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    transition: all var(--transition);
}
.btn-ghost:hover, .btn-ghost:focus-visible {
    background: color-mix(in srgb, var(--primary) 10%, transparent);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

/* === NAVBAR === */
#mainNav {
    background: transparent;
    padding: 18px 0;
    transition: background var(--transition), padding var(--transition), box-shadow var(--transition), border-color var(--transition);
    border-bottom: 1px solid transparent;
}
#mainNav.scrolled {
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 0;
    border-bottom-color: var(--border);
}
#mainNav .navbar-brand {
    font-family: var(--serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
#mainNav .navbar-brand .brand-mark { color: var(--primary); display: inline-flex; }
#mainNav .nav-link {
    color: var(--text) !important;
    font-weight: 500;
    padding: 6px 12px !important;
    position: relative;
    transition: color var(--transition);
}
#mainNav .nav-link::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 2px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}
#mainNav .nav-link:hover::after,
#mainNav .nav-link.active::after { transform: scaleX(1); }
#mainNav .nav-link.active { color: var(--primary) !important; }
.navbar-toggler { border-color: var(--border); }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(94, 114, 89, 0.2); }
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23322E29' stroke-linecap='round' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
[data-theme="dark"] .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23F0E8DB' stroke-linecap='round' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
@media (max-width: 991px) {
    #navbarContent {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 8px 14px 14px;
        margin-top: 10px;
        box-shadow: var(--shadow-soft);
    }
    /* Even vertical rhythm; drop the desktop ms-* side margins that cramp the stack */
    #navbarContent .navbar-nav .nav-item { margin: 0 !important; }
    #navbarContent .nav-link { padding: 11px 4px !important; }

    /* Separate the action controls (last three items) from the links with a divider */
    #navbarContent .nav-item:nth-last-child(3) {
        margin-top: 8px !important;
        padding-top: 14px;
        border-top: 1px solid var(--border);
    }
    #navbarContent .nav-item:nth-last-child(2),
    #navbarContent .nav-item:nth-last-child(1) { margin-top: 8px !important; }

    /* Full-width, centred CTA + login buttons */
    #navbarContent .btn-accent,
    #navbarContent .btn-ghost {
        display: flex;
        width: 100%;
        justify-content: center;
        padding: 11px 16px;
    }

    /* Theme toggle → a clear, labelled full-width row (no more orphaned tiny icon) */
    #navbarContent .nav-item.d-flex { display: block !important; }
    #navbarContent .btn-theme-toggle {
        width: 100%;
        height: auto;
        border-radius: 100px;
        justify-content: flex-start;
        gap: 10px;
        padding: 11px 18px;
        color: var(--text);
        border-color: var(--border);
    }
    #navbarContent .btn-theme-toggle:hover {
        color: var(--primary);
        border-color: var(--primary);
    }
    #navbarContent .btn-theme-toggle::after {
        content: "Тема";
        font-family: var(--sans);
        font-size: 0.95rem;
        font-weight: 500;
    }
}

/* === HERO === */
.hero-section {
    position: relative;
    padding: 150px 0 90px;
    background: linear-gradient(165deg, var(--hero-from) 0%, var(--hero-to) 100%);
    overflow: hidden;
}
.hero-sprig {
    position: absolute;
    top: 8%;
    right: -4%;
    width: min(46vw, 560px);
    color: var(--primary);
    opacity: 0.10;
    pointer-events: none;
    z-index: 0;
}
[data-theme="dark"] .hero-sprig { opacity: 0.14; }
.hero-section > .container { position: relative; z-index: 1; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
    padding: 5px 14px;
    border-radius: 100px;
    margin-bottom: 18px;
}
.hero-name {
    font-family: var(--serif);
    font-size: clamp(2.4rem, 5.5vw, 4rem);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0 0 10px;
    text-wrap: balance;
}
.hero-name .surname { position: relative; white-space: nowrap; }
.hero-name .surname .underline {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.16em;
    width: 100%;
    height: 0.22em;
    color: var(--accent);
    overflow: visible;
}
.hero-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin: 0 0 14px;
}
.hero-tagline {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--text);
    opacity: 0.9;
    margin: 0 0 28px;
    max-width: 42ch;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* Portrait: a soft squircle plate set over an offset sage panel (warm, editorial —
   symmetric corners so it never reads as an arch/headstone). */
.portrait {
    position: relative;
    width: min(360px, 80vw);
    margin: 0 auto;
}
.portrait::before {                     /* offset sage panel for depth + brand colour */
    content: "";
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 66%;
    height: 76%;
    background: color-mix(in srgb, var(--primary) 20%, var(--surface-alt));
    border-radius: 30px;
    z-index: 0;
}
.portrait-plate {
    position: relative;
    z-index: 1;
    aspect-ratio: 4 / 5;
    border-radius: 32px;
    overflow: hidden;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    box-shadow: inset 0 3px 0 color-mix(in srgb, var(--accent) 35%, transparent), var(--shadow-lift);
}
.portrait-plate img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.portrait-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: color-mix(in srgb, var(--primary) 55%, var(--text-muted));
    background: radial-gradient(125% 125% at 50% 28%, color-mix(in srgb, var(--primary) 15%, var(--surface-alt)), var(--surface-alt));
}
.specimen-tag {
    position: absolute;
    z-index: 2;
    left: -12px;
    bottom: 26px;
    background: var(--accent);
    color: #fff;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.03em;
    padding: 7px 14px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: var(--shadow-soft);
}
[data-theme="dark"] .specimen-tag { color: #24170f; }
.specimen-tag b { font-weight: 700; }

/* About: a plainer echo of the plate — no offset panel, no tag */
.about-portrait.portrait { width: min(300px, 72vw); }
.about-portrait.portrait::before { display: none; }

.hero-rule {
    border: none;
    border-top: 1px solid var(--border);
    margin: 60px 0 0;
}

/* === STATS (hairline band, no boxes) === */
.stats-band {
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.stats-row { display: flex; flex-wrap: wrap; }
.stat-cell {
    flex: 1 1 0;
    min-width: 140px;
    text-align: center;
    padding: 34px 16px;
    border-right: 1px solid var(--border);
}
.stat-cell:last-child { border-right: none; }
.stat-cell .stat-icon { font-size: 1.3rem; color: var(--primary); margin-bottom: 8px; }
.stat-cell .stat-value {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 600;
    color: var(--text);
    line-height: 1;
}
.stat-cell .stat-label {
    font-size: 0.76rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 8px;
}
@media (max-width: 575px) {
    .stat-cell { flex-basis: 50%; min-width: 0; }
    .stat-cell:nth-child(2n) { border-right: none; }
    .stat-cell:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}

/* === ABOUT === */
.about-portrait { width: min(300px, 70vw); margin: 0 auto; }
.about-lead {
    font-size: 1.14rem;
    line-height: 1.75;
    color: var(--text);
    max-width: 62ch;
}
.about-signoff {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--primary);
    margin-top: 18px;
}
.highlight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-top: 36px;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}
.highlight-cell {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 20px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.highlight-cell .h-icon {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--primary) 14%, transparent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}
.highlight-cell .h-title { font-weight: 600; color: var(--text); font-size: 0.98rem; }
.highlight-cell .h-sub { color: var(--text-muted); font-size: 0.86rem; }
@media (max-width: 575px) {
    .highlight-grid { grid-template-columns: 1fr; }
}

/* === SERVICES (herbarium plates, self-numbered) === */
.services-grid { counter-reset: svc; }
.service-card {
    position: relative;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.service-card::before {
    counter-increment: svc;
    content: counter(svc, decimal-leading-zero);
    position: absolute;
    top: 20px;
    right: 22px;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.6;
}
.service-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}
.service-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border-radius: 50% 50% 12px 12px / 40% 40% 10px 10px;
    margin-bottom: 18px;
}
.service-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.service-desc { font-size: 0.9rem; line-height: 1.65; color: var(--text-muted); margin: 0; }

/* === EDUCATION (sage growth-stem timeline) === */
.edu-timeline {
    position: relative;
    max-width: 760px;
    margin: 0 auto;
    padding-left: 8px;
}
.edu-stem {
    position: absolute;
    left: 118px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), color-mix(in srgb, var(--primary) 30%, transparent));
    border-radius: 2px;
    transform-origin: top;
}
.edu-item {
    display: grid;
    grid-template-columns: 96px 28px 1fr;
    align-items: start;
    gap: 0 16px;
    margin-bottom: 26px;
}
.edu-year {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    text-align: right;
    padding-top: 14px;
}
.edu-node {
    position: relative;
    display: flex;
    justify-content: center;
    padding-top: 16px;
    color: var(--primary);
}
.edu-node svg { width: 22px; height: 22px; }
.edu-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    box-shadow: var(--shadow-soft);
    transition: box-shadow var(--transition), border-color var(--transition);
}
.edu-card:hover { box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.edu-degree { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.edu-inst {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    padding: 2px 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}
.edu-desc { font-size: 0.88rem; color: var(--text-muted); margin: 0; }
@media (max-width: 575px) {
    .edu-stem { left: 9px; }
    .edu-item { grid-template-columns: 20px 1fr; gap: 6px 14px; }
    .edu-year { grid-column: 2; text-align: left; padding-top: 0; font-size: 1.1rem; }
    .edu-node { grid-column: 1; grid-row: 1 / span 2; padding-top: 2px; }
    .edu-card { grid-column: 2; margin-top: 8px; }
}

/* === CERTIFICATES === */
.cert-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 22px;
    margin-bottom: 40px;
}
.cert-tab {
    position: relative;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 2px;
    transition: color var(--transition);
}
.cert-tab::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}
.cert-tab:hover { color: var(--text); }
.cert-tab.active { color: var(--text); }
.cert-tab.active::after { transform: scaleX(1); }

.cert-card {
    position: relative;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.cert-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.cert-icon {
    flex: none;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    border-radius: 50% 50% 10px 10px / 40% 40% 8px 8px;
}
.cert-cat {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.cert-title { font-family: var(--serif); font-size: 1rem; font-weight: 600; color: var(--text); margin: 4px 0 2px; }
.cert-issuer { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.cert-year {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 6px;
}
.cert-item { transition: opacity 0.2s var(--ease); }
.cert-item.hidden { display: none; }

/* === CONTACT === */
.spec-sheet { border-top: 1px solid var(--border); }
.spec-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}
.spec-row .spec-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.spec-row .spec-label {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.spec-row .spec-value { color: var(--text); font-size: 0.98rem; }
.spec-row .spec-value.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.spec-row a.spec-value { color: var(--primary); text-decoration: none; }
.spec-row a.spec-value:hover { text-decoration: underline; }
.discretion-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 18px;
}

.contact-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-soft);
}
.contact-card h5 { font-family: var(--serif); font-weight: 600; color: var(--text); }
.form-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-control, .form-select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 0.6rem 0.85rem;
}
.form-control::placeholder { color: color-mix(in srgb, var(--text-muted) 75%, transparent); }
.form-control:focus, .form-select:focus {
    background: var(--surface);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(94, 114, 89, 0.18);
    color: var(--text);
}
[data-theme="dark"] .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23A99E8E' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
[data-theme="dark"] .form-select option { background: var(--surface); }
.form-success {
    background: color-mix(in srgb, var(--primary) 14%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
    color: var(--text);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.form-success .check-mark { color: var(--primary); flex: none; }
.form-error {
    background: color-mix(in srgb, var(--accent) 14%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    color: var(--text);
    border-radius: 12px;
    padding: 16px 20px;
}

/* === FOOTER === */
.footer-main {
    background: var(--surface-alt);
    border-top: 1px solid var(--border);
    color: var(--text);
}
.footer-main .footer-brand { font-family: var(--serif); font-weight: 600; color: var(--text); }
.footer-main .footer-muted { color: var(--text-muted); }
.footer-main a { color: var(--text-muted); text-decoration: none; }
.footer-main a:hover { color: var(--primary); }
.footer-divider { color: var(--primary); opacity: 0.5; }

/* === SCROLL-TOP === */
.btn-scroll-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 46px;
    height: 46px;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-lift);
    text-decoration: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition), transform var(--transition), background var(--transition);
    z-index: 1000;
    pointer-events: none;
}
.btn-scroll-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.btn-scroll-top:hover { background: var(--primary-hover); color: var(--on-primary); transform: translateY(-3px); }

/* === THEME TOGGLE === */
#iconDay { display: inline; }
#iconNight { display: none; }
[data-theme="dark"] #iconDay { display: none; }
[data-theme="dark"] #iconNight { display: inline; }
.btn-theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: all var(--transition);
}
.btn-theme-toggle:hover {
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    border-color: var(--primary);
}

/* === REVEAL / MOTION (opt-in: only when JS confirms motion is allowed) ===
   Content is fully visible by default; html.motion hides it pre-reveal. */
html.motion .reveal { opacity: 0; transform: translateY(14px); }
html.motion .reveal.in {
    opacity: 1;
    transform: none;
    transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
html.motion .draw { stroke-dasharray: var(--len, 1); stroke-dashoffset: var(--len, 1); }
html.motion .draw.in { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s var(--ease); }
html.motion .stem-line { transform: scaleY(0); }
html.motion .stem-line.in { transform: scaleY(1); transition: transform 0.9s var(--ease); }

/* === THEME TRANSITIONS (enabled after first paint) === */
html.theme-ready body { transition: background-color 0.4s ease, color 0.3s ease; }
html.theme-ready .service-card,
html.theme-ready .cert-card,
html.theme-ready .edu-card,
html.theme-ready .contact-card,
html.theme-ready .stats-band,
html.theme-ready .highlight-cell,
html.theme-ready .form-control,
html.theme-ready .form-select,
html.theme-ready .footer-main {
    transition: background-color 0.4s ease, border-color 0.3s ease, color 0.3s ease;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
    html.motion .reveal { opacity: 1 !important; transform: none !important; }
    html.motion .draw { stroke-dashoffset: 0 !important; }
    html.motion .stem-line { transform: none !important; }
}

/* === RESPONSIVE === */
@media (max-width: 991px) {
    .hero-section { padding: 130px 0 70px; text-align: center; }
    .hero-cta { justify-content: center; }
    .hero-tagline { margin-left: auto; margin-right: auto; }
    .portrait { margin-top: 44px; }
    .hero-sprig { opacity: 0.06; }
}

/* === INTERACTION: cursor-tracked portrait + richer button motion ===
   JS sets --mx/--my in [-1,1] on [data-tilt]; only on fine-pointer, motion-OK devices. */
.portrait[data-tilt] { perspective: 950px; }
.portrait[data-tilt] .portrait-plate {
    transform: rotateY(calc(var(--mx, 0) * 7deg)) rotateX(calc(var(--my, 0) * -7deg));
    transition: transform 0.5s var(--ease);
    will-change: transform;
    backface-visibility: hidden;
}
.portrait[data-tilt].tilting .portrait-plate { transition: transform 0.12s ease-out; }

/* Soft glare that tracks the cursor across the plate (a light catching the photo) */
.portrait[data-tilt] .portrait-plate::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at calc((var(--mx, 0) * 0.5 + 0.5) * 100%) calc((var(--my, 0) * 0.5 + 0.5) * 100%),
        rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 46%);
    mix-blend-mode: soft-light;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}
.portrait[data-tilt].tilting .portrait-plate::after { opacity: 1; }

/* Depth: the sage panel (far) and the clay tag (near) parallax by different amounts */
.portrait[data-tilt]::before { transition: transform 0.5s var(--ease); }
.portrait[data-tilt].tilting::before {
    transform: translate(calc(var(--mx, 0) * 10px), calc(var(--my, 0) * 10px));
    transition: transform 0.12s ease-out;
}
.portrait[data-tilt] .specimen-tag { transition: transform 0.5s var(--ease), background 0.25s, color 0.25s; }
.portrait[data-tilt].tilting .specimen-tag {
    transform: translate(calc(var(--mx, 0) * -16px), calc(var(--my, 0) * -12px));
    transition: transform 0.12s ease-out;
}

/* Buttons — a bit more life: sheen sweep, icon nudge, stronger lift, tactile press */
.btn-accent, .btn-ghost { position: relative; overflow: hidden; }
.btn-accent > i, .btn-ghost > i { display: inline-block; transition: transform 0.25s var(--ease); }
.btn-accent:hover > i, .btn-ghost:hover > i { transform: translateX(2px); }
.btn-accent:hover, .btn-ghost:hover { transform: translateY(-2px); }
.btn-accent:active, .btn-ghost:active { transform: translateY(0) scale(0.98); transition-duration: 0.08s; }
.btn-accent::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(115deg, transparent 32%, rgba(255, 255, 255, 0.3) 50%, transparent 68%);
    transform: translateX(-130%);
    transition: transform 0.6s var(--ease);
    pointer-events: none;
}
.btn-accent:hover::before { transform: translateX(130%); }

@media (prefers-reduced-motion: reduce) {
    .portrait[data-tilt] .portrait-plate,
    .portrait[data-tilt]::before,
    .portrait[data-tilt] .specimen-tag { transform: none !important; }
    .portrait[data-tilt] .portrait-plate::after,
    .btn-accent::before { display: none; }
}
