/* ══════════════════════════════════════════════════════════
   Personal CV — style.css
   Design: Deep Navy + Soft Gold — Modern Professional CV
   ══════════════════════════════════════════════════════════ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
    --navy-deepest:  #080f1a;
    --navy-deep:     #0d1b2e;
    --navy-mid:      #152238;
    --navy-soft:     #1e3152;
    --navy-muted:    #2a4570;
    --gold:          #c8a96e;
    --gold-light:    #e4c98a;
    --gold-dim:      #9b7d4a;
    --teal:          #4a90a4;
    --teal-light:    #6ab5cc;
    --white:         #ffffff;
    --off-white:     #f0eff0;
    --light-gray:    #e8e8ec;
    --mid-gray:      #a0a4b0;
    --text-body:     #d0d5e8;
    --text-muted:    #8892a8;

    /* Fonts */
    --font-display:  'Playfair Display', Georgia, serif;
    --font-body:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing scale */
    --space-xs:  0.5rem;
    --space-sm:  1rem;
    --space-md:  1.5rem;
    --space-lg:  2.5rem;
    --space-xl:  4rem;
    --space-2xl: 6rem;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 200ms;
    --dur-mid:  400ms;
    --dur-slow: 700ms;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 32px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--navy-deepest);
    color: var(--text-body);
    line-height: 1.7;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ── Utilities ─────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ── Language Switcher ─────────────────────────────────────── */
.lang-switcher {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(13, 27, 46, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(200, 169, 110, 0.2);
    border-radius: var(--radius-xl);
    padding: 0.4rem 0.85rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-lg);
    transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
    letter-spacing: 0.02em;
}

.lang-btn:hover { color: var(--white); }

.lang-btn.active {
    color: var(--gold);
    background: rgba(200, 169, 110, 0.1);
}

.lang-divider { color: rgba(200, 169, 110, 0.3); font-size: 0.75rem; }
.flag { font-size: 1rem; line-height: 1; }

/* ── Sections ──────────────────────────────────────────────── */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.section-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.section-content {
    position: relative;
    z-index: 1;
    padding: var(--space-2xl) var(--space-md);
}

/* Section backgrounds — drop real photos into assets/image/ using
   these exact filenames (bg_home.jpg / bg_skill.jpg / bg_ketiga.jpg).
   Each rule also layers a themed gradient *behind* the photo, so
   until a real file is added (or if one ever 404s) the section still
   looks intentional instead of breaking — background-color is the
   final fallback if gradients themselves were unsupported. */
.section-home {
    background-image: url('../image/bg_home.jpg'),
        radial-gradient(ellipse at 30% 20%, var(--navy-soft), var(--navy-deepest) 70%);
    background-color: var(--navy-deepest);
}
.section-home .section-overlay {
    background: linear-gradient(135deg, rgba(8,15,26,0.88) 0%, rgba(21,34,56,0.75) 50%, rgba(13,27,46,0.9) 100%);
}

.section-skills {
    background-image: url('../image/bg_skill.jpg'),
        radial-gradient(ellipse at 70% 80%, var(--navy-mid), var(--navy-deepest) 70%);
    background-color: var(--navy-mid);
}
.section-skills .section-overlay {
    background: linear-gradient(180deg, rgba(13,27,46,0.92) 0%, rgba(21,34,56,0.88) 100%);
}

.section-efficiency {
    background-image: url('../image/bg_ketiga.jpg'),
        radial-gradient(ellipse at 50% 0%, var(--navy-soft), var(--navy-deepest) 75%);
    background-color: var(--navy-deep);
}
.section-efficiency .section-overlay {
    background: linear-gradient(135deg, rgba(8,15,26,0.90) 0%, rgba(30,49,82,0.80) 100%);
}

.section-portfolio {
    background-color: var(--off-white);
    min-height: auto;
    padding: var(--space-2xl) 0;
}
.section-portfolio .section-content { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }

.section-contact {
    background-color: var(--light-gray);
    min-height: auto;
    padding: var(--space-2xl) 0;
}
.section-contact .section-content { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }

/* ── Section Headers ───────────────────────────────────────── */
.section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section-eyebrow {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: var(--space-xs);
}
.section-eyebrow.dark { color: var(--gold-dim); }
.section-eyebrow.light { color: var(--gold-light); }

.section-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    color: var(--white);
    line-height: 1.15;
    margin-bottom: var(--space-sm);
}
.section-title.dark { color: var(--navy-deepest); }

.section-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 580px;
    margin: 0 auto;
}
.section-subtitle.dark { color: #555; }

/* ── HOME SECTION ──────────────────────────────────────────── */
.home-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: var(--space-xl);
    align-items: center;
    padding: var(--space-lg) 0;
}

/* Photo */
.home-photo-wrap {
    display: flex;
    justify-content: center;
}

.photo-frame {
    position: relative;
    width: 300px;
    height: 300px;
    flex-shrink: 0;
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-xl);
    position: relative;
    z-index: 2;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 3px rgba(200,169,110,0.3);
    transition: transform var(--dur-mid) var(--ease), box-shadow var(--dur-mid) var(--ease);
}

.profile-photo:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 3px var(--gold);
}

.photo-ring {
    position: absolute;
    inset: -10px;
    border-radius: calc(var(--radius-xl) + 10px);
    border: 2px solid rgba(200, 169, 110, 0.25);
    z-index: 1;
    animation: ring-pulse 3s ease-in-out infinite;
}

@keyframes ring-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50%       { transform: scale(1.03); opacity: 0.8; }
}

.photo-dot {
    position: absolute;
    border-radius: 50%;
    background: var(--gold);
    z-index: 3;
}
.photo-dot-1 {
    width: 14px; height: 14px;
    top: -4px; right: -4px;
    animation: dot-bounce 2s ease-in-out infinite;
}
.photo-dot-2 {
    width: 8px; height: 8px;
    bottom: 20px; left: -10px;
    animation: dot-bounce 2s ease-in-out infinite 0.5s;
    background: var(--teal);
}
@keyframes dot-bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

/* Home text */
.home-text { display: flex; flex-direction: column; gap: var(--space-sm); }

.greeting {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 500;
}

.hero-name {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 800;
    color: var(--white);
    line-height: 1.1;
}

.hero-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--teal-light);
    letter-spacing: 0.02em;
}

.title-bar {
    display: inline-block;
    width: 32px;
    height: 2px;
    background: var(--gold);
    flex-shrink: 0;
}

.hero-intro {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--text-body);
    max-width: 520px;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease);
    animation: scroll-bounce 2.5s ease-in-out infinite;
}
.scroll-hint:hover { color: var(--gold); }
.scroll-hint i { font-size: 1rem; }

@keyframes scroll-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%       { transform: translateX(-50%) translateY(6px); }
}

/* ── SKILLS SECTION ────────────────────────────────────────── */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

.skill-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
    transition: transform var(--dur-mid) var(--ease), background var(--dur-mid) var(--ease), box-shadow var(--dur-mid) var(--ease);
    opacity: 0;
    transform: translateY(24px);
    animation: card-in var(--dur-slow) var(--ease) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes card-in {
    to { opacity: 1; transform: translateY(0); }
}

.skill-card:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.skill-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--white);
    opacity: 0.9;
}

.skill-info { flex: 1; min-width: 0; }
.skill-name { font-size: 0.95rem; font-weight: 600; color: var(--white); margin-bottom: 0.25rem; }
.skill-desc { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.6rem; line-height: 1.4; }

/* ── EFFICIENCY SECTION ────────────────────────────────────── */
.efficiency-wrap {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.efficiency-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-weight: 800;
    color: var(--white);
    line-height: 1.1;
    margin-bottom: var(--space-sm);
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.efficiency-sub {
    font-size: 1.1rem;
    color: var(--text-body);
    margin-bottom: var(--space-xl);
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.efficiency-img-wrap {
    width: 100%;
    max-width: 820px;
    margin: 0 auto var(--space-xl);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    border: 1px solid rgba(200, 169, 110, 0.15);
}

.efficiency-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* ── PORTFOLIO SECTION ─────────────────────────────────────── */
.portfolio-list { display: flex; flex-direction: column; gap: var(--space-xl); }

.portfolio-item {
    display: grid;
    grid-template-columns: 1fr 520px;
    gap: var(--space-xl);
    align-items: center;
    padding: var(--space-lg) 0;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.portfolio-item:last-child { border-bottom: none; }

.portfolio-item.reverse {
    grid-template-columns: 520px 1fr;
}

.portfolio-item.reverse .portfolio-text { order: 2; }
.portfolio-item.reverse .portfolio-image-wrap { order: 1; }

.portfolio-num {
    display: block;
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 800;
    color: rgba(200, 169, 110, 0.15);
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.portfolio-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--navy-deepest);
    line-height: 1.25;
    margin-bottom: var(--space-sm);
}

.portfolio-desc {
    font-size: 1rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: var(--space-md);
    max-width: 480px;
}

.btn-view {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    background: var(--navy-deepest);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-xl);
    letter-spacing: 0.04em;
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn-view:hover {
    background: var(--navy-mid);
    transform: translateY(-2px);
}

.btn-view i { transition: transform var(--dur-fast) var(--ease); }
.btn-view:hover i { transform: translateX(3px); }

.portfolio-image-wrap {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 16px 50px rgba(0,0,0,0.15);
    transition: box-shadow var(--dur-mid) var(--ease), transform var(--dur-mid) var(--ease);
    background: var(--light-gray);
}

.portfolio-image-wrap:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 24px 70px rgba(0,0,0,0.22);
}

.portfolio-thumb {
    width: 100%;
    height: 320px;
    object-fit: cover;
    display: block;
    transition: transform var(--dur-slow) var(--ease);
}

.portfolio-image-wrap:hover .portfolio-thumb { transform: scale(1.04); }

.portfolio-thumb-placeholder {
    height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
    color: var(--mid-gray);
    font-size: 3rem;
}

/* Loading / Error */
.portfolio-loading, .portfolio-error, .portfolio-empty {
    text-align: center;
    padding: var(--space-xl) 0;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.portfolio-error i, .portfolio-empty i { font-size: 2.5rem; color: var(--mid-gray); }

.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(0,0,0,0.1);
    border-top-color: var(--navy-mid);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-retry {
    padding: 0.6rem 1.5rem;
    background: var(--navy-mid);
    color: var(--white);
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--dur-fast) var(--ease);
}
.btn-retry:hover { background: var(--navy-soft); }

/* ── CONTACT SECTION ───────────────────────────────────────── */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--space-md);
    max-width: 900px;
    margin: 0 auto;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0,0,0,0.07);
    border: 1px solid rgba(0,0,0,0.06);
    transition: transform var(--dur-mid) var(--ease), box-shadow var(--dur-mid) var(--ease);
    color: var(--navy-deepest);
}

.contact-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 50px rgba(0,0,0,0.12);
}

.contact-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    color: var(--white);
}

.contact-icon.whatsapp  { background: #25D366; }
.contact-icon.phone     { background: var(--navy-mid); }
.contact-icon.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.contact-icon.email     { background: #EA4335; }

.contact-info { flex: 1; min-width: 0; }
.contact-label { display: block; font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.15rem; }
.contact-value { display: block; font-size: 0.92rem; font-weight: 500; color: var(--navy-deepest); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-arrow { color: var(--mid-gray); font-size: 0.75rem; flex-shrink: 0; }

/* ── FOOTER ────────────────────────────────────────────────── */
.site-footer {
    background: var(--navy-deepest);
    padding: var(--space-lg) 0;
    border-top: 1px solid rgba(200, 169, 110, 0.1);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

.footer-copy {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-tagline {
    font-size: 0.78rem;
    color: rgba(200, 169, 110, 0.5);
    letter-spacing: 0.05em;
}

/* ── ANIMATIONS (scroll-triggered) ────────────────────────────
   Progressive enhancement: content is fully visible by default.
   It only starts hidden-then-fades-in when html.js is present —
   and that class is only added by an early inline script (see
   <head> in home.php / portfolio-detail.php) that runs before the
   body paints. If JS is blocked, slow, or errors out, html.js is
   simply never added and every section stays visible as-is —
   there is no state in which content can get stuck invisible. ── */
html.js .reveal-up,
html.js .animate-left,
html.js .animate-right {
    opacity: 0;
    transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease);
}

html.js .animate-left  { transform: translateX(-40px); }
html.js .animate-right { transform: translateX(40px); }
html.js .reveal-up     { transform: translateY(30px); }

html.js .animate-left.visible,
html.js .animate-right.visible,
html.js .reveal-up.visible {
    opacity: 1;
    transform: none;
}

/* ══════════════════════════════════════════════════════════
   PORTFOLIO DETAIL PAGE
   ══════════════════════════════════════════════════════════ */
.detail-page {
    background: var(--off-white);
    color: var(--navy-deepest);
}

.detail-page .lang-switcher {
    background: rgba(255,255,255,0.9);
    border-color: rgba(0,0,0,0.1);
}
.detail-page .lang-btn { color: #666; }
.detail-page .lang-btn.active { color: var(--gold-dim); }

.detail-main {
    max-width: 860px;
    padding-top: calc(var(--space-2xl) + 1rem);
    padding-bottom: var(--space-2xl);
}

.detail-nav { margin-bottom: var(--space-lg); }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--navy-mid);
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(0,0,0,0.12);
    background: var(--white);
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn-back:hover {
    background: var(--navy-deepest);
    color: var(--white);
    transform: translateX(-2px);
}

.detail-article { display: flex; flex-direction: column; gap: var(--space-xl); }

.detail-header { text-align: center; }

.detail-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--navy-deepest);
    line-height: 1.2;
    margin-bottom: var(--space-sm);
}

.detail-description {
    font-size: 1.1rem;
    color: #555;
    max-width: 680px;
    margin: 0 auto var(--space-sm);
    line-height: 1.65;
}

.detail-date {
    font-size: 0.82rem;
    color: var(--mid-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.detail-img-main {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.detail-img {
    width: 100%;
    height: auto;
    max-height: 520px;
    object-fit: cover;
    display: block;
}

.detail-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #333;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.detail-content h2, .detail-content h3 {
    font-family: var(--font-display);
    color: var(--navy-deepest);
    margin: 1.5rem 0 0.75rem;
}
.detail-content h2 { font-size: 1.5rem; }
.detail-content h3 { font-size: 1.2rem; }
.detail-content p  { margin-bottom: 1rem; }
.detail-content ul, .detail-content ol { padding-left: 1.5rem; margin-bottom: 1rem; list-style: disc; }
.detail-content li { margin-bottom: 0.4rem; }
.detail-content strong { color: var(--navy-deepest); font-weight: 600; }
.detail-content a { color: var(--teal); text-decoration: underline; }

.detail-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.detail-gallery-img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    transition: transform var(--dur-mid) var(--ease);
}
.detail-gallery-img:hover { transform: scale(1.02); }

.detail-footer {
    padding-top: var(--space-md);
    border-top: 1px solid rgba(0,0,0,0.08);
}

.detail-page .site-footer {
    margin-top: 0;
    border-top: 1px solid rgba(200, 169, 110, 0.1);
}

/* ══════════════════════════════════════════════════════════
   AI CHATBOT — bubble + modal
   ══════════════════════════════════════════════════════════ */
.chatbot-bubble {
    position: fixed;
    right: var(--space-md);
    bottom: var(--space-md);
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--navy-soft));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 1000;
    cursor: grab;
    touch-action: none;
    transition: transform var(--dur-fast) var(--ease);
}
.chatbot-bubble:hover  { transform: scale(1.08); }
.chatbot-bubble:active { transform: scale(0.96); }
.chatbot-bubble.dragging { cursor: grabbing; transition: none; }

.chatbot-bubble-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chatbot-bubble-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
}

.chatbot-bubble-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--teal);
    opacity: 0.5;
    z-index: -1;
    animation: chatbot-pulse 2.4s ease-out infinite;
}
@keyframes chatbot-pulse {
    0%   { transform: scale(1);   opacity: 0.45; }
    100% { transform: scale(1.9); opacity: 0; }
}

.chatbot-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 16, 0.6);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1001;
    opacity: 0;
    transition: opacity var(--dur-mid) var(--ease);
}
.chatbot-overlay.is-open { opacity: 1; }

.chatbot-modal {
    position: fixed;
    right: var(--space-md);
    bottom: var(--space-md);
    width: min(380px, calc(100vw - 2 * var(--space-md)));
    height: min(600px, calc(100vh - 2 * var(--space-md)));
    background: var(--navy-mid);
    border: 1px solid var(--navy-muted);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.9) translateY(16px);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--dur-mid) var(--ease), opacity var(--dur-mid) var(--ease), visibility 0s var(--dur-mid);
}
.chatbot-modal.is-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    visibility: visible;
    transition: transform var(--dur-mid) var(--ease), opacity var(--dur-mid) var(--ease), visibility 0s;
}

/* While the panel is being dragged, positioning is driven 1:1 by JS
   (top/bottom inline styles) — the eased open/close transition would
   fight that and make dragging feel laggy, so it's suspended here. */
.chatbot-modal.dragging { transition: none; }

.chatbot-drag-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--navy-muted);
    margin: 0.55rem auto 0;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
}

.chatbot-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--navy-deep);
    border-bottom: 1px solid var(--navy-muted);
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
}

.chatbot-modal.dragging .chatbot-drag-handle,
.chatbot-modal.dragging .chatbot-modal-header {
    cursor: grabbing;
}

.chatbot-modal-title-wrap { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }

.chatbot-modal-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--teal);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    flex-shrink: 0;
    overflow: hidden;
}

.chatbot-modal-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.chatbot-modal-avatar-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chatbot-modal-title  { font-family: var(--font-display); font-size: 1.05rem; color: var(--white); }
.chatbot-modal-status {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbot-close-btn {
    color: var(--text-muted);
    font-size: 1.1rem;
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: auto;
    transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.chatbot-close-btn:hover { color: var(--white); background: rgba(255,255,255,0.08); }

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.chatbot-messages::-webkit-scrollbar { width: 6px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--navy-muted); border-radius: 3px; }

.chatbot-msg {
    max-width: 82%;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.chatbot-msg-user  { align-self: flex-end;   background: var(--teal); color: var(--white); border-bottom-right-radius: 4px; }
.chatbot-msg-bot   { align-self: flex-start; background: var(--navy-soft); color: var(--text-body); border-bottom-left-radius: 4px; }
.chatbot-msg-error {
    align-self: flex-start;
    background: rgba(200, 60, 60, 0.18);
    border: 1px solid rgba(200, 60, 60, 0.4);
    color: #ffb3b3;
}

/* display:flex only applies while NOT [hidden] — an unconditional
   "display" here would outrank the browser's default [hidden] rule
   (author styles beat UA styles at equal specificity) and the dots
   would never actually hide. */
.chatbot-typing:not([hidden]) {
    display: flex;
}
.chatbot-typing {
    gap: 4px;
    padding: 0 var(--space-md) var(--space-xs);
    flex-shrink: 0;
}
.chatbot-typing span {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--mid-gray);
    animation: chatbot-typing 1.2s infinite ease-in-out;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-typing {
    0%, 60%, 100% { transform: translateY(0);    opacity: 0.5; }
    30%            { transform: translateY(-4px); opacity: 1; }
}

.chatbot-input-row {
    display: flex;
    align-items: flex-end;
    gap: var(--space-xs);
    padding: var(--space-sm);
    border-top: 1px solid var(--navy-muted);
    background: var(--navy-deep);
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    resize: none;
    max-height: 100px;
    background: var(--navy-mid);
    color: var(--white);
    border: 1px solid var(--navy-muted);
    border-radius: var(--radius-md);
    padding: 0.6rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    line-height: 1.4;
}
.chatbot-input:focus { outline: none; border-color: var(--teal); }
.chatbot-input::placeholder { color: var(--text-muted); }

.chatbot-send-btn {
    width: 42px; height: 42px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy-deepest);
    display: flex; align-items: center; justify-content: center;
    transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.chatbot-send-btn:hover:not(:disabled) { transform: scale(1.06); }
.chatbot-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 560px) {
    .chatbot-modal {
        right: var(--space-xs);
        bottom: var(--space-xs);
        width: calc(100vw - 2 * var(--space-xs));
        /* 100vh on mobile is the LARGEST possible viewport (address
           bar collapsed) — while the address bar is showing, that's
           taller than what's actually visible, so the header/close
           button end up rendered above the visible area. 100dvh
           tracks the real visible height instead (falls back to the
           vh line above on older browsers that don't support it).
           The max-height cap is the actual "shrink it further" fix —
           it guarantees clear space above the panel no matter what. */
        height: calc(100vh - 2 * var(--space-xs));
        height: calc(100dvh - 2 * var(--space-xs));
        max-height: 70vh;
        max-height: 70dvh;
    }
    .chatbot-bubble { right: var(--space-sm); bottom: var(--space-sm); }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
    .home-grid { grid-template-columns: 280px 1fr; gap: var(--space-lg); }
    .photo-frame { width: 260px; height: 260px; }
    .portfolio-item { grid-template-columns: 1fr 420px; }
    .portfolio-item.reverse { grid-template-columns: 420px 1fr; }
}

@media (max-width: 768px) {
    :root { --space-2xl: 4rem; }

    .section { background-attachment: scroll; }

    .home-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-lg);
    }

    .home-photo-wrap { justify-content: center; }
    .photo-frame { width: 220px; height: 220px; }
    .hero-title { justify-content: center; }
    .hero-intro { margin: 0 auto; }

    .portfolio-item,
    .portfolio-item.reverse {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .portfolio-item.reverse .portfolio-text { order: 2; }
    .portfolio-item.reverse .portfolio-image-wrap { order: 1; }

    .portfolio-thumb { height: 240px; }
    .portfolio-thumb-placeholder { height: 240px; }

    .skills-grid { grid-template-columns: 1fr 1fr; }

    .detail-gallery { grid-template-columns: 1fr; }
    .detail-content { padding: var(--space-md); }

    .lang-switcher { top: 1rem; right: 1rem; }
}

@media (max-width: 480px) {
    :root { --space-xl: 2.5rem; --space-2xl: 3rem; }

    .skills-grid { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }

    .portfolio-num { font-size: 2.5rem; }
    .portfolio-title { font-size: 1.4rem; }

    .section-content { padding: var(--space-xl) var(--space-sm); }

    .detail-main { padding-top: 5rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
    .photo-ring, .photo-dot-1, .photo-dot-2, .scroll-hint { animation: none; }
}
