/* === Self-hosted Fonts (DSGVO compliant — no Google Fonts request) === */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('/fonts/inter-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1D7F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('/fonts/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url('/fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1D7F, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-tertiary: rgba(255, 255, 255, 0.35);
    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-hover: rgba(255, 255, 255, 0.13);
    --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 16px;
    --radius-sm: 12px;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
}

/* === App Container === */
.app {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 2rem;
}

/* === Color Background === */
.color-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    transition: background-color 1.5s var(--transition-smooth);
}

/* === Header === */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.title {
    font-size: clamp(1.6rem, 5vw, 2.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.6rem;
}

.subtitle {
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

/* === Color Display === */
.color-display {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    max-width: 420px;
}

/* === Big HEX Display (replaces circle swatch) === */
.hex-display {
    text-align: center;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.hex-big {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 10vw, 5.5rem);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1;
    transition: opacity 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.hex-display:hover .hex-big {
    opacity: 0.8;
}

/* === Color Type Badge === */
.color-type-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 0.25rem;
}

.color-type-badge-label {
    font-weight: 500;
}

.color-type-badge-value {
    font-weight: 600;
    color: var(--text-secondary);
}

/* === Language Toggle === */
.lang-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    z-index: 10;
}

.lang-toggle:hover {
    background: var(--glass-hover);
    color: var(--text-primary);
}

/* === Color Codes === */
.color-codes {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
}

.code-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.25rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
    width: 100%;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
}

.code-row:hover {
    background: var(--glass-hover);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.code-row:active {
    transform: translateY(0) scale(0.995);
}

.code-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    min-width: 3rem;
}

.code-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 400;
    flex: 1;
    color: var(--text-primary);
}

.copy-icon {
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
}

.code-row:hover .copy-icon {
    opacity: 1;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 100;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Countdown === */
.countdown {
    margin-top: 2.5rem;
    text-align: center;
    width: 100%;
    max-width: 420px;
}

.countdown-label {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 0.6rem;
}

.countdown-bar-track {
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    overflow: hidden;
}

.countdown-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 100px;
    transition: width 1s linear;
    width: 100%;
}

.countdown-seconds {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-tertiary);
    margin-top: 0.4rem;
    font-variant-numeric: tabular-nums;
}

/* === Footer === */
.footer {
    position: absolute;
    bottom: 1.5rem;
    text-align: center;
}

.footer-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.footer-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 0.8;
}

.footer-sub {
    font-size: 0.65rem;
    color: var(--text-tertiary);
    margin-top: 0.2rem;
}

.footer-legal {
    font-size: 0.6rem;
    color: var(--text-tertiary);
    margin-top: 0.5rem;
}

.footer-legal-link {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-legal-link:hover {
    color: var(--text-secondary);
}

.footer-dot {
    margin: 0 0.4rem;
    opacity: 0.5;
}

/* === SEO Hidden Content === */
.seo-content {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* === Dark text mode (for light background colors) === */
body.dark-text {
    --text-primary: rgba(0, 0, 0, 0.85);
    --text-secondary: rgba(0, 0, 0, 0.55);
    --text-tertiary: rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-hover: rgba(0, 0, 0, 0.09);
}

body.dark-text .toast {
    background: rgba(255, 255, 255, 0.9);
    color: #000;
}

body.dark-text .countdown-bar {
    background: rgba(0, 0, 0, 0.35);
}

body.dark-text .countdown-bar-track {
    background: rgba(0, 0, 0, 0.06);
}

body.dark-text .code-row:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

/* === Responsive === */
@media (max-width: 480px) {
    .app {
        padding: 1.5rem 1.25rem;
    }

    .code-row {
        padding: 0.7rem 1rem;
    }

    .code-value {
        font-size: 0.82rem;
    }

    .footer {
        bottom: 1rem;
    }
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.header {
    animation: fadeIn 0.6s ease-out;
}

.color-display {
    animation: fadeIn 0.6s ease-out 0.1s both;
}

.countdown {
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.footer {
    animation: fadeIn 0.6s ease-out 0.3s both;
}

/* === Print === */
@media print {
    .color-bg { display: none; }
    .countdown { display: none; }
    body { background: white; color: black; }
}
