/* ——— system ——— */

:root {
    color-scheme: dark;
    interpolate-size: allow-keywords;

    --fg: light-dark(oklch(0.15 0 0), oklch(0.9 0 0));
    --bg: light-dark(oklch(0.98 0 0), oklch(0.1 0 0));
    --surface: light-dark(oklch(0.96 0 0), oklch(0.14 0 0));
    --mid: light-dark(oklch(0.53 0 0), oklch(0.65 0 0));
    --border: light-dark(oklch(0.9 0 0), oklch(0.22 0 0));
    --accent: light-dark(oklch(0.55 0.2 250), oklch(0.7 0.15 250));

    --radius: 6px;
    --font: system-ui, -apple-system, sans-serif;
    --mono: ui-monospace, 'SF Mono', monospace;
    --measure: 60ch;

    --ease: cubic-bezier(0.2, 0, 0, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --fast: 0.12s;
    --duration: 0.15s;
}

/* ——— reset ——— */

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

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    hanging-punctuation: first last;
    scroll-behavior: smooth;
    scrollbar-color: var(--border) transparent;
    scrollbar-width: thin;
    /* Prevent iOS tap delay on entire document */
    touch-action: manipulation;
}

/* view transitions */
@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: 0.15s var(--ease) both fade-out;
}

::view-transition-new(root) {
    animation: 0.15s var(--ease) both fade-in;
}

@keyframes fade-out {
    to {
        opacity: 0;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

/* selection */
::selection {
    background: oklch(from var(--fg) l c h / 0.15);
}

/* focus defaults */
:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px;
    border-radius: 2px;
}

/* media defaults */
img,
video,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ——— base ——— */

body {
    font: 400 1rem/1.6 var(--font);
    color: var(--fg);
    background: var(--bg);
    max-width: var(--measure);
    margin-inline: auto;
    padding-block: 2rem;
    padding-inline: max(1.5rem, env(safe-area-inset-left));
    /* Only transition colors if toggled via class, light-dark() handles OS changes instantly */
    transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}

.body-narrow {
    max-width: 360px;
}

.body-mid {
    max-width: 640px;
}

.body-wide {
    max-width: 720px;
}

.body-max {
    max-width: 960px;
}

.body-full {
    max-width: none;
    padding: 0;
}

.page-center {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ——— type ——— */

h1,
h2,
h3 {
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-top: 2em;
    margin-bottom: 0.5em;
    text-wrap: balance;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
}

p,
ul,
ol,
pre,
blockquote,
table,
details {
    margin-bottom: 1.25em;
}

p {
    text-wrap: pretty;
}

ul,
ol {
    padding-left: 1.25em;
}

li+li {
    margin-top: 0.25em;
}

li::marker {
    color: var(--mid);
}

small,
.muted {
    color: var(--mid);
    font-size: 0.875rem;
}

kbd {
    font: 0.8125em/1 var(--mono);
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0.1em 0.4em;
}

mark {
    background: light-dark(oklch(0.92 0.05 85), oklch(0.35 0.05 85));
    color: inherit;
    padding: 0.05em 0.2em;
    border-radius: 2px;
}

a {
    color: inherit;
    text-underline-offset: 3px;
    text-decoration-color: var(--mid);
    transition: text-decoration-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

a:hover {
    text-decoration-color: transparent;
}

strong {
    font-weight: 600;
}

/* ——— code ——— */

code {
    font: 0.875em/1 var(--mono);
    background: var(--surface);
    padding: 0.15em 0.35em;
    border-radius: var(--radius);
}

pre {
    overflow-x: auto;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    tab-size: 2;
}

pre code {
    background: none;
    padding: 0;
    line-height: inherit;
}

/* ——— rule & quote ——— */

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

blockquote {
    border-left: 2px solid var(--border);
    padding-left: 1rem;
    color: var(--mid);
}

/* ——— inputs ——— */

input,
textarea,
select,
button {
    font-family: inherit;
    /* Force 16px (1rem) minimum to prevent iOS zoom bug on focus */
    font-size: max(1rem, inherit);
    color: inherit;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: 0.5em 0.75em;
    border-radius: var(--radius);
    accent-color: var(--fg);
    outline: none;
    transition: border-color var(--fast) var(--ease),
        box-shadow var(--fast) var(--ease),
        background var(--fast) var(--ease),
        transform var(--fast) var(--spring),
        opacity var(--fast) var(--ease);
}

::placeholder {
    color: var(--mid);
    opacity: 1;
}

input:autofill {
    background: var(--bg) !important;
    color: var(--fg) !important;
    -webkit-text-fill-color: var(--fg);
    box-shadow: 0 0 0 100px var(--bg) inset;
}

select {
    appearance: base-select;
    cursor: pointer;
}

select::picker(select) {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    padding: 0.25em 0;
    box-shadow: 0 4px 16px oklch(0 0 0 / 0.08);
}

select option {
    color: var(--fg);
    background: var(--bg);
    padding: 0.4em 0.75em;
    transition: background var(--fast) var(--ease);
}

select option:hover {
    background: color-mix(in srgb, var(--fg) 6%, transparent);
}

select option:checked {
    font-weight: 500;
}

textarea {
    field-sizing: content;
    min-height: 3lh;
    resize: vertical;
}

/* form group focus */
.field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field:focus-within label {
    color: var(--fg);
}

.field label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--mid);
    transition: color var(--fast) var(--ease);
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--fg);
    box-shadow: 0 0 0 1px var(--fg);
}

/* ——— buttons ——— */

button,
[type="submit"] {
    cursor: pointer;
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
    font-weight: 500;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
}

button:hover {
    opacity: 0.85;
}

button:active {
    transform: scale(0.98);
    opacity: 0.9;
    transition-duration: 0.05s;
    /* Snappy active state */
}

button:focus-visible {
    border-radius: var(--radius);
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--fg);
    outline: none;
}

button.ghost {
    background: transparent;
    color: var(--fg);
    border-color: transparent;
}

button.ghost:hover {
    background: color-mix(in srgb, var(--fg) 6%, transparent);
    opacity: 1;
}

button.ghost:active {
    background: color-mix(in srgb, var(--fg) 10%, transparent);
}

:disabled,
[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ——— table ——— */

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th,
td {
    padding: 0.5em 0.75em;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--mid);
    white-space: nowrap;
}

td {
    font-variant-numeric: tabular-nums;
}

tbody tr {
    transition: background var(--fast) var(--ease);
}

tbody tr:hover {
    background: color-mix(in srgb, var(--fg) 4%, transparent);
}

/* ——— details ——— */

details>summary {
    cursor: pointer;
    font-weight: 500;
    transition: color var(--fast) var(--ease);
    border-radius: 2px;
}

details>summary:hover {
    color: var(--mid);
}

details[open]>summary {
    margin-bottom: 0.75em;
}

::details-content {
    height: 0;
    overflow: clip;
    opacity: 0;
    transition: height var(--duration) var(--ease),
        opacity var(--duration) var(--ease),
        content-visibility var(--duration) allow-discrete;
}

details[open]::details-content {
    height: auto;
    opacity: 1;
}

@starting-style {
    details[open]::details-content {
        height: 0;
        opacity: 0;
    }
}

/* ——— utilities ——— */

.row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.items-center {
    align-items: center;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.surface {
    background: var(--surface);
    padding: 1rem;
    border-radius: var(--radius);
}

.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

.max-w-xs {
    max-width: 240px;
}

.max-w-sm {
    max-width: 320px;
}

.min-w-0 {
    min-width: 0;
}

/* Fixes flex child overflow */
.shrink-0 {
    flex-shrink: 0;
}

.items-center {
    align-items: center;
}

.m-0 {
    margin: 0;
}

.mt-xs {
    margin-top: 0.25rem;
}

.mt-sm {
    margin-top: 0.5rem;
}

.mt-md {
    margin-top: 1rem;
}

.mb-sm {
    margin-bottom: 0.75rem;
}

.mb-md {
    margin-bottom: 1.5rem;
}

.gap-0 {
    gap: 0;
}

.gap-sm {
    gap: 0.5rem;
}

.gap-md {
    gap: 1rem;
}

.gap-lg {
    gap: 1.5rem;
}

.gap-xl {
    gap: 2rem;
}

/* ——— tag ——— */

.justify-center {
    justify-content: center;
}

q,
.tag {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3em 0.8em;
    border: 1px solid var(--border);
    border-radius: 999px;
    user-select: none;
}

q::before,
q::after {
    content: '';
    display: none;
}

a q,
button q {
    cursor: pointer;
    transition: border-color var(--fast) var(--ease),
        background var(--fast) var(--ease),
        transform var(--fast) var(--spring);
}

a:hover q,
button:hover q {
    border-color: var(--mid);
    background: color-mix(in srgb, var(--fg) 4%, transparent);
    transform: translateY(-1px);
}

/* ——— loader ——— */

.loader {
    --size: 1.25em;
    width: var(--size);
    height: var(--size);
    border: 2px solid var(--border);
    border-top-color: var(--fg);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

.loader.sm {
    --size: 0.875em;
    border-width: 1.5px;
}

.loader.lg {
    --size: 2em;
    border-width: 2.5px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ——— skeleton ——— */

.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--surface) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1s linear infinite;
    border-radius: var(--radius);
    color: transparent;
    user-select: none;
    pointer-events: none;
}

.skeleton:nth-child(2n) {
    animation-duration: 0.98s;
}

.skeleton * {
    visibility: hidden;
}

@keyframes shimmer {
    50% {
        opacity: 0.8;
    }

    to {
        background-position: -200% 0;
    }
}

/* ——— toast (popover) ——— */

.toast {
    position: fixed;
    inset: auto 1rem 1.5rem auto;
    margin: 0;
    padding: 0.75em 1em;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--fg);
    font-size: 0.875rem;
    box-shadow: 0 8px 24px oklch(0 0 0 / 0.1);
    outline: none;
    max-width: min(360px, calc(100vw - 2rem));

    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--duration) var(--ease),
        transform var(--duration) var(--ease),
        overlay var(--duration) allow-discrete,
        display var(--duration) allow-discrete;
}

.toast:popover-open {
    opacity: 1;
    transform: translateY(0);
}

@starting-style {
    .toast:popover-open {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* ——— mobile nav (popover) ——— */

.nav-toggle {
    display: none;
    padding: 0.4em;
    line-height: 1;
}

.nav-drawer {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100dvh;
    width: min(280px, 80vw);
    margin: 0;
    padding: 1.5rem;
    border: none;
    border-right: 1px solid var(--border);
    background: var(--bg);
    color: var(--fg);
    overflow-y: auto;
    overscroll-behavior: contain;
    outline: none;

    opacity: 0;
    transform: translateX(-100%);
    transition: opacity var(--duration) var(--ease),
        transform var(--duration) var(--ease),
        overlay var(--duration) allow-discrete,
        display var(--duration) allow-discrete;
}

.nav-drawer:popover-open {
    opacity: 1;
    transform: translateX(0);
}

@starting-style {
    .nav-drawer:popover-open {
        opacity: 0;
        transform: translateX(-100%);
    }
}

.nav-drawer::backdrop {
    background: oklch(0 0 0 / 0);
    transition: background var(--duration) var(--ease), display var(--duration) allow-discrete;
}

.nav-drawer:popover-open::backdrop {
    background: oklch(0 0 0 / 0.3);
}

@starting-style {
    .nav-drawer:popover-open::backdrop {
        background: oklch(0 0 0 / 0);
    }
}

@media (max-width: 640px) {
    .nav-toggle {
        display: inline-flex;
    }
}

/* ——— responsive table ——— */

.responsive-table {
    position: relative;
}

.responsive-table::after {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-end: 0;
    width: 2rem;
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--fast) var(--ease);
}

.responsive-table:has(:hover)::after,
.responsive-table:has(:focus-within)::after {
    opacity: 1;
}

@media (max-width: 640px) {
    .responsive-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .responsive-table::after {
        opacity: 1;
    }

    .responsive-table table {
        min-width: 480px;
    }
}

/* ——— divider & cards ——— */

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.card:hover,
a:hover>.card {
    border-color: var(--mid);
    background: var(--surface);
}

.card :is(h1, h2, h3) {
    margin-top: 0;
    margin-bottom: 0;
}

.card p {
    margin: 0.5rem 0 0;
    max-width: var(--measure);
}

.card-link {
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius);
    display: block;
}

.card-link:focus-visible {
    outline: none;
}

.card-link:focus-visible .card {
    outline: 2px solid var(--fg);
    outline-offset: 2px;
}

/* ——— dashboard stat ——— */

.stat {
    font-variant-numeric: tabular-nums;
}

.stat strong {
    font-size: 1.25rem;
    display: block;
}

.stats {
    gap: 2rem;
    margin-bottom: 1.25rem;
}

/* ——— links ——— */

.links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.links a {
    font-size: 0.875rem;
}

/* ——— footer (landing) ——— */

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-mark {
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

@media (max-width: 480px) {
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* ——— hero ——— */

.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 6rem max(1.5rem, env(safe-area-inset-left)) 4rem;
}

.hero-landing {
    padding: clamp(5rem, 14vh, 10rem) max(1.5rem, env(safe-area-inset-left)) clamp(4rem, 10vh, 6rem);
    min-height: clamp(400px, 60vh, 600px);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: light-dark(0.12, 0.18);
    background: transparent;
}

.hero h1 {
    font-size: clamp(2.25rem, 6vw, 3.5rem);
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin: 0;
    max-width: 18ch;
}

.hero p {
    margin-top: 1.5rem;
    font-size: clamp(1rem, 2vw, 1.25rem);
    max-width: 38ch;
    line-height: 1.5;
}

.hero-links {
    margin-top: 2.5rem;
    display: flex;
    gap: 1.5rem;
}

.hero-links a {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--fg);
    padding: 0.5em 1em;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--fast) var(--ease),
        background var(--fast) var(--ease),
        transform var(--fast) var(--spring);
}

.hero-links a:hover {
    border-color: var(--mid);
    background: var(--surface);
}

.hero-links a:active {
    transform: scale(0.97);
    transition-duration: 0.05s;
}

.hero-links a svg {
    width: 14px;
    height: 14px;
    display: inline;
    flex-shrink: 0;
    transition: transform var(--fast) var(--ease);
}

.hero-links a:hover svg {
    transform: translate(1px, -1px);
}

.mark {
    width: 44px;
    height: 44px;
    margin-bottom: 2.5rem;
    opacity: 0.8;
}


/* hero entrance */

@keyframes hero-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
}

/* Disable intro animations for the canvas */
.hero>* {
    animation: none !important;
}

.hero> :nth-child(2),
.hero> :nth-child(3),
.hero> :nth-child(4),
.hero> :nth-child(5) {
    animation-delay: 0s !important;
}

/* content wrappers for full-width pages */

.body-full section,
.body-full footer {
    max-width: 960px;
    margin-inline: auto;
    padding-inline: max(1.5rem, env(safe-area-inset-left));
}

.body-full section {
    padding-block: 3.5rem;
    border-top: 1px solid var(--border);
}

.body-full footer {
    padding-block: 2.5rem;
    border-top: 1px solid var(--border);
}

/* ——— section-label ——— */

.section-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mid);
    margin-bottom: 2rem;
}

/* ——— card-featured ——— */

.card-featured {
    padding: 2.5rem;
    border-color: var(--border);
    background: var(--surface);
}

.card-featured:hover,
a:hover>.card-featured {
    border-color: var(--mid);
    background: color-mix(in srgb, var(--surface) 80%, var(--bg));
    }
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* ——— grids ——— */

.cols {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

.cols h3 {
    font-size: 0.9375rem;
    margin: 0 0 0.5rem;
}

.cols p {
    margin: 0;
}

@media (max-width: 720px) {
    .cols {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 420px) {
    .cols {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.feat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 1.25rem;
}

.feat-grid pre {
    margin: 0;
}

@media (max-width: 640px) {
    .feat-grid {
        grid-template-columns: 1fr;
    }
}

.bg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.bg-grid :is(h2, p):first-child {
    margin-top: 0;
}

.bg-grid p {
    margin-bottom: 0;
}

.bg-grid p+p {
    margin-top: 0.75rem;
}

@media (max-width: 600px) {
    .bg-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* ——— calendar ——— */

.cal-header {
    margin-bottom: 1.5rem;
}

.cal-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.cal-nav {
    gap: 0.25rem;
}

.cal-nav button {
    padding: 0.3em 0.6em;
    font-size: 0.875rem;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-dow {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--mid);
    text-align: center;
    padding: 0.5em;
    border-bottom: 1px solid var(--border);
}

.cal-day {
    aspect-ratio: 1;
    padding: 0.4em;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--fast) var(--ease);
    user-select: none;
}

.cal-day:nth-child(7n) {
    border-right: none;
}

.cal-grid>.cal-day:nth-last-child(-n+7) {
    border-bottom: none;
}

.cal-day:hover {
    background: color-mix(in srgb, var(--fg) 4%, transparent);
}

.cal-day.outside {
    color: var(--mid);
    opacity: 0.4;
}

.cal-day.today .day-num {
    background: var(--fg);
    color: var(--bg);
    border-radius: 50%;
    width: 1.6em;
    height: 1.6em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

@media (max-width: 480px) {
    .cal-day {
        aspect-ratio: auto;
        min-height: 2.5rem;
        font-size: 0.75rem;
    }

    .cal-event {
        font-size: 0;
        height: 4px;
        padding: 0;
        margin-top: 0.15em;
        min-width: 1rem;
    }

    .cal-title {
        font-size: 1.125rem;
    }

    .cal-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

.cal-event {
    display: block;
    font-size: 0.625rem;
    line-height: 1.3;
    padding: 0.1em 0.3em;
    margin-top: 0.2em;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--fast) var(--ease);
}

.cal-event:hover {
    opacity: 0.7;
}

.cal-event.blue {
    background: light-dark(oklch(0.7 0.12 240 / 0.2), oklch(0.5 0.1 240 / 0.25));
    color: light-dark(oklch(0.45 0.12 240), oklch(0.75 0.1 240));
}

.cal-event.green {
    background: light-dark(oklch(0.7 0.12 145 / 0.2), oklch(0.5 0.1 145 / 0.25));
    color: light-dark(oklch(0.4 0.12 145), oklch(0.75 0.1 145));
}

.cal-event.orange {
    background: light-dark(oklch(0.7 0.12 60 / 0.2), oklch(0.5 0.1 60 / 0.25));
    color: light-dark(oklch(0.45 0.12 60), oklch(0.75 0.1 60));
}

/* ——— agenda ——— */

.agenda {
    margin-top: 1.5rem;
}

.agenda-item {
    display: grid;
    grid-template-columns: 3.5rem 1fr;
    gap: 0.75rem;
    padding: 0.75em 0;
    border-bottom: 1px solid var(--border);
    transition: background var(--fast) var(--ease);
}

.agenda-item:last-child {
    border-bottom: none;
}

.agenda-item:hover {
    background: color-mix(in srgb, var(--fg) 3%, transparent);
}

.agenda-time {
    font-size: 0.75rem;
    color: var(--mid);
    font-variant-numeric: tabular-nums;
    padding-top: 0.15em;
}

.agenda-title {
    font-weight: 500;
    font-size: 0.875rem;
}

.agenda-desc {
    font-size: 0.75rem;
    color: var(--mid);
}

/* ——— dashboard ——— */

.shell {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    min-height: 100dvh;
}

@media (max-width: 640px) {
    .shell {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    border-right: 1px solid var(--border);
    padding-right: 2rem;
}

@media (max-width: 640px) {
    .sidebar {
        display: none;
    }
}

.nav {
    list-style: none;
    padding: 0;
}

.nav li a {
    display: block;
    padding: 0.35em 0.6em;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background var(--fast) var(--ease);
}

.nav li a:hover {
    background: color-mix(in srgb, var(--fg) 5%, transparent);
}

.nav li a.active {
    font-weight: 600;
    background: color-mix(in srgb, var(--fg) 8%, transparent);
}

.nav-drawer .nav {
    margin-bottom: 0;
}

.nav-drawer .nav li a {
    padding: 0.5em 0.6em;
    font-size: 1rem;
}

.nav-drawer hr {
    margin: 1rem 0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: border-color var(--fast) var(--ease);
}

.stat-card:hover {
    border-color: var(--mid);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--mid);
    margin-top: 0.25rem;
}

.stat-delta {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.up {
    color: oklch(0.55 0.15 145);
}

.down {
    color: oklch(0.55 0.15 25);
}

.bars {
    display: flex;
    align-items: end;
    gap: 3px;
    height: 48px;
}

.bar {
    flex: 1;
    background: var(--border);
    border-radius: 2px 2px 0 0;
    transition: background var(--fast) var(--ease);
    min-width: 4px;
}

.bar:hover {
    background: var(--fg);
}

.main h1 {
    margin-top: 0;
}

.main h2 {
    margin-top: 1.5em;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.or-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--mid);
    font-size: 0.8125rem;
}

.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border);
}

.link-row {
    font-size: 0.8125rem;
    text-align: center;
}

button.oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
}

/* ——— prose ——— */

.prose>*+* {
    margin-top: 1.25em;
}

.prose :is(h1, h2, h3) {
    margin-top: 2em;
}

.prose :is(h1, h2, h3)+* {
    margin-top: 0.5em;
}

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

/* ——— print ——— */

@media print {

    *,
    *::before,
    *::after {
        background: transparent !important;
        box-shadow: none !important;
    }

    body {
        color: black;
        max-width: none;
        padding: 1cm;
        font-size: 11pt;
        line-height: 1.5;
    }

    .hero {
        padding: 2rem 0;
    }

    a {
        text-decoration: underline;
    }

    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #555;
        word-break: break-all;
    }

    .nav-toggle,
    .nav-drawer,
    .loader,
    .skeleton {
        display: none !important;
    }

    .card,
    pre,
    blockquote,
    img {
        break-inside: avoid;
    }

    h1,
    h2,
    h3 {
        break-after: avoid;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media (hover: none) {

    /* Prevent sticky hover states on touch devices */
    button:hover {
        opacity: 1;
    }

    button.ghost:hover {
        background: transparent;
    }

    tbody tr:hover {
        background: transparent;
    }
}