/* https://rsms.me/inter/lab/?feat-frac=1&feat-kern=1&feat-salt=1&feat-ss01=1&feat-ss02=1&feat-tnum=1&feat-zero=1 */

@font-face {
    font-family: "Inter";
    src: url("fonts/InterVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@layer theme {
    :root {
        color-scheme: light dark;

        --background: light-dark(#fff, #09090b);
        --foreground: light-dark(#09090b, #fafafa);
        --card: light-dark(#fff, #18181b);
        --card-foreground: light-dark(#09090b, #fafafa);
        --primary: light-dark(#574747, #fafafa);
        --primary-foreground: light-dark(#fafafa, #18181b);
        --secondary: light-dark(#f4f4f5, #27272a);
        --secondary-foreground: light-dark(#574747, #fafafa);
        --muted: light-dark(#f4f4f5, #27272a);
        --muted-foreground: light-dark(#71717a, #a1a1aa);
        --faint: light-dark(#fafafa, #1e1e21);
        --faint-foreground: light-dark(#a1a1aa, #71717a);
        --accent: light-dark(#f4f4f5, #27272a);
        --danger: light-dark(#d32f2f, #f4807b);
        --danger-foreground: light-dark(#fafafa, #18181b);
        --success: light-dark(#008032, #6cc070);
        --success-foreground: light-dark(#fafafa, #18181b);
        --warning: light-dark(#a65b00, #f0a030);
        --warning-foreground: #09090b;
        --border: light-dark(#d4d4d8, #52525b);
        --input: light-dark(#d4d4d8, #52525b);
        --ring: light-dark(#574747, #d4d4d8);

        /* ==================== */
        --space-1: 0.25rem;
        --space-2: 0.5rem;
        --space-3: 0.75rem;
        --space-4: 1rem;
        --space-5: 1.25rem;
        --space-6: 1.5rem;
        --space-8: 2rem;
        --space-10: 2.5rem;
        --space-12: 3rem;
        --space-14: 3.5rem;
        --space-16: 4rem;
        --space-18: 4.5rem;

        --radius-small: 0.125rem;
        --radius-medium: 0.375rem;
        --radius-large: 0.75rem;
        --radius-full: 9999px;

        --bar-height: 0.5rem;

        --font-sans: "Inter", system-ui, sans-serif;
        --font-mono: ui-monospace, Consolas, monospace;

        --text-1: clamp(1.75rem, 1.5rem + 1.1vw, 2.25rem);
        --text-2: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
        --text-3: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
        --text-4: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
        --text-5: 1.125rem;
        --text-6: 1rem;
        --text-7: 0.875rem;
        --text-8: 0.75rem;
        --text-regular: var(--text-6);

        --leading-normal: 1.5;

        --font-normal: 400;
        --font-medium: 500;
        --font-semibold: 600;
        --font-bold: 600;

        --shadow-small: 0 1px 2px 0 rgb(0 0 0 / 0.05);
        --shadow-medium: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
        --shadow-large: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

        --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
        --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);

        --z-dropdown: 50;
        --z-modal: 200;

        .icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 16px;
            height: 16px;
        }

        .icon svg {
            width: 100%;
            height: 100%;
            fill: var(--foreground);
        }
    }

    /* override for manual toggle */
    [data-theme="light"] {
        color-scheme: light;
    }

    [data-theme="dark"] {
        color-scheme: dark;
    }
}

/* ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace */
:root {
    font-family: "Inter", sans-serif;
    font-feature-settings:
        "liga" 1,
        "calt" 1,
        /* ligatures */ "frac" 1,
        /* contextual alternates */ "kern" 1,
        /* fractions */ "salt" 1,
        /* kerning */ "ss01" 1,
        /* stylistic alternates */ "ss02" 1,
        /* stylistic set 1 */ "tnum" 1,
        /* stylistic set 2 */ "zero" 1; /* tabular numbers */ /* slashed zero */
}

* {
    box-sizing: border-box;
}
/* body { */
/* max-width: fit-content; */
/* margin-left: auto; */
/* margin-right: auto; */
/* background-color: rgba(0, 0, 0, 0.890); */
/* color: white; */
/* } */

html {
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

body {
    background-color: var(--background);
    color: var(--foreground);
}

a:link {
    color: oklch(0.55 0.04 257);
    text-decoration: none;
}

a:visited {
    color: oklch(0.49 0.03 210);
    text-decoration: none;
}

a:hover {
    color: oklch(0.6 0.13 163);
    text-decoration: underline;
}

a:active {
    color: oklch(0.65 0.22 16);
    text-decoration: wavy;
}

img,
picture,
video,
canvas,
svg {
    max-width: 100%;
}

p {
    line-height: 1.5;
}

.container {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}

.media {
    max-width: 35rem;
    /* max-width: fit-content; */
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    img {
        width: 100%;
        height: auto;
    }
}

.post {
    border-bottom: 1px solid transparent;
    position: relative;
    /* padding-inline: 1rem; */
    header {
        div {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            padding-inline: 1rem;
            gap: 1rem;
        }
        h2 {
            margin-bottom: 0px;
        }
        time {
            font-size: small;
            white-space: nowrap;
            flex-shrink: 0;
        }
        p {
            font-style: italic;
            font-size: small;
            padding-inline: 1em;
        }
    }
}

.post:hover {
    border-bottom: 1px solid var(--border);
    transition: border-bottom var(--transition-fast);
}

.post-title::after {
    content: "";
    position: absolute;
    inset: 0;
}

nav {
    /* max-width: fit-content; */
    /* margin-left: auto; */
    display: flex;
    align-items: center;
    a {
        padding: 5px;
    }
    a:first-child {
        margin-right: auto;
    }
}

.links {
    padding-left: 1rem;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2em 1em;

    div {
        color: var(--background);
    }
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: calc(var(--space-1) / 2) var(--space-1);
    background-color: var(--faint);
    border-radius: var(--radius-small);
}

pre {
    font-family: var(--font-mono);
    padding: var(--space-4);
    background-color: var(--faint);
    border-radius: var(--radius-medium);
    overflow-x: auto;
    margin-block-end: var(--space-4);

    code {
        padding: 0;
        background: none;
        border-radius: 0;
    }
}

.giallo {
    margin: 1em;
}

blockquote {
    border-inline-start: 4px solid var(--border);
    padding-inline-start: var(--space-4);
    margin: var(--space-4) 0;
    color: var(--muted-foreground);
    font-style: italic;
}

mark {
    background-color: rgb(from var(--warning) r g b / 0.3);
    padding: calc(var(--space-1) / 2) var(--space-1);
    border-radius: var(--radius-small);
}

/* timeline */

.timeline {
    width: 100%;
    margin: var(--space-4) 0;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.timeline-ruler {
    display: grid;
    grid-template-columns: repeat(32, minmax(0, 1fr));
    margin-bottom: 8px;
}

.timeline-tick {
    border: 1px solid var(--border);
    text-align: center;
    padding: var(--space-1) 0;
    font-size: 0.6rem;
    background: var(--background);
}

.timeline-track {
    display: grid;
    grid-template-columns: repeat(32, minmax(0, 1fr));
    min-height: var(--space-8);
    margin-bottom: var(--space-1);
}

.timeline-segment {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: var(--space-4);

    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);

    background: var(--secondary);
    color: var(--foreground);

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    font-size: var(--text-7);
}

.timeline-segment.first {
    border-left: 1px solid var(--border);
}

.timeline-major-ruler {
    display: grid;
    grid-template-columns: repeat(32, 1fr);
    margin-bottom: 2px;
}
.timeline-major-ruler > div {
    border: 1px solid var(--border);
    text-align: center;
    padding: var(--space-1) 0;
    font-size: 0.6rem;
    background: var(--background);
}
.timeline-major-ruler > div:nth-child(1) {
    grid-column: 1;
}
.timeline-major-ruler > div:nth-child(2) {
    grid-column: 11;
}
.timeline-major-ruler > div:nth-child(3) {
    grid-column: 21;
}
.timeline-major-ruler > div:nth-child(4) {
    grid-column: 31;
}

table th,
table td {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}
