/* ============================================================
   Eric Feng — personal site
   Palette: sumi ink black, washi cream, crimson, gold
   ============================================================ */

:root {
    --ink: #0c0a09;
    --ink-2: #1a1715;
    --ink-3: #2a2522;
    --washi: #f5ecd9;
    --washi-2: #e8dcc0;
    --crimson: #b91c1c;
    --crimson-deep: #7f1d1d;
    --crimson-bright: #dc2626;
    --gold: #c9a961;
    --gold-bright: #e6c478;
    --mist: rgba(245, 236, 217, 0.08);

    --font-display: 'Shippori Mincho', 'Cormorant Garamond', serif;
    --font-serif: 'Cormorant Garamond', Georgia, serif;
    --font-jp: 'Yuji Boku', 'Shippori Mincho', serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    --ease: cubic-bezier(0.65, 0.05, 0.36, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background: var(--ink);
    color: var(--washi);
    font-family: var(--font-serif);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    cursor: none;
}

body {
    line-height: 1.5;
    min-height: 100vh;
}

/* Hide cursor on touch devices */
@media (hover: none) {
    html, body { cursor: auto; }
    .cursor-dot, .cursor-ring { display: none !important; }
}

a {
    color: inherit;
    text-decoration: none;
    cursor: none;
}

button, a, [data-cursor] {
    cursor: none;
}

::selection {
    background: var(--crimson);
    color: var(--washi);
}

/* ============================================================
   Custom cursor
   ============================================================ */
.cursor-dot {
    position: fixed;
    top: 0; left: 0;
    width: 6px; height: 6px;
    background: var(--washi);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10000;
    transform: translate3d(-50%, -50%, 0);
    mix-blend-mode: difference;
    transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), background 0.25s;
}

.cursor-ring {
    position: fixed;
    top: 0; left: 0;
    width: 36px; height: 36px;
    border: 1px solid var(--washi);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate3d(-50%, -50%, 0);
    mix-blend-mode: difference;
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out),
                border-color 0.3s, background-color 0.3s, opacity 0.3s;
}

.cursor-dot.hover { width: 0; height: 0; }
.cursor-ring.hover {
    width: 64px; height: 64px;
    background: rgba(245, 236, 217, 0.08);
    border-color: var(--gold);
}
.cursor-ring.big {
    width: 90px; height: 90px;
    background: rgba(220, 38, 38, 0.15);
    border-color: var(--crimson-bright);
}

/* ============================================================
   Three.js canvas
   ============================================================ */
#three-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Readability vignette — sits between canvas and content. Stacks four gradients:
   a deep bottom wash (where the bright water sits), a soft top falloff, an
   elliptical edge darkening, and a low-opacity flat tint across the whole scene
   so even the moon/sky area gives text enough contrast. */
.scene-vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        /* Bottom: stronger, taller dark wash over the waves */
        linear-gradient(
            to top,
            rgba(10, 8, 6, 0.88) 0%,
            rgba(10, 8, 6, 0.70) 18%,
            rgba(10, 8, 6, 0.38) 38%,
            rgba(10, 8, 6, 0) 60%
        ),
        /* Top: gentle dim so headings over the moon/sky still pop */
        linear-gradient(
            to bottom,
            rgba(10, 8, 6, 0.45) 0%,
            rgba(10, 8, 6, 0.18) 20%,
            rgba(10, 8, 6, 0) 40%
        ),
        /* Edge falloff: pulls focus to centre, darkens left/right text gutters */
        radial-gradient(
            ellipse 75% 90% at center,
            rgba(0, 0, 0, 0) 40%,
            rgba(10, 8, 6, 0.35) 75%,
            rgba(10, 8, 6, 0.62) 100%
        ),
        /* Flat tint — gives a baseline floor of contrast everywhere */
        rgba(10, 8, 6, 0.18);
}

.petals-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.petal {
    position: absolute;
    width: 14px;
    height: 14px;
    background: radial-gradient(ellipse at 30% 30%, #ffd5d5 0%, #ff9aa8 50%, #c44d6b 100%);
    border-radius: 80% 0 80% 0;
    opacity: 0.75;
    filter: drop-shadow(0 0 4px rgba(255, 150, 168, 0.35));
    will-change: transform;
}

/* ============================================================
   Loader
   ============================================================ */
.loader {
    position: fixed;
    inset: 0;
    background: var(--ink);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s var(--ease-out), visibility 0.8s;
}
.loader.gone {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-inner {
    text-align: center;
}
.loader-kanji {
    font-family: var(--font-jp);
    font-size: clamp(80px, 12vw, 160px);
    color: var(--crimson-bright);
    text-shadow: 0 0 40px rgba(220, 38, 38, 0.4);
    animation: pulse 2s ease-in-out infinite;
}
.loader-bar {
    width: 220px;
    height: 1px;
    background: rgba(245, 236, 217, 0.15);
    margin: 32px auto 16px;
    overflow: hidden;
}
.loader-bar-fill {
    height: 100%;
    width: 0;
    background: var(--washi);
    transition: width 1.6s var(--ease-out);
}
.loader-text {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    color: rgba(245, 236, 217, 0.5);
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.85; }
}

/* ============================================================
   Side nav
   ============================================================ */
.side-nav {
    position: fixed;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.nav-dot {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    color: rgba(245, 236, 217, 0.4);
    font-family: var(--font-jp);
    font-size: 14px;
    transition: color 0.3s, transform 0.3s var(--ease-out);
}
.nav-dot::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    transition: border-color 0.3s, transform 0.3s var(--ease-out);
}
.nav-dot:hover {
    color: var(--washi);
    transform: scale(1.15);
}
.nav-dot.active {
    color: var(--crimson-bright);
}
.nav-dot.active::before {
    border-color: var(--crimson-bright);
    transform: scale(1.3);
}

/* ============================================================
   Top brand
   ============================================================ */
.top-brand {
    position: fixed;
    top: 28px;
    left: 32px;
    z-index: 100;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.25em;
    color: var(--washi);
    display: flex;
    align-items: center;
    gap: 6px;
}
.brand-mark {
    color: var(--washi);
    font-weight: 500;
}
.brand-kanji {
    font-family: var(--font-jp);
    color: var(--crimson-bright);
    font-size: 14px;
    letter-spacing: 0;
}

/* ============================================================
   Scroll indicator
   ============================================================ */
.scroll-indicator {
    position: fixed;
    bottom: 32px;
    left: 32px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.4em;
    color: rgba(245, 236, 217, 0.5);
    transition: opacity 0.6s;
}
.scroll-indicator.hidden { opacity: 0; }
.scroll-line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--washi), transparent);
    background-size: 100% 200%;
    animation: scrollPulse 2.4s ease-in-out infinite;
}
@keyframes scrollPulse {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% -200%; }
}

/* ============================================================
   Sections
   ============================================================ */
main {
    position: relative;
    z-index: 2;
}

.section {
    min-height: 100vh;
    position: relative;
    padding: 120px 8vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-label {
    position: absolute;
    top: 60px;
    left: 8vw;
    display: flex;
    align-items: center;
    gap: 18px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    color: rgba(245, 236, 217, 0.55);
}
.label-num { color: var(--crimson-bright); }
.label-en { color: var(--washi); }
.label-jp {
    font-family: var(--font-jp);
    font-size: 22px;
    color: var(--crimson-bright);
    letter-spacing: 0;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(48px, 6.5vw, 96px);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--washi);
}
.section-title.centered {
    text-align: center;
}
.reveal-line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.12em; /* prevents descenders being clipped */
}
.reveal-line-inner {
    display: inline-block;
    will-change: transform;
}
.reveal-line.accent {
    color: var(--crimson-bright);
    font-style: italic;
    font-family: var(--font-serif);
    font-weight: 400;
}

/* ============================================================
   UNSHEATH section — empty space dedicated to the draw animation
   ============================================================ */
.unsheath-section {
    min-height: 100vh;
    position: relative;
    padding: 120px 8vw 12vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    pointer-events: none;
}
.unsheath-content {
    text-align: center;
}
.unsheath-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-bottom: 16px;
}
.ul-line {
    width: 60px;
    height: 1px;
    background: var(--crimson-bright);
}
.ul-kanji {
    font-family: var(--font-jp);
    font-size: 30px;
    color: var(--washi);
    letter-spacing: 0.35em;
}
.unsheath-caption {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    letter-spacing: 0.08em;
    color: rgba(245, 236, 217, 0.45);
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    align-items: center;
    text-align: center;
    padding-top: 0;
    overflow: hidden;
}
.hero-bg-kanji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-jp);
    font-size: clamp(400px, 70vw, 900px);
    color: var(--crimson-deep);
    opacity: 0.08;
    line-height: 1;
    pointer-events: none;
    z-index: -1;
    user-select: none;
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 38px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.4em;
    color: var(--washi);
}
.hero-meta .line {
    width: 48px;
    height: 1px;
    background: var(--crimson-bright);
}
.hero-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(80px, 14vw, 220px);
    line-height: 0.92;
    letter-spacing: -0.035em;
    color: var(--washi);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: 36px;
}
.hero-word {
    display: inline-block;
    position: relative;
}
.hero-word-accent {
    font-style: italic;
    color: var(--crimson-bright);
    font-weight: 400;
    font-family: var(--font-serif);
    margin-top: -0.1em;
}
.hero-sub {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    font-family: var(--font-serif);
    font-size: clamp(16px, 1.8vw, 22px);
    font-style: italic;
    color: rgba(245, 236, 217, 0.85);
    margin-bottom: 48px;
}
.hero-kanji-sub {
    font-family: var(--font-jp);
    color: var(--crimson-bright);
    font-size: 1.4em;
    font-style: normal;
}
.hero-coords {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    color: rgba(245, 236, 217, 0.5);
}
.dot-sep { color: var(--crimson-bright); }

/* ============================================================
   ABOUT
   ============================================================ */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: start;
    margin-top: 80px;
}
.about-lead {
    font-family: var(--font-serif);
    font-size: clamp(22px, 2vw, 28px);
    line-height: 1.5;
    color: var(--washi);
    margin-bottom: 28px;
    font-weight: 400;
}
.about-lead em {
    color: var(--crimson-bright);
    font-style: italic;
}
.about-body {
    font-size: 17px;
    line-height: 1.7;
    color: rgba(245, 236, 217, 0.7);
    margin-bottom: 22px;
}
.about-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid rgba(245, 236, 217, 0.15);
}
.stat-num {
    font-family: var(--font-display);
    font-size: clamp(26px, 2.4vw, 36px);
    color: var(--crimson-bright);
    font-weight: 500;
    line-height: 1;
    margin-bottom: 8px;
}
.stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(245, 236, 217, 0.55);
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.skills-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 96px;
}
.skill-card {
    position: relative;
    padding: 40px 36px;
    background: rgba(26, 23, 21, 0.55);
    border: 1px solid rgba(245, 236, 217, 0.1);
    backdrop-filter: blur(10px);
    transition: transform 0.5s var(--ease-out), border-color 0.5s, background 0.5s;
    overflow: hidden;
}
.skill-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 40px; height: 40px;
    background: linear-gradient(135deg, transparent 50%, var(--crimson) 50%);
    opacity: 0.5;
    transition: opacity 0.4s;
}
.skill-card:hover {
    transform: translateY(-8px);
    border-color: var(--crimson-bright);
    background: rgba(40, 25, 25, 0.65);
}
.skill-card:hover::after { opacity: 1; }
.skill-card-num {
    font-family: var(--font-jp);
    font-size: 56px;
    color: var(--crimson-bright);
    line-height: 1;
    margin-bottom: 24px;
}
.skill-card-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 26px;
    color: var(--washi);
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}
.skill-card ul {
    list-style: none;
}
.skill-card li {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.06em;
    color: rgba(245, 236, 217, 0.75);
    padding: 10px 0;
    border-bottom: 1px solid rgba(245, 236, 217, 0.06);
}
.skill-card li:last-child { border-bottom: none; }

/* ============================================================
   PROJECTS
   ============================================================ */
.projects-stack {
    margin-top: 96px;
    display: flex;
    flex-direction: column;
    gap: 140px;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}
.project {
    position: relative;
    padding-left: 100px;
    transition: transform 0.6s var(--ease-out);
}
.project-num {
    position: absolute;
    left: 0;
    top: 8px;
    font-family: var(--font-display);
    font-size: 72px;
    font-weight: 300;
    color: transparent;
    -webkit-text-stroke: 1px var(--crimson-bright);
    line-height: 1;
}
.project-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    color: rgba(245, 236, 217, 0.55);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.project-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(32px, 4vw, 56px);
    color: var(--washi);
    line-height: 1.1;
    margin-bottom: 22px;
    letter-spacing: -0.01em;
}
.project-desc {
    font-family: var(--font-serif);
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.65;
    color: rgba(245, 236, 217, 0.78);
    margin-bottom: 24px;
    max-width: 720px;
}
.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.project-tags span {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--washi);
    padding: 6px 14px;
    border: 1px solid rgba(245, 236, 217, 0.2);
    border-radius: 100px;
    background: rgba(26, 23, 21, 0.4);
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}
.project-tags span:hover {
    background: var(--crimson);
    border-color: var(--crimson);
    color: var(--washi);
}

/* ============================================================
   ACHIEVEMENTS
   ============================================================ */
.ach-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}
.ach-cols {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 80px 64px;
    margin-top: 96px;
}
.ach-head {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.35em;
    color: var(--crimson-bright);
    margin-bottom: 24px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(220, 38, 38, 0.3);
}
.ach-col ul {
    list-style: none;
}
.ach-col li {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.6;
    color: rgba(245, 236, 217, 0.8);
    padding: 12px 0;
    border-bottom: 1px dotted rgba(245, 236, 217, 0.1);
}
.ach-col li strong {
    color: var(--washi);
    font-weight: 600;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-inner {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}
.contact-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(56px, 8vw, 120px);
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--washi);
    margin-bottom: 32px;
}
.contact-sub {
    font-family: var(--font-serif);
    font-size: clamp(18px, 1.6vw, 22px);
    font-style: italic;
    color: rgba(245, 236, 217, 0.7);
    margin-bottom: 80px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.contact-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid rgba(245, 236, 217, 0.15);
}
.contact-link {
    display: grid;
    grid-template-columns: 120px 1fr 30px;
    align-items: center;
    text-align: left;
    padding: 28px 24px;
    border-bottom: 1px solid rgba(245, 236, 217, 0.15);
    transition: padding 0.4s var(--ease-out), background 0.4s, color 0.4s;
    position: relative;
}
.contact-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--crimson);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--ease-out);
    z-index: -1;
}
.contact-link:hover::before { transform: scaleX(1); }
.contact-link:hover {
    padding-left: 36px;
    padding-right: 36px;
    color: var(--washi);
}
.cl-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    color: rgba(245, 236, 217, 0.5);
}
.contact-link:hover .cl-label { color: rgba(245, 236, 217, 0.7); }
.cl-value {
    font-family: var(--font-display);
    font-size: clamp(20px, 2vw, 30px);
    color: var(--washi);
    font-weight: 500;
}
.cl-arrow {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--washi);
    text-align: right;
    transform: translateX(-10px);
    opacity: 0.4;
    transition: transform 0.4s var(--ease-out), opacity 0.4s;
}
.contact-link:hover .cl-arrow {
    transform: translateX(0);
    opacity: 1;
}

.footer {
    margin-top: 96px;
    padding-top: 32px;
    border-top: 1px solid rgba(245, 236, 217, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    color: rgba(245, 236, 217, 0.4);
    flex-wrap: wrap;
    gap: 12px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .section { padding: 100px 6vw; }
    .about-grid, .skills-grid, .ach-cols {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    .about-stats { grid-template-columns: 1fr; gap: 18px; }
    .project { padding-left: 0; }
    .project-num { position: static; margin-bottom: 12px; font-size: 48px; }
    .side-nav { right: 16px; gap: 14px; }
    .nav-dot { width: 26px; height: 26px; font-size: 12px; }
    .top-brand { top: 18px; left: 16px; font-size: 10px; }
    .scroll-indicator { left: 16px; bottom: 16px; }
    .contact-link {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 22px 16px;
    }
    .cl-arrow { display: none; }
    .footer { flex-direction: column; align-items: flex-start; }
}
