/* ==========================================================
   RIFTMAKER
   ========================================================== */

/* ---- Registered Color Properties ---- */
/* Enables smooth interpolation of CSS custom properties     */
/* during theme transitions. Without registration, browsers  */
/* treat custom property changes as discrete (instant) swaps */

@property --color-bg {
    syntax: '<color>';
    inherits: true;
    initial-value: #0a0a0c;
}

@property --color-bg-deep {
    syntax: '<color>';
    inherits: true;
    initial-value: #070709;
}

@property --color-border {
    syntax: '<color>';
    inherits: true;
    initial-value: #1a1a1f;
}

@property --color-dim {
    syntax: '<color>';
    inherits: true;
    initial-value: #4a4a56;
}

@property --color-muted {
    syntax: '<color>';
    inherits: true;
    initial-value: #6a6a78;
}

@property --color-body {
    syntax: '<color>';
    inherits: true;
    initial-value: #9090a0;
}

@property --color-strong {
    syntax: '<color>';
    inherits: true;
    initial-value: #cdcdd6;
}

:root {

    /* Color */
    --color-bg: #0a0a0c;
    --color-bg-deep: #070709;
    --color-border: #1a1a1f;
    --color-dim: #4a4a56;
    --color-muted: #6a6a78;
    --color-body: #9090a0;
    --color-strong: #cdcdd6;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4.5rem;

    /* Typography */
    --font: 'IBM Plex Mono', monospace;

    --text-xs: 0.6rem;
    --text-sm: 0.7rem;
    --text-base: 0.8rem;
    --text-lg: 1rem;
    --text-xl: 1.4rem;

    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;

    --leading-tight: 1.2;
    --leading-normal: 1.6;
    --leading-relaxed: 1.85;

    --tracking-normal: 0;
    --tracking-wide: 0.05em;
    --tracking-wider: 0.1em;
    --tracking-widest: 0.18em;

    /* Border */
    --border-width: 1px;

    /* Scrollbar */
    --scrollbar-width: 6px;
    --scrollbar-track: var(--color-bg);
    --scrollbar-thumb: var(--color-border);
    --scrollbar-thumb-hover: var(--color-dim);

    /* Transition */
    --duration: 200ms;
    --duration-theme: 400ms;
    --ease: ease;

    /* Layout */
    --container-width: 580px;
}

/* ---- Light Theme ---- */

[data-theme="light"] {
    --color-bg: #eaeaee;
    --color-bg-deep: #e0e0e6;
    --color-border: #ccccd4;
    --color-dim: #9898a2;
    --color-muted: #6e6e7a;
    --color-body: #484854;
    --color-strong: #16161e;
}

/* ---- Reset ---- */

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

ul {
    list-style: none;
}

/* ---- Scrollbar ---- */

* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ---- Theme Transition ---- */

html.theme-transitioning {
    transition:
        --color-bg var(--duration-theme) ease-in-out,
        --color-bg-deep var(--duration-theme) ease-in-out,
        --color-border var(--duration-theme) ease-in-out,
        --color-dim var(--duration-theme) ease-in-out,
        --color-muted var(--duration-theme) ease-in-out,
        --color-body var(--duration-theme) ease-in-out,
        --color-strong var(--duration-theme) ease-in-out;
}

/* ---- Base ---- */

html {
    background-color: var(--color-bg);
}

body {
    font-family: var(--font);
    font-size: var(--text-base);
    font-weight: var(--weight-regular);
    line-height: var(--leading-relaxed);
    color: var(--color-body);
    background: radial-gradient(
        ellipse at 50% 40%,
        var(--color-bg) 0%,
        var(--color-bg-deep) 70%
    );
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    border-top: var(--border-width) solid var(--color-border);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Layout ---- */

.page {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3xl) var(--space-lg);
}

.container {
    max-width: var(--container-width);
    width: 100%;
    margin-block: auto;
}

/* ---- Projects ---- */

.projects {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* ---- Hero ---- */

.hero {
    margin-bottom: var(--space-2xl);
}

.hero__title {
    font-family: var(--font);
    font-size: var(--text-xl);
    font-weight: var(--weight-bold);
    color: var(--color-strong);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-sm);
}

.hero__tagline {
    font-size: var(--text-sm);
    color: var(--color-dim);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
}

/* ---- Divider ---- */

.divider {
    border: none;
    height: var(--border-width);
    background: var(--color-border);
    margin: var(--space-xl) 0;
}

/* ---- Project ---- */

.project__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-xs);
}

.project__name {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--color-strong);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    line-height: var(--leading-tight);
}

.project__status {
    font-size: var(--text-xs);
    color: var(--color-dim);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    font-weight: var(--weight-medium);
}

.project__subtitle {
    font-size: var(--text-sm);
    color: var(--color-muted);
    margin-bottom: var(--space-lg);
}

.project__description {
    color: var(--color-body);
    line-height: var(--leading-relaxed);
}

/* ---- Contact ---- */

.contact__label {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-dim);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    margin-bottom: var(--space-sm);
}

.contact__link {
    color: var(--color-body);
    font-size: var(--text-base);
    letter-spacing: var(--tracking-wide);
    text-decoration: underline;
    text-decoration-color: var(--color-border);
    text-underline-offset: 4px;
    transition: text-decoration-color var(--duration) var(--ease);
}

.contact__link:hover {
    text-decoration-color: var(--color-muted);
}

/* ---- Theme Toggle ---- */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-family: var(--font);
    font-size: var(--text-xs);
    color: var(--color-dim);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color var(--duration) var(--ease);
}

.theme-toggle:hover {
    color: var(--color-muted);
}

.theme-toggle:focus-visible {
    outline: var(--border-width) solid var(--color-dim);
    outline-offset: var(--space-xs);
}

.theme-toggle i {
    line-height: 1;
}

/* Dark mode (default): show sun + "Light" */
.theme-toggle__moon,
.theme-toggle__text--dark {
    display: none;
}

/* Light mode: show moon + "Dark" */
[data-theme="light"] .theme-toggle__sun,
[data-theme="light"] .theme-toggle__text--light {
    display: none;
}

[data-theme="light"] .theme-toggle__moon,
[data-theme="light"] .theme-toggle__text--dark {
    display: inline;
}

/* ---- Footer ---- */

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    font-size: var(--text-xs);
    color: var(--color-dim);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
    .page {
        padding: var(--space-2xl) var(--space-md);
    }

    .project__header {
        flex-direction: column;
        gap: var(--space-xs);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
    }
}
