/* ============================================================
   INTERACTIVE 3D RESUME — resume.css
   Extends style.css. Same purple/glass language, real depth.
   ============================================================ */

.resume-page {
    background: var(--bg-dark);
    overflow-x: clip;
}

/* Three.js starfield sits behind everything */
#resume-space {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.resume-page .navbar,
.resume-page section,
.resume-page .back-to-top { position: relative; z-index: 2; }

.r-section {
    padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 5vw, 4rem);
    max-width: 1240px;
    margin-inline: auto;
}

.r-section .section-header { text-align: center; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.r-section .section-subtitle { color: var(--text-gray); margin-top: .75rem; }

/* ---------- HERO ---------- */
.r-hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 7rem clamp(1.25rem, 5vw, 4rem) 3rem;
    max-width: 1240px;
    margin-inline: auto;
}

.r-hero-inner {
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
}

.r-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--primary-light);
    background: rgba(var(--primary-rgb), .1);
    border: 1px solid rgba(var(--primary-rgb), .3);
    padding: .5rem 1rem;
    border-radius: 100px;
    margin-bottom: 1.5rem;
}
.r-eyebrow svg { width: 14px; height: 14px; }

.r-hero h1 {
    font-size: clamp(2.25rem, 5.5vw, 4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.02em;
    margin-bottom: 1rem;
}

.r-role {
    font-size: clamp(.95rem, 1.6vw, 1.15rem);
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 1.25rem;
}

.r-summary {
    color: var(--text-gray);
    max-width: 52ch;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.r-hero-actions { display: flex; gap: .85rem; flex-wrap: wrap; }

.r-scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    margin-top: 3rem;
    color: var(--text-gray);
    font-size: .72rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    animation: rBob 2s ease-in-out infinite;
}
.r-scroll-hint svg { width: 18px; height: 18px; }
@keyframes rBob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(8px) } }

/* ---------- 3D ID CARD (mouse-tracked) ---------- */
.r-card-stage { perspective: 1200px; display: grid; place-items: center; }

.r-id-card {
    position: relative;
    width: min(360px, 100%);
    padding: 2rem 1.75rem 0;
    background: linear-gradient(150deg, rgba(var(--primary-rgb),.16), rgba(var(--bg-card-rgb),.9) 45%);
    border: 1px solid rgba(var(--primary-rgb), .32);
    border-radius: 26px;
    box-shadow: 0 30px 70px rgba(var(--shadow-rgb),.55), 0 0 60px rgba(var(--primary-rgb),.18);
    transform-style: preserve-3d;
    transition: transform .18s ease-out;
    overflow: hidden;
}

/* Specular sweep that follows the pointer */
.r-id-shine {
    position: absolute;
    inset: 0;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(var(--overlay-rgb),.14), transparent 65%);
    opacity: 0;
    transition: opacity .3s ease;
    pointer-events: none;
}
.r-id-card:hover .r-id-shine { opacity: 1; }

.r-id-photo {
    width: 108px; height: 108px;
    margin: 0 auto 1.1rem;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(var(--primary-rgb),.55);
    box-shadow: 0 0 30px rgba(var(--primary-rgb),.35);
    transform: translateZ(55px);
}
.r-id-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }

.r-id-body { text-align: center; transform: translateZ(35px); }
.r-id-body h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: .3rem; }
.r-id-title { color: var(--primary-light); font-size: .85rem; font-weight: 600; margin-bottom: 1.25rem; }

.r-id-meta { list-style: none; display: flex; flex-direction: column; gap: .6rem; text-align: left; }
.r-id-meta li {
    display: flex; align-items: center; gap: .6rem;
    font-size: .78rem; color: var(--text-gray);
    background: rgba(var(--overlay-rgb),.03);
    border: 1px solid var(--border);
    padding: .55rem .8rem;
    border-radius: 10px;
}
.r-id-meta svg { width: 14px; height: 14px; color: var(--primary); flex-shrink: 0; }

.r-id-strip {
    margin: 1.5rem -1.75rem 0;
    padding: .7rem;
    text-align: center;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary));
    transform: translateZ(20px);
}
.r-id-strip span { font-size: .68rem; font-weight: 700; letter-spacing: .22em; color: #fff; }

/* ---------- 3D CUBE NAVIGATOR ---------- */
.r-cube-stage {
    perspective: 900px;
    height: 340px;
    display: grid;
    place-items: center;
    cursor: grab;
    touch-action: pan-y;
}
.r-cube-stage:active { cursor: grabbing; }

.r-cube {
    position: relative;
    width: 190px; height: 190px;
    transform-style: preserve-3d;
    transform: rotateX(-18deg) rotateY(0deg);
}

.r-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .7rem;
    background: rgba(var(--bg-card-rgb), .82);
    border: 1px solid rgba(var(--primary-rgb), .38);
    border-radius: 16px;
    backdrop-filter: blur(6px);
    box-shadow: inset 0 0 40px rgba(var(--primary-rgb),.12);
    transition: background .25s ease, border-color .25s ease;
    user-select: none;
}
.r-face:hover { background: rgba(var(--primary-rgb), .22); border-color: var(--primary-light); }
.r-face svg { width: 30px; height: 30px; color: var(--primary-light); }
.r-face span { font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }

/* 190px cube -> half-depth 95px */
.r-face:nth-child(1) { transform: rotateY(  0deg) translateZ(95px); }
.r-face:nth-child(2) { transform: rotateY( 90deg) translateZ(95px); }
.r-face:nth-child(3) { transform: rotateY(180deg) translateZ(95px); }
.r-face:nth-child(4) { transform: rotateY(-90deg) translateZ(95px); }
.r-face:nth-child(5) { transform: rotateX( 90deg) translateZ(95px); }
.r-face:nth-child(6) { transform: rotateX(-90deg) translateZ(95px); }

/* ---------- 3D TILT CARDS ---------- */
.r-tilt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.r-tilt-card { perspective: 900px; }

.r-tilt-inner {
    height: 100%;
    padding: 2.25rem 1.75rem;
    background: rgba(var(--bg-card-rgb), .72);
    border: 1px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    transform-style: preserve-3d;
    transition: transform .2s ease-out, border-color .25s ease, box-shadow .25s ease;
}
.r-tilt-card:hover .r-tilt-inner {
    border-color: rgba(var(--primary-rgb), .55);
    box-shadow: 0 22px 50px rgba(var(--shadow-rgb),.5), 0 0 40px rgba(var(--primary-rgb),.16);
}

.r-icon {
    width: 52px; height: 52px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: rgba(var(--primary-rgb), .14);
    border: 1px solid rgba(var(--primary-rgb), .3);
    margin-bottom: 1.25rem;
    transform: translateZ(40px);
}
.r-icon svg { width: 24px; height: 24px; color: var(--primary-light); }

.r-tilt-inner h3 { font-size: 1.15rem; margin-bottom: .65rem; transform: translateZ(28px); }
.r-tilt-inner p  { color: var(--text-gray); font-size: .93rem; line-height: 1.75; transform: translateZ(16px); }

/* ---------- 3D SCROLL TIMELINE ---------- */
.r-timeline {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    perspective: 1100px;
}

.r-tl-item {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 1.75rem;
    align-items: start;
    transform-style: preserve-3d;
    /* Starting pose — resume.js swaps in .r-in when the row scrolls into view */
    opacity: 0;
    transform: translateY(40px) rotateX(-22deg);
    transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.3,1);
}
.r-tl-item.r-in { opacity: 1; transform: translateY(0) rotateX(0deg); }

.r-tl-year {
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--primary-light);
    padding-top: 1.5rem;
    text-align: right;
    white-space: nowrap;
}

.r-tl-card {
    position: relative;
    padding: 1.6rem 1.75rem;
    background: rgba(var(--bg-card-rgb), .72);
    border: 1px solid var(--border);
    border-left: 2px solid var(--primary);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.r-tl-card:hover {
    transform: translateZ(30px) translateX(6px);
    border-color: rgba(var(--primary-rgb),.5);
    border-left-color: var(--primary-light);
    box-shadow: 0 20px 45px rgba(var(--shadow-rgb),.5), 0 0 34px rgba(var(--primary-rgb),.14);
}
.r-tl-card h3 { font-size: 1.1rem; margin-bottom: .3rem; }
.r-tl-org { color: var(--primary-light); font-size: .88rem; font-weight: 600; margin-bottom: .75rem; }
.r-tl-card p { color: var(--text-gray); font-size: .92rem; line-height: 1.7; }

.r-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: var(--primary-light);
    background: rgba(var(--primary-rgb), .13);
    border: 1px solid rgba(var(--primary-rgb), .3);
    padding: .3rem .7rem;
    border-radius: 100px;
    margin-bottom: .75rem;
}

/* ---------- 3D SKILL SPHERE ---------- */
.r-sphere-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 5vw, 4rem);
    align-items: center;
}

.r-sphere {
    position: relative;
    width: 100%;
    height: 460px;
    transform-style: preserve-3d;
}

.r-sphere .r-tag {
    position: absolute;
    top: 50%; left: 50%;
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    padding: .35rem .75rem;
    border-radius: 100px;
    background: rgba(var(--bg-card-rgb), .6);
    border: 1px solid rgba(var(--primary-rgb), .28);
    color: var(--text-light);
    will-change: transform, opacity;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
    cursor: default;
}
.r-sphere .r-tag:hover {
    background: var(--primary);
    border-color: var(--primary-light);
    color: #fff;
}

.r-skill-list { list-style: none; display: flex; flex-direction: column; gap: .9rem; }
.r-skill-list li {
    padding: 1rem 1.25rem;
    background: rgba(var(--bg-card-rgb), .6);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color .25s ease, transform .25s ease;
}
.r-skill-list li:hover { border-color: rgba(var(--primary-rgb),.5); transform: translateX(6px); }
.r-skill-list strong { display: block; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-light); margin-bottom: .35rem; }
.r-skill-list span { color: var(--text-gray); font-size: .9rem; }

/* ---------- 3D FLIP CARDS ---------- */
.r-flip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
}

.r-flip { perspective: 1000px; height: 190px; }

.r-flip-in {
    position: relative;
    width: 100%; height: 100%;
    transform-style: preserve-3d;
    transition: transform .65s cubic-bezier(.2,.7,.3,1);
}
.r-flip:hover .r-flip-in,
.r-flip:focus-within .r-flip-in { transform: rotateY(180deg); }

.r-flip-front, .r-flip-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .9rem;
    padding: 1.5rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(var(--bg-card-rgb), .75);
    backdrop-filter: blur(8px);
    text-align: center;
}
.r-flip-front svg { width: 34px; height: 34px; color: var(--primary-light); }
.r-flip-front h3 { font-size: 1rem; }

.r-flip-back {
    transform: rotateY(180deg);
    background: linear-gradient(150deg, rgba(var(--primary-rgb),.22), rgba(var(--bg-card-rgb),.9));
    border-color: rgba(var(--primary-rgb), .45);
}
.r-flip-back p { color: var(--text-light); font-size: .88rem; line-height: 1.65; }

/* ---------- CTA ---------- */
.r-cta { padding-bottom: clamp(5rem, 10vw, 8rem); }
.r-cta-box {
    text-align: center;
    padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 5vw, 3rem);
    background: linear-gradient(150deg, rgba(var(--primary-rgb),.15), rgba(var(--bg-card-rgb),.85));
    border: 1px solid rgba(var(--primary-rgb), .3);
    border-radius: 26px;
    box-shadow: 0 30px 70px rgba(var(--shadow-rgb),.45);
}
.r-cta-box h2 { font-size: clamp(1.6rem, 3.6vw, 2.5rem); margin-bottom: .85rem; }
.r-cta-box p { color: var(--text-gray); margin-bottom: 2rem; }
.r-cta-box .r-hero-actions { justify-content: center; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 968px) {
    .r-hero-inner   { grid-template-columns: 1fr; }
    .r-card-stage   { order: -1; }
    .r-sphere-wrap  { grid-template-columns: 1fr; }
    .r-sphere       { height: 330px; }
}

@media (max-width: 640px) {
    .r-hero { min-height: auto; padding-top: 6rem; }
    .r-tl-item { grid-template-columns: 1fr; gap: .6rem; }
    .r-tl-year { text-align: left; padding-top: 0; }
    .r-hero-actions .btn-primary, .r-hero-actions .btn-secondary { flex: 1 1 100%; justify-content: center; }
    .r-cube-stage { height: 280px; }
    .r-cube { width: 150px; height: 150px; }
    .r-face:nth-child(1) { transform: rotateY(  0deg) translateZ(75px); }
    .r-face:nth-child(2) { transform: rotateY( 90deg) translateZ(75px); }
    .r-face:nth-child(3) { transform: rotateY(180deg) translateZ(75px); }
    .r-face:nth-child(4) { transform: rotateY(-90deg) translateZ(75px); }
    .r-face:nth-child(5) { transform: rotateX( 90deg) translateZ(75px); }
    .r-face:nth-child(6) { transform: rotateX(-90deg) translateZ(75px); }
    .r-face svg { width: 24px; height: 24px; }
    .r-face span { font-size: .68rem; }
}

/* Motion-sensitive visitors get the content, not the choreography. */
@media (prefers-reduced-motion: reduce) {
    .r-tl-item { opacity: 1; transform: none; }
    .r-scroll-hint { animation: none; }
    .r-flip:hover .r-flip-in { transform: none; }
}

@media print {
    #resume-space, .navbar, .mobile-menu, .back-to-top,
    .r-cube-section, .r-scroll-hint, .r-sphere { display: none !important; }
    .resume-page { background: #fff; color: #000; }
    .r-tl-item { opacity: 1 !important; transform: none !important; }
    .r-tl-card, .r-tilt-inner, .r-id-card { background: #fff; border: 1px solid #ccc; box-shadow: none; }
    .r-flip { height: auto; }
    .r-flip-front, .r-flip-back { position: static; backface-visibility: visible; transform: none; background: #fff; }
}

/* ---------- READABILITY FAILSAFE ----------
   script.js tags every h1/h2/h3 with .animate-heading, which sets opacity:0
   until its IntersectionObserver fires. On a résumé that is the wrong default:
   if the observer never runs (JS error, old browser, a crawler that renders
   without scrolling) the page reads as blank. The résumé's own choreography
   lives on .r-tl-item instead, so headings here stay visible. */
.resume-page .animate-heading {
    opacity: 1;
    transform: none;
    filter: none;
}

/* ============================================================
   LIGHT THEME ADJUSTMENTS
   The tokens above already flip the palette. What glass cannot do is
   survive the change of ground: a translucent dark panel that read as
   frosted glass over night sky reads as a grey smudge on paper. These
   rules give the same components a real surface in daylight.
   ============================================================ */

html[data-theme="light"] .r-id-card {
    background: linear-gradient(150deg, rgba(var(--primary-rgb), .10), #fff 45%);
    border-color: rgba(var(--primary-rgb), .28);
    box-shadow: 0 18px 44px rgba(var(--shadow-rgb), .14);
}

html[data-theme="light"] .r-face {
    background: rgba(255, 255, 255, .92);
    box-shadow: inset 0 0 30px rgba(var(--primary-rgb), .08),
                0 6px 18px rgba(var(--shadow-rgb), .10);
}

html[data-theme="light"] .r-tilt-inner,
html[data-theme="light"] .r-tl-card,
html[data-theme="light"] .r-skill-list li,
html[data-theme="light"] .r-flip-front {
    background: #fff;
    box-shadow: 0 3px 14px rgba(var(--shadow-rgb), .08);
}

html[data-theme="light"] .r-flip-back {
    background: linear-gradient(150deg, rgba(var(--primary-rgb), .16), #fff);
}

html[data-theme="light"] .r-id-meta li,
html[data-theme="light"] .r-sphere .r-tag {
    background: rgba(var(--primary-rgb), .06);
}

html[data-theme="light"] .r-cta-box {
    background: linear-gradient(150deg, rgba(var(--primary-rgb), .14), #fff);
    box-shadow: 0 20px 50px rgba(var(--shadow-rgb), .12);
}

/* The specular sweep is a white veil — invisible on a white card. Darken it
   so the pointer highlight still reads. */
html[data-theme="light"] .r-id-shine {
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%),
                rgba(var(--primary-rgb), .16), transparent 65%);
}
