/* ===========================================
   ronri.xyz - Warm Modernist Atelier
   =========================================== */

/* --- CSS Custom Properties --- */
:root {
    --bg-primary: #faf3e6;
    --bg-secondary: #f0e6d0;
    --surface-dark: #3d2b1f;
    --text-primary: #2c1e10;
    --text-secondary: #8b6f4e;
    --accent-primary: #e8734a;
    --accent-secondary: #d4838f;
    --accent-tertiary: #e8b84a;
    --accent-cool: #4a8b8b;
    --shadow-warm: rgba(180, 130, 70, 0.12);
    --scroll-y: 0;
    --font-display: 'Caveat', cursive;
    --font-body: 'Quicksand', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    position: relative;
}

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

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

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* --- Lens Flare Environmental Layer --- */
.lens-flare {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.lens-flare.visible {
    opacity: 1;
}

.flare-bloom {
    position: absolute;
    top: 5%;
    right: 15%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle at 30% 20%, rgba(232, 184, 74, 0.35) 0%, rgba(232, 115, 74, 0.15) 30%, transparent 60%);
    transform: translateY(calc(var(--scroll-y) * 0.15px));
    transition: transform 0.1s linear;
}

.flare-streak {
    position: absolute;
    top: 18%;
    right: 5%;
    width: 400px;
    height: 2px;
    background: rgba(232, 184, 74, 0.5);
    filter: blur(1px);
    transform: translateY(calc(var(--scroll-y) * 0.15px));
}

.flare-ghost {
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(232, 115, 74, 0.1);
    clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
    animation: flare-pulse 3s ease-in-out infinite;
}

.flare-ghost-1 {
    top: 16%;
    right: 22%;
    animation-delay: 0s;
}

.flare-ghost-2 {
    top: 19%;
    right: 30%;
    width: 14px;
    height: 14px;
    animation-delay: 0.8s;
}

.flare-ghost-3 {
    top: 14%;
    right: 38%;
    width: 10px;
    height: 10px;
    animation-delay: 1.6s;
}

@keyframes flare-pulse {
    0%, 100% { opacity: 0.05; }
    50% { opacity: 0.15; }
}

/* --- Floating Mid-Century Elements --- */
.floating-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.float-el {
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.float-el.visible {
    opacity: 1;
}

.float-starburst-1 {
    top: 25%;
    left: 5%;
    animation: spin 20s linear infinite, float-bob 6s ease-in-out infinite;
}

.float-starburst-2 {
    top: 60%;
    right: 4%;
    animation: spin 25s linear infinite reverse, float-bob 7s ease-in-out infinite 1s;
}

.float-starburst-3 {
    top: 82%;
    left: 8%;
    animation: spin 18s linear infinite, float-bob 5s ease-in-out infinite 2s;
}

.float-boomerang-1 {
    top: 35%;
    right: 6%;
    animation: float-bob 5s ease-in-out infinite;
}

.float-boomerang-2 {
    top: 70%;
    left: 3%;
    animation: float-bob 7s ease-in-out infinite 0.5s;
}

.float-circles-1 {
    top: 45%;
    left: 7%;
    animation: float-bob 6s ease-in-out infinite 1.5s, circles-pulse 4s ease-in-out infinite;
}

.float-circles-2 {
    top: 88%;
    right: 5%;
    animation: float-bob 8s ease-in-out infinite 0.8s, circles-pulse 5s ease-in-out infinite 1s;
}

.float-diamond {
    display: flex;
    gap: 6px;
}

.float-diamond span {
    width: 8px;
    height: 8px;
    background: var(--accent-cool);
    opacity: 0.15;
    transform: rotate(45deg);
    display: block;
}

.float-diamond-cluster-1 {
    top: 20%;
    right: 8%;
    animation: float-bob 5s ease-in-out infinite 2s;
}

.float-diamond-cluster-2 {
    top: 55%;
    left: 4%;
    animation: float-bob 6.5s ease-in-out infinite 1s;
}

@keyframes float-bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(3deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes circles-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* --- Workbench Header --- */
.workbench-header {
    position: sticky;
    top: 0;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
    background: var(--surface-dark);
    background-image: linear-gradient(92deg, rgba(180, 130, 70, 0.08) 0%, rgba(160, 110, 55, 0.05) 50%, rgba(180, 130, 70, 0.08) 100%);
    z-index: 100;
}

.header-logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    color: var(--bg-primary);
    letter-spacing: -0.01em;
}

.header-nav {
    display: flex;
    gap: clamp(1.5rem, 4vw, 3.5rem);
}

.nav-link {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    color: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    position: relative;
    padding-bottom: 4px;
    background-image: linear-gradient(var(--accent-tertiary), var(--accent-tertiary));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}

.nav-link:hover {
    background-size: 100% 2px;
}

.nav-link-active {
    background-size: 100% 2px;
    animation: nav-pulse 2s ease-in-out infinite;
}

@keyframes nav-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* --- Hero Section --- */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--bg-primary);
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 9rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.15;
    transform: rotate(1.5deg);
    opacity: 0;
    animation: hero-fade-up 0.6s ease forwards 0.4s;
}

.hero-tagline-wrapper {
    margin-top: 1.5rem;
    position: relative;
    display: inline-block;
}

.hero-tagline {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.9rem, 1.6vw, 1.1rem);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: typewriter 1.2s steps(22, end) forwards 1s;
}

.hero-wavy-underline {
    display: block;
    width: 100%;
    height: 12px;
    margin-top: 8px;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: draw-underline 0.8s ease-out forwards 2.2s;
}

.hero-scroll-arrow {
    margin-top: 3rem;
    opacity: 0;
    animation: hero-fade-up 0.5s ease forwards 3s, float-bob 4s ease-in-out infinite 3s;
}

@keyframes hero-fade-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes draw-underline {
    to { stroke-dashoffset: 0; }
}

/* --- Section Headings --- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin-bottom: clamp(2rem, 4vw, 3rem);
    display: inline-block;
    position: relative;
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.section-heading.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.heading-wavy-underline {
    display: block;
    width: 100%;
    height: 10px;
    margin-top: 4px;
    stroke-dasharray: 350;
    stroke-dashoffset: 350;
    transition: stroke-dashoffset 0.8s ease-out;
}

.section-heading.animate-in .heading-wavy-underline {
    stroke-dashoffset: 0;
}

/* --- Work Section --- */
.work-section {
    padding: clamp(3rem, 6vw, 6rem) clamp(1.5rem, 4vw, 4rem);
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* --- Portfolio Grid --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(1.5rem, 3vw, 3rem);
}

.grid-item {
    --tilt: calc(var(--seed) * 2.4deg - 1.2deg);
    background: var(--bg-primary);
    border-radius: 2px;
    box-shadow: 0 4px 20px var(--shadow-warm);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.grid-item.animate-in {
    opacity: 1;
    transform: translateY(0) rotate(var(--tilt));
}

.grid-item-wide {
    grid-column: span 2;
}

.grid-item-tall {
    grid-row: span 2;
}

.grid-item-thumb {
    position: relative;
    overflow: hidden;
}

.thumb-placeholder {
    width: 100%;
    aspect-ratio: 3 / 2;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: sepia(0.08) saturate(1.1) brightness(1.02);
    transition: filter 0.5s ease;
}

.thumb-placeholder-tall {
    aspect-ratio: 3 / 4;
}

.grid-item:hover .thumb-placeholder {
    filter: none;
}

.thumb-icon {
    width: 70%;
    height: auto;
}

/* Hover starburst */
.grid-item::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    background: var(--accent-tertiary);
    clip-path: polygon(50% 0%, 61% 35%, 100% 50%, 61% 65%, 50% 100%, 39% 65%, 0% 50%, 39% 35%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 3;
}

.grid-item:hover::after {
    opacity: 0.5;
}

.grid-item-info {
    padding: clamp(0.8rem, 2vw, 1.2rem);
}

.grid-item-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.15;
    position: relative;
    display: inline;
    background-image: linear-gradient(var(--accent-primary), var(--accent-primary));
    background-size: 0% 3px;
    background-position: center bottom;
    background-repeat: no-repeat;
    transition: background-size 0.25s ease;
    padding-bottom: 2px;
}

.grid-item:hover .grid-item-title {
    background-size: 100% 3px;
}

.grid-item-desc {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.4vw, 0.95rem);
    color: var(--text-secondary);
    margin-top: 0.4rem;
    line-height: 1.5;
}

.grid-item-meta {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.75rem, 1.1vw, 0.85rem);
    color: var(--text-secondary);
    opacity: 0.7;
    display: block;
    margin-top: 0.5rem;
}

/* --- About Section --- */
.about-section {
    padding: clamp(4rem, 8vw, 8rem) clamp(1.5rem, 4vw, 4rem);
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    background: linear-gradient(175deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.about-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.pull-quote {
    margin: 2.5rem 0;
    padding-left: 1.5rem;
    border-left: none;
    position: relative;
}

.pull-quote::before {
    content: '\201C';
    position: absolute;
    left: -0.2rem;
    top: -0.8rem;
    font-family: var(--font-display);
    font-size: 4rem;
    color: var(--accent-tertiary);
    opacity: 0.5;
    line-height: 1;
}

.pull-quote p {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: var(--text-primary);
    line-height: 1.3;
}

.pull-quote cite {
    display: block;
    margin-top: 0.8rem;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.85rem, 1.4vw, 0.95rem);
    color: var(--text-secondary);
    font-style: normal;
    position: relative;
    display: inline-block;
    padding-bottom: 3px;
    background-image: linear-gradient(var(--accent-primary), var(--accent-primary));
    background-size: 100% 4px;
    background-position: left bottom;
    background-repeat: no-repeat;
}

/* --- Sketchbook Footer --- */
.sketchbook-footer {
    position: relative;
    min-height: 100vh;
    background-color: var(--bg-secondary);
    background-image: repeating-linear-gradient(
        transparent,
        transparent 28px,
        rgba(180, 160, 130, 0.2) 28px,
        rgba(180, 160, 130, 0.2) 29px
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: clamp(4rem, 8vw, 8rem) clamp(1.5rem, 4vw, 4rem);
    z-index: 2;
}

.torn-edge {
    position: absolute;
    top: -38px;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 3;
}

.torn-edge svg {
    width: 100%;
    height: 100%;
    display: block;
}

.footer-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.footer-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 6vw, 4.5rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin-bottom: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.footer-heading.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.footer-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.footer-link {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    color: var(--text-primary);
    position: relative;
    padding-bottom: 3px;
    background-image: linear-gradient(var(--accent-cool), var(--accent-cool));
    background-size: 0% 1.5px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.2s ease;
    opacity: 0;
    transform: translateY(15px);
    transition: background-size 0.2s ease, opacity 0.5s ease, transform 0.5s ease;
}

.footer-link:hover {
    background-size: 100% 1.5px;
}

.footer-link.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.footer-note {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.footer-note.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.footer-meta {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.75rem, 1.1vw, 0.85rem);
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Coffee Cup */
.coffee-cup {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    z-index: 2;
}

.coffee-steam-1 {
    animation: steam-rise 3s ease-in-out infinite;
}

.coffee-steam-2 {
    animation: steam-rise 3s ease-in-out infinite 0.5s;
}

.coffee-steam-3 {
    animation: steam-rise 3s ease-in-out infinite 1s;
}

@keyframes steam-rise {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-4px) translateX(2px);
        opacity: 0.6;
    }
}

/* --- Project Detail Overlay --- */
.project-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 30, 16, 0.85);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-out;
}

.project-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.overlay-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2.5rem;
    color: var(--bg-primary);
    z-index: 210;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.overlay-close:hover {
    opacity: 1;
}

.overlay-content {
    width: 80vw;
    max-height: 80vh;
    background: var(--bg-primary);
    border-radius: 2px;
    box-shadow: 0 20px 60px rgba(44, 30, 16, 0.4);
    overflow-y: auto;
    padding: clamp(2rem, 4vw, 3rem);
    transform: scale(0.9);
    transition: transform 0.4s ease-out;
}

.project-overlay.active .overlay-content {
    transform: scale(1);
}

.overlay-project-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(20px);
    animation: overlay-stagger-in 0.5s ease forwards 0.2s;
}

.overlay-project-desc {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: overlay-stagger-in 0.5s ease forwards 0.4s;
}

.overlay-project-meta {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.75rem, 1.1vw, 0.85rem);
    color: var(--text-secondary);
    opacity: 0;
    transform: translateY(20px);
    animation: overlay-stagger-in 0.5s ease forwards 0.6s;
}

.overlay-project-visual {
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 2rem;
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: overlay-stagger-in 0.5s ease forwards 0.1s;
}

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

/* --- Sunset Decorative Stripe --- */
.about-section::before {
    content: '';
    display: block;
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, #e8734a, #d4838f, #e8b84a);
    border-radius: 2px;
    margin-bottom: 2rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .grid-item-wide {
        grid-column: span 1;
    }

    .grid-item-tall {
        grid-row: span 1;
    }

    .thumb-placeholder-tall {
        aspect-ratio: 3 / 2;
    }

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

    .header-nav {
        gap: 1.2rem;
    }

    .overlay-content {
        width: 95vw;
        max-height: 90vh;
    }

    .coffee-cup {
        bottom: 1rem;
        right: 1rem;
    }

    .float-el {
        display: none;
    }
}

@media (max-width: 480px) {
    .workbench-header {
        padding: 0 1rem;
    }

    .footer-contact {
        gap: 0.8rem;
    }
}