@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('/public/fonts/CormorantGaramond-Light300.ttf') format('truetype');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/public/fonts/CormorantGaramond-Regular400.ttf') format('truetype');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/public/fonts/CormorantGaramond-SemiBold600.ttf') format('truetype');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('/public/fonts/CormorantGaramond-Italic400.ttf') format('truetype');
}
@font-face {
    font-family: 'Space Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/public/fonts/SpaceMono-Regular400.ttf') format('truetype');
}
@font-face {
    font-family: 'Space Mono';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/public/fonts/SpaceMono-Bold700.ttf') format('truetype');
}

:root {
    /* Palette: Washi (Paper) & Sumi (Ink) - Japanese Contemporary */
    --c-bg: #FFFFFF;
    --c-text: #333333;
    --c-sub: #666666;
    --c-accent: #C0392B; /* deeper vermilion */
    --c-line: rgba(0,0,0,0.18);
    --c-card-hover: #FFFFFF;
    
    /* Typography */
    --font-serif: 'Cormorant Garamond', serif;
    --font-sans: 'Inter', 'Helvetica Neue', sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    
    --grid-col: 1fr 1fr 1fr 1fr;
    --pad: 4vw;
    --nav-width: 5vw;
    --nav-surface: #F5F3EF;
    --nav-surface-shadow-dark: #D4D0C9;
    --nav-surface-shadow-light: #FFFFFF;
    --nav-pad-y: 2rem;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { 
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    color-scheme: light;
    font-size: 80%;
    /* 11px at the 80% root. Apple's published text minimum; still scales with the browser default. */
    --type-min: 0.859375rem;
    -ms-overflow-style: none;
    scrollbar-width: none;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-sans);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    font-size: 1rem;
    line-height: 1.75;
    overflow-x: hidden;
    max-width: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

/* 16px keeps iOS from zooming the page when a field is focused. */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="button"]):not([type="submit"]):not([type="reset"]),
textarea,
select {
    font-size: max(1rem, 16px);
}

/* Japanese Grid Overlay */
.grid-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: var(--grid-col);
    pointer-events: none;
    z-index: 9999;
    padding: 0 var(--pad);
    gap: 20px;
    opacity: 0.3;
}
.col-guide { border-left: 1px solid var(--c-line); height: 100%; }
.col-guide:last-child { border-right: 1px solid var(--c-line); }

#hero-liquid {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background: #FFFFFF;
}

body:not(.dark-mode) #hero-liquid .hero-liquid-canvas {
    opacity: 0.5;
}

.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.4;
    mix-blend-mode: multiply;
    background-image: var(--grain-image);
    background-repeat: repeat;
    background-size: 220px 220px;
}

.floating-leaf {
    position: fixed;
    top: 22vh;
    right: 12vw;
    z-index: 2;
    width: clamp(152px, 16.5vw, 236px);
    pointer-events: none;
    will-change: transform;
    display: none;
}

.floating-leaf__img {
    display: block;
    width: 100%;
    height: auto;
    opacity: 0.5;
    mix-blend-mode: multiply;
    filter: brightness(0.38) contrast(1.15) saturate(0.85);
}

#hero-liquid .hero-liquid-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#smooth-wrapper {
    position: relative;
    z-index: 1;
}

.hero-sec {
    background: transparent;
}

/* Navigation - Base styles, overridden by desktop/mobile */
.nav-side {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    background: var(--nav-surface);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.logo-vert {
    font-family: var(--font-mono);
    font-weight: 800;
    letter-spacing: 0.15em;
    font-size: var(--type-min);
    color: var(--c-text);
}

.nav-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-link {
    color: inherit;
    text-decoration: none;
}

.logo-link:active {
    opacity: 0.6;
}

.nav-social {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.nav-social__link {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text);
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.nav-social__link:active {
    opacity: 1;
}

.nav-social__link svg {
    width: 17px;
    height: 17px;
    display: block;
}

.menu-btn {
    width: 48px;
    height: 48px;
    border: 1px solid var(--c-text);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.menu-btn:active { background: var(--c-text); color: var(--c-bg); transform: scale(1.1); }

/* Hero Section - Base styles */
.hero-sec {
    min-height: 80vh;
    min-height: 80dvh;
    padding: 0 var(--pad);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.hero-main {
    padding-top: 4rem;
}

.hero-sticky {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-headlines {
    position: relative;
}

.headline--hero {
    position: relative;
}

.headline__static {
    font-size: 0.68em;
}

.headline__swap {
    position: relative;
    display: block;
    --headline-word-indent: 0;
}

.headline__sizer {
    visibility: hidden;
    pointer-events: none;
    user-select: none;
    font-style: italic;
    color: var(--c-sub);
    padding-left: var(--headline-word-indent);
}

.headline__word {
    position: absolute;
    top: 0;
    left: var(--headline-word-indent);
    white-space: nowrap;
    font-style: italic;
    color: var(--c-sub);
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    transition: color 0.8s ease;
}

.headline__word.is-settled {
    color: var(--c-text);
}

.headline__word:first-child {
    opacity: 1;
    pointer-events: auto;
}

.headline {
    font-family: var(--font-serif);
    font-size: clamp(4.6rem, 10.12vw, 10.35rem);
    line-height: 1.05;
    font-weight: 300;
    margin: 0;
    color: var(--c-text);
    letter-spacing: -0.04em;
    mix-blend-mode: multiply; /* Interaction with bg */
}

.headline span { display: block; }
.headline__word,
.headline__sizer {
    display: block;
}
.headline .indent { font-style: italic; color: var(--c-sub); }

.hero-portfolio-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.25rem 2.75rem;
    margin-top: 7rem;
    padding-top: 1rem;
    width: 100vw;
    position: relative;
    left: 50%;
    margin-left: -50vw;
}

.hero-portfolio-link {
    font-family: var(--font-mono);
    font-weight: 800;
    letter-spacing: 0.15em;
    font-size: var(--type-min);
    color: var(--c-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.hero-portfolio-link:active {
    opacity: 0.6;
}

@media (hover: hover) and (pointer: fine) {
    .logo-link:hover {
        opacity: 0.6;
    }

    .nav-social__link:hover {
        opacity: 1;
    }

    .menu-btn:hover {
        background: var(--c-text);
        color: var(--c-bg);
        transform: scale(1.1);
    }

    .hero-portfolio-link:hover {
        opacity: 0.6;
    }
}

/* Section Labels */
.sec-label {
    font-family: var(--font-mono);
    font-size: var(--type-min);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--c-sub);
    margin-bottom: 4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--c-line);
    font-weight: 400;
}

/* =====================================================
   THEME SWITCH - Neumorphic light/dark toggle
   ===================================================== */
.theme-switch-container {
    /* Temporarily hidden — keep markup/JS for a possible later return */
    display: none !important;
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    pointer-events: auto;
}

.theme-switch {
    display: block;
    cursor: pointer;
    user-select: none;
}

.theme-switch__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-switch__track {
    --neo-bg: var(--nav-surface);
    --neo-shadow-dark: var(--nav-surface-shadow-dark);
    --neo-shadow-light: var(--nav-surface-shadow-light);

    position: relative;
    display: flex;
    align-items: center;
    width: 64px;
    height: 32px;
    padding: 3px;
    border-radius: 999px;
    background: var(--neo-bg);
    box-shadow:
        inset 4px 4px 7px var(--neo-shadow-dark),
        inset -4px -4px 7px var(--neo-shadow-light);
    transition: box-shadow 0.25s ease;
}

.theme-switch__knob {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--neo-bg);
    box-shadow:
        4px 4px 7px var(--neo-shadow-dark),
        -4px -4px 7px var(--neo-shadow-light);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s ease;
}

.theme-switch__icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    color: #707070;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.theme-switch__icon--sun {
    right: 8px;
    opacity: 1;
}

.theme-switch__icon--moon {
    left: 8px;
    opacity: 0;
}

.theme-switch__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.theme-switch__input:checked + .theme-switch__track .theme-switch__knob {
    transform: translateX(30px);
}

.theme-switch__input:checked + .theme-switch__track .theme-switch__icon--sun {
    opacity: 0;
}

.theme-switch__input:checked + .theme-switch__track .theme-switch__icon--moon {
    opacity: 1;
}

.theme-switch__input:active + .theme-switch__track .theme-switch__knob {
    box-shadow:
        2px 2px 5px var(--neo-shadow-dark),
        -2px -2px 5px var(--neo-shadow-light);
}

.theme-switch__input:focus-visible + .theme-switch__track {
    outline: 2px solid #707070;
    outline-offset: 2px;
}

@view-transition {
    navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 200ms;
    animation-timing-function: ease-out;
}

.img-reveal {
    opacity: 0;
    transition: opacity 0.18s ease;
}

.img-reveal.is-loaded {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }

    .img-reveal {
        opacity: 1;
        transition: none;
    }
}

@media (min-width: 769px) {
    .theme-switch-container {
        top: 28px;
        right: 32px;
    }
}

@media (max-width: 768px) {
    .theme-switch-container {
        top: 80px;
        right: 16px;
    }
}

@media (pointer: coarse) {
    .logo-link,
    .hero-portfolio-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
    }

    .nav-social__link {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (prefers-contrast: more) {
    :root {
        --c-text: #1A1A1A;
        --c-sub: #333333;
        --c-line: rgba(0, 0, 0, 0.45);
    }

    .nav-social__link {
        opacity: 1;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .nav-side,
    .portfolio-modal__backdrop,
    .portfolio-tile__overlay,
    .portfolio-fallback__work,
    .portfolio-modal__close {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .portfolio-modal__backdrop,
    .portfolio-tile__overlay,
    .portfolio-fallback__work,
    .portfolio-modal__close {
        background: #FFFFFF;
    }
}

