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

:root {
    --bg-primary: #faf9f7;
    --bg-secondary: #f5f3f0;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --accent: #c9a87c;
    --quote-mark: rgba(201, 168, 124, 0.15);
    --transition-duration: 0.8s;
    --progress-bg: rgba(201, 168, 124, 0.2);
    --progress-fill: var(--accent);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary: #0d0d0f;
        --bg-secondary: #141418;
        --text-primary: #f5f3f0;
        --text-secondary: #8a8a8a;
        --accent: #d4b896;
        --quote-mark: rgba(212, 184, 150, 0.08);
        --progress-bg: rgba(212, 184, 150, 0.15);
    }
}

:root[data-theme="dark"] {
    --bg-primary: #0d0d0f;
    --bg-secondary: #141418;
    --text-primary: #f5f3f0;
    --text-secondary: #8a8a8a;
    --accent: #d4b896;
    --quote-mark: rgba(212, 184, 150, 0.08);
    --progress-bg: rgba(212, 184, 150, 0.15);
}

html {
    font-size: 16px;
}

body {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow: hidden;
    position: relative;
}

.gradient-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.mesh-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    will-change: transform;
}

.mesh-orb-1 {
    width: 55vw;
    height: 55vw;
    top: -25%;
    left: -15%;
    background: radial-gradient(circle at 30% 30%, rgba(212, 184, 150, 0.55) 0%, rgba(232, 213, 181, 0.28) 40%, transparent 70%);
    animation: float-slow 25s ease-in-out infinite;
}

.mesh-orb-2 {
    display: none;
}

.mesh-orb-3 {
    width: 50vw;
    height: 50vw;
    bottom: -25%;
    right: -10%;
    background: radial-gradient(circle at 50% 60%, rgba(201, 168, 124, 0.48) 0%, rgba(217, 201, 176, 0.22) 45%, transparent 70%);
    animation: float-slow 30s ease-in-out infinite reverse;
}

.mesh-orb-4 {
    display: none;
}

.mesh-light-streak {
    position: absolute;
    width: 150%;
    height: 35vh;
    top: 25%;
    left: -25%;
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(201, 168, 124, 0.07) 20%,
        rgba(212, 184, 150, 0.1) 50%,
        rgba(201, 168, 124, 0.07) 80%,
        transparent 100%
    );
    transform: rotate(-12deg);
    filter: blur(50px);
}

@keyframes float-slow {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(2%, 3%) scale(1.02);
    }
    66% {
        transform: translate(-1%, -2%) scale(0.98);
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .mesh-orb-1 {
        width: 60vw;
        height: 70vh;
        top: -30%;
        left: -20%;
        background: radial-gradient(circle, #1e2d45 20%, #2a3a50 60%, transparent 90%);
        animation: none;
    }
    :root:not([data-theme="light"]) .mesh-orb-2 {
        display: none;
    }
    :root:not([data-theme="light"]) .mesh-orb-3 {
        width: 60vw;
        height: 70vh;
        bottom: -15%;
        right: -15%;
        top: auto;
        background: radial-gradient(circle, #2a1a3a 20%, #0b0218 60%, transparent 90%);
        animation: none;
    }
    :root:not([data-theme="light"]) .mesh-orb-4 {
        display: none;
    }
    :root:not([data-theme="light"]) .mesh-light-streak {
        display: none;
    }
}

:root[data-theme="dark"] .mesh-orb-1 {
    width: 60vw;
    height: 70vh;
    top: -30%;
    left: -20%;
    background: radial-gradient(circle, #1e2d45 20%, #2a3a50 60%, transparent 90%);
    animation: none;
}

:root[data-theme="dark"] .mesh-orb-2 {
    display: none;
}

:root[data-theme="dark"] .mesh-orb-3 {
    width: 60vw;
    height: 70vh;
    bottom: -15%;
    right: -15%;
    top: auto;
    background: radial-gradient(circle, #2a1a3a 20%, #0b0218 60%, transparent 90%);
    animation: none;
}

:root[data-theme="dark"] .mesh-orb-4 {
    display: none;
}

:root[data-theme="dark"] .mesh-light-streak {
    display: none;
}

:root[data-theme="light"] .mesh-orb-1 {
    background: radial-gradient(circle at 30% 30%, rgba(212, 184, 150, 0.55) 0%, rgba(232, 213, 181, 0.28) 40%, transparent 70%);
}

:root[data-theme="light"] .mesh-orb-2 {
    display: none;
}

:root[data-theme="light"] .mesh-orb-3 {
    background: radial-gradient(circle at 50% 60%, rgba(201, 168, 124, 0.48) 0%, rgba(217, 201, 176, 0.22) 45%, transparent 70%);
}

:root[data-theme="light"] .mesh-orb-4 {
    display: none;
}

:root[data-theme="light"] .mesh-light-streak {
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(201, 168, 124, 0.07) 20%,
        rgba(212, 184, 150, 0.1) 50%,
        rgba(201, 168, 124, 0.07) 80%,
        transparent 100%
    );
}

.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--text-secondary);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
    z-index: 100;
}

.theme-toggle:hover {
    opacity: 1;
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle .icon {
    color: var(--text-primary);
    transition: color 0.4s ease;
}

.theme-toggle .icon-moon {
    display: none;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun {
        display: none;
    }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon {
        display: block;
    }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: block;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
}

.quote-wrapper {
    max-width: 52rem;
    width: 100%;
    padding: 3rem;
    position: relative;
}

.quote-wrapper::before {
    content: '\201C';
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(8rem, 20vw, 16rem);
    font-weight: 400;
    color: var(--quote-mark);
    position: absolute;
    top: -1rem;
    left: -1rem;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    transition: color 0.4s ease;
}

.quote {
    position: relative;
    z-index: 1;
}

.quote-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin-bottom: 2rem;
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-duration) ease,
                transform var(--transition-duration) ease;
}

.quote-text.fade-out {
    opacity: 0;
    transform: translateY(-12px);
}

.quote-text.fade-in {
    opacity: 0;
    transform: translateY(12px);
}

.quote-source {
    font-family: 'Jost', sans-serif;
    font-size: clamp(0.875rem, 2vw, 1rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 1;
    transform: translateY(0);
    transition: opacity var(--transition-duration) ease,
                transform var(--transition-duration) ease,
                color 0.4s ease;
}

.quote-source::before {
    content: '';
    display: inline-block;
    width: 2rem;
    height: 1px;
    background-color: var(--accent);
    vertical-align: middle;
    margin-right: 1rem;
    transition: background-color 0.4s ease;
}

.quote-source.fade-out {
    opacity: 0;
    transform: translateY(-8px);
}

.quote-source.fade-in {
    opacity: 0;
    transform: translateY(8px);
}

.progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s linear, background 0.4s ease;
    opacity: 0.9;
}

@media (max-width: 640px) {
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
    }

    .quote-wrapper {
        padding: 1.5rem;
    }

    .quote-wrapper::before {
        font-size: 6rem;
        top: -0.5rem;
        left: 0;
    }

    .quote-text {
        margin-bottom: 1.5rem;
    }

    .quote-source::before {
        width: 1.5rem;
        margin-right: 0.75rem;
    }
}

@media (min-width: 1200px) {
    .quote-wrapper {
        padding: 4rem;
    }
}

::selection {
    background-color: var(--accent);
    color: var(--bg-primary);
}

:root {
    --cup-color: var(--bg-secondary);
    --cup-stroke: var(--text-secondary);
    --coffee-color: var(--accent);
    --crema-color: var(--accent);
    --steam-color: rgba(80, 60, 40, 0.7);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --steam-color: rgba(255, 255, 255, 0.4);
    }
}

:root[data-theme="dark"] {
    --steam-color: rgba(255, 255, 255, 0.4);
}

:root[data-theme="light"] {
    --steam-color: rgba(80, 60, 40, 0.7);
}

.coffee-container {
    position: fixed;
    bottom: 8px;
    right: 16px;
    width: 32px;
    height: 40px;
    z-index: 50;
    cursor: pointer;
    opacity: 0.4;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.coffee-container:hover {
    opacity: 0.7;
    transform: scale(1.1);
}

.coffee-cup {
    width: 100%;
    height: auto;
    display: block;
}

.coffee-steam {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.coffee-steam.active {
    opacity: 1;
}

.coffee-container:hover .coffee-steam.active {
    opacity: 0.5;
}

.steam-particle {
    position: absolute;
    bottom: 0;
    width: 6px;
    height: 6px;
    background: var(--steam-color);
    border-radius: 50%;
    filter: blur(1px);
    animation: steam-rise 2s ease-out infinite;
}

.steam-particle:nth-child(1) {
    left: 15%;
    animation-delay: 0s;
}

.steam-particle:nth-child(2) {
    left: 50%;
    animation-delay: 0.6s;
}

.steam-particle:nth-child(3) {
    left: 85%;
    animation-delay: 1.2s;
}

@keyframes steam-rise {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.8);
    }
    10% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 0;
        transform: translateY(-18px) scale(1.4);
    }
}

.coffee-container.drinking {
    animation: drink-tilt 0.5s ease-in-out;
}

@keyframes drink-tilt {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(-25deg) translateY(-3px);
    }
}

@media (max-width: 640px) {
    .coffee-container {
        width: 24px;
        height: 30px;
        right: 10px;
        bottom: 6px;
    }

    .coffee-steam {
        top: -12px;
        width: 18px;
        height: 14px;
    }

    .steam-particle {
        width: 4px;
        height: 4px;
    }

    @keyframes steam-rise {
        0% {
            opacity: 0;
            transform: translateY(0) scale(0.8);
        }
        10% {
            opacity: 1;
        }
        50% {
            opacity: 0.7;
        }
        100% {
            opacity: 0;
            transform: translateY(-12px) scale(1.2);
        }
    }
}

@media (max-width: 380px) {
    .coffee-container {
        width: 20px;
        height: 25px;
        right: 8px;
        bottom: 5px;
    }
}
