:root {
    /* Typography */
    --font-mono:
        "Lilex", ui-monospace, "SF Mono", Menlo, Monaco, Consolas,
        "Liberation Mono", monospace;

    font-family: var(--font-mono);
    font-size: 14px;

    /* Enable all standard ligatures */
    font-variant-ligatures: common-ligatures discretionary-ligatures
        historical-ligatures contextual;

    /* Explicitly enable OpenType features */
    font-feature-settings:
        "liga" 1,
        /* Standard Ligatures */ "clig" 1,
        /* Contextual Ligatures */ "dlig" 1,
        /* Discretionary Ligatures */ "hlig" 1,
        /* Historical Ligatures */ "calt" 1; /* Contextual Alternates */

    text-rendering: optimizeLegibility;

    /* Palette */
    --tn-bg: #1a1b26;
    --tn-bg-dark: #16161e;
    --tn-bg-alt: #24283b;
    --tn-bg-highlight: #292e42;

    --tn-fg: #c0caf5;
    --tn-fg-dark: #a9b1d6;
    --tn-fg-muted: #9aa5ce;

    --tn-comment: #565f89;
    --tn-border: #414868;

    --tn-red: #f7768e;
    --tn-orange: #ff9e64;
    --tn-yellow: #e0af68;
    --tn-green: #9ece6a;
    --tn-cyan: #73daca;
    --tn-cyan-light: #b4f9f8;
    --tn-blue: #7aa2f7;
    --tn-blue-light: #7dcfff;
    --tn-teal: #2ac3de;
    --tn-purple: #bb9af7;

    /* Semantic Colors */
    --background: var(--tn-bg);
    --background-elevated: var(--tn-bg-alt);
    --background-hover: var(--tn-bg-highlight);

    --foreground: var(--tn-fg);
    --foreground-secondary: var(--tn-fg-dark);
    --foreground-muted: var(--tn-comment);

    --border: var(--tn-border);

    --primary: var(--tn-blue);
    --primary-hover: var(--tn-blue-light);

    --secondary: var(--tn-purple);
    --secondary-hover: #c7a9ff;

    --success: var(--tn-green);
    --warning: var(--tn-yellow);
    --danger: var(--tn-red);
    --info: var(--tn-cyan);

    --link: var(--tn-blue-light);
    --link-hover: var(--tn-cyan-light);

    --selection: #283457;
    --selection-text: var(--foreground);

    --focus-ring: var(--tn-blue);

    /* Code */
    --code-bg: #1f2335;
    --code-border: var(--border);

    --code-keyword: var(--tn-purple);
    --code-string: var(--tn-green);
    --code-number: var(--tn-orange);
    --code-function: var(--tn-blue);
    --code-type: var(--tn-yellow);
    --code-constant: var(--tn-cyan);
    --code-comment: var(--tn-comment);

    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.35);
    --shadow-lg: 0 10px 32px rgb(0 0 0 / 0.45);
}

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

body {
    box-sizing: border-box;
    min-height: 100vh;
    padding: 4rem 0;
    margin: 0;
    background: inherit;
    color: inherit;
}

.page-shell {
    box-sizing: border-box;
    width: 50%;
    min-height: calc(100vh - 8rem);
    margin: 0 auto;

    display: flex;
    flex-direction: row;
    align-items: stretch;

    border: solid var(--border) 1px;
}

a {
    color: var(--link);
}

a:hover {
    color: var(--link-hover);
}

::selection {
    background: var(--selection);
    color: var(--selection-text);
}

*:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 400;
    font-size: 1rem;
}

/* Main Nav */
.main-nav {
    display: flex;
    flex-direction: column;
    gap: 2rem;

    max-width: 20%;
    border-right: solid var(--border) 1px;

    padding: 1rem;
}

.main-nav-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Content */
.content {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.content > header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem;
    color: var(--foreground-muted);
    font-size: 0.75rem;
}

.content > header p {
    margin: 0;
}

.content > header time {
    white-space: nowrap;
}

.content > hr {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* Notes */
.note-header {
    display: grid;
    gap: 0.4rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.note-header h1,
.note-header p {
    margin: 0;
}

.note-header h1 {
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 500;
}

.note-header p {
    max-width: 72ch;
    color: var(--foreground-secondary);
    font-size: 0.85rem;
    line-height: 1.55;
}

.note-header time {
    color: var(--foreground-muted);
    font-size: 0.75rem;
}

.note-content {
    padding: 1rem;
    color: var(--foreground-secondary);
    line-height: 1.65;
    text-align: justify;
    overflow-wrap: break-word;
}

.about-content.note-content {
    text-align: justify;
}

.note-content > :first-child {
    margin-top: 0;
}

.note-content > :last-child {
    margin-bottom: 0;
}

.note-content h1,
.note-content h2,
.note-content h3,
.note-content h4,
.note-content h5,
.note-content h6 {
    margin: 1.6rem 0 0.75rem;
    color: var(--foreground);
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
}

.note-content h1 {
    font-size: 1.1rem;
}

.note-content h2 {
    font-size: 1.05rem;
}

.note-content h3,
.note-content h4,
.note-content h5,
.note-content h6 {
    font-size: 1rem;
}

.note-content p,
.note-content ul,
.note-content ol,
.note-content blockquote,
.note-content pre,
.note-content table,
.note-content figure {
    margin: 0 0 1rem;
}

.note-content a {
    text-decoration-color: color-mix(in srgb, var(--link) 55%, transparent);
    text-underline-offset: 0.18em;
}

.note-content a:hover {
    text-decoration-color: currentColor;
}

.note-content strong,
.note-content b {
    color: var(--foreground);
    font-weight: 500;
}

.note-content em {
    color: var(--foreground);
}

.note-content ul,
.note-content ol {
    padding-left: 1.5rem;
}

.note-content li {
    margin: 0.35rem 0;
}

.note-content li::marker {
    color: var(--primary);
}

.note-content blockquote {
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-left: 3px double var(--foreground-muted);
    background: var(--background-elevated);
    color: var(--foreground-secondary);
    text-align: justify;
}

.note-content blockquote p {
    margin-bottom: 0.75rem;
}

.note-content blockquote > :last-child {
    margin-bottom: 0;
}

.note-content code {
    padding: 0.08rem 0.35rem;
    border: 1px solid var(--code-border);
    background: var(--code-bg);
    color: var(--foreground);
    font-size: 0.9em;
}

.note-content pre {
    position: relative;
    overflow-x: auto;
    padding: 1rem 1.1rem;
    border: 1px solid var(--code-border);
    border-left: 3px double var(--foreground-muted);
    background: var(--code-bg);
    color: var(--foreground);
    line-height: 1.55;
    text-align: left;
    tab-size: 4;
}

.note-content pre code {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: 1em;
    white-space: pre;
    box-shadow: none;
}

.note-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    text-align: left;
}

.note-content th,
.note-content td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
}

.note-content th {
    background: var(--background-elevated);
    color: var(--foreground);
    font-weight: 500;
}

.note-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.note-content hr {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

.note-pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
}

.note-pagination a {
    text-decoration: none;
}

.note-pagination-prev {
    margin-right: auto;
}

.note-pagination-next {
    margin-left: auto;
}

.note-list {
    display: flex;
    flex-direction: column;
}

.note-preview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition:
        background-color 120ms ease,
        box-shadow 120ms ease;
    text-decoration: none;
}

.note-preview:hover {
    background-color: var(--background-hover);
    box-shadow: inset 2px 0 0 var(--primary);
}

.note-preview-title {
    min-width: 0;
}

.note-preview-title h1,
.note-preview-title h2,
.note-preview-date {
    margin: 0;
}

.note-preview-title h1 {
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 400;
}

.note-preview-title h2 {
    margin-top: 0.25rem;
    color: var(--foreground-muted);
    font-size: 0.75rem;
    font-weight: 400;
}

.note-preview-date {
    justify-self: end;
    text-align: right;
    color: var(--foreground-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Typography */
/* Regular */
@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-Regular.ttf")
        format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* Italic */
@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-Italic.ttf")
        format("truetype");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* Extra Light */
@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-ExtraLight.ttf")
        format("truetype");
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-ExtraLightItalic.ttf")
        format("truetype");
    font-weight: 200;
    font-style: italic;
    font-display: swap;
}

/* Medium */
@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-Medium.ttf")
        format("truetype");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-MediumItalic.ttf")
        format("truetype");
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

/* Bold */
@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-Bold.ttf")
        format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Lilex";
    src: url("/static/fonts/lilex/LilexNerdFontMono-BoldItalic.ttf")
        format("truetype");
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
