/* dekai.me — one warm-white sheet, ink, and a single orange moment.
   Measured off cursor.com/blog: 1440 sheet, 70px gutters, a 645px column
   that sits off-centre at x=398 with a 328px rail to its left. */

:root {
    --bg: #F7F7F4;
    --ink: #26251E;
    --muted: rgba(38, 37, 30, .5);
    --box: #F2F1ED;
    --box-deep: #EAE9E4;
    --line: rgba(38, 37, 30, .08);
    --line-strong: rgba(38, 37, 30, .16);
    --accent: #F54E00;

    --gutter: 70px;
    --rail: 328px;
    --col: 645px;

    --nav: rgba(247, 247, 244, .86);
    --live: #2F9E5B;

    /* Pencil drawings sit on the sheet by multiplying; after dark they are
       inverted and screened, so graphite becomes chalk. */
    --sketch-blend: multiply;
    --sketch-filter: none;

    --font: "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* The same sheet after dark: ink and ground swap, the boxes lift a step,
   the one orange stays. Chosen explicitly, or inherited from the system. */

:root[data-theme="dark"] {
    --bg: #161615;
    --ink: #E9E8E3;
    --muted: rgba(233, 232, 227, .5);
    --box: #1F1F1D;
    --box-deep: #272725;
    --line: rgba(233, 232, 227, .08);
    --line-strong: rgba(233, 232, 227, .18);
    --nav: rgba(22, 22, 21, .86);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #161615;
        --ink: #E9E8E3;
        --muted: rgba(233, 232, 227, .5);
        --box: #1F1F1D;
        --box-deep: #272725;
        --line: rgba(233, 232, 227, .08);
        --line-strong: rgba(233, 232, 227, .18);
        --nav: rgba(22, 22, 21, .86);
        --sketch-blend: screen;
        --sketch-filter: invert(1) hue-rotate(180deg) brightness(.9);
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 24px;
    letter-spacing: .005em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

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

h1,
h2,
h3,
p,
figure,
pre,
ul,
ol,
dl {
    margin: 0;
}

img,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

code,
samp,
pre {
    font-family: var(--mono);
}

.muted {
    color: var(--muted);
}

/* Nav ------------------------------------------------------------------ */

.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 var(--gutter);
    background: var(--nav);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 14px;
    line-height: 20px;
    font-weight: 500;
}

.nav a {
    text-decoration: none;
}

.nav .mark {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: .04em;
}

/* The frog takes the ink colour, so it survives dark mode. */
.nav .mark .frog {
    width: 31px;
    height: 20px;
    background: currentColor;
    -webkit-mask: url(logos/frog.svg) no-repeat center / contain;
    mask: url(logos/frog.svg) no-repeat center / contain;
}

.nav .links {
    display: flex;
    gap: 32px;
}

.nav .links a:hover {
    color: var(--muted);
}

.nav .actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav .actions>a {
    padding: 0 6px;
}

.pill {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 12px !important;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
}

.pill.dark {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--bg);
}

.pill.dark:hover {
    background: #000;
}

/* The offset column ---------------------------------------------------- */

.sheet {
    display: grid;
    grid-template-columns: var(--rail) var(--col);
    padding-left: var(--gutter);
}

.rail {
    color: var(--muted);
}

.rail.ink {
    color: var(--ink);
}

/* Post ----------------------------------------------------------------- */

.post {
    padding-top: 115px;
}

.post .date,
.post .read {
    color: var(--muted);
}

.post h1 {
    font-size: 36px;
    line-height: 43px;
    font-weight: 400;
    letter-spacing: -.02em;
    margin: 6px 0 4px;
}

.post .read {
    margin-bottom: 50px;
}

.toc {
    background: var(--box);
    border-radius: 4px;
    padding: 14px 16px 16px;
    font-size: 14px;
    line-height: 22px;
}

.toc .head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--muted);
    line-height: 20px;
    padding-bottom: 4px;
}

.toc ol {
    list-style: none;
    padding: 0;
}

.toc a {
    text-decoration: none;
}

.toc a:hover {
    text-decoration: underline;
}

.body {
    padding-top: 56px;
}

.body>p {
    margin-bottom: 24px;
}

.body h2 {
    font-size: 22px;
    line-height: 29px;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 44px 0 11px;
}

.body h2:first-child {
    margin-top: 0;
}

.body strong {
    font-weight: 700;
}

/* Media */

figure {
    margin: 34px 0 24px;
}

.plate {
    position: relative;
    border-radius: 4px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: #000;
    aspect-ratio: 16 / 9;
}

.plate.wide {
    aspect-ratio: 1880 / 566;
    background: var(--box);
}

.plate>img,
.plate>video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

figcaption {
    margin-top: 10px;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}

figcaption samp {
    font-size: 12px;
    color: var(--ink);
}

.pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 13px;
}

/* Boxes — the grey plates Cursor uses for charts */

.box {
    background: var(--box);
    border-radius: 4px;
    padding: 28px 32px 30px;
    margin: 24px 0;
}

.box .title {
    font-weight: 700;
    line-height: 22px;
    margin-bottom: 18px;
}

.rows {
    display: flex;
    flex-direction: column;
}

.rows>div {
    display: grid;
    grid-template-columns: 104px 1fr auto;
    gap: 0 12px;
    align-items: start;
    padding: 9px 0;
    border-bottom: 1px solid rgba(38, 37, 30, .10);
    font-size: 14px;
    line-height: 20px;
}

.rows>div:last-child {
    border-bottom: 0;
}

.rows dt {
    color: var(--muted);
}

.rows dd {
    margin: 0;
}

.rows .out {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 16px;
    color: var(--muted);
    padding-top: 2px;
    white-space: nowrap;
}

.rows .on dt,
.rows .on dd,
.rows .on .out {
    color: var(--ink);
    font-weight: 700;
}

.rows .on .out {
    font-weight: 400;
}

.rows.constants>div {
    grid-template-columns: 180px 1fr;
}

.rows.constants dt {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 20px;
    color: var(--ink);
}

.rows.checks>div {
    grid-template-columns: 120px 1fr;
    padding: 10px 0 12px;
}

.rows.checks dt {
    font-family: var(--mono);
    font-size: 12px;
    line-height: 20px;
}

.rows.checks dt.on {
    color: var(--accent);
}

.rows.checks dd p {
    margin: 0;
}

.rows.checks samp {
    display: block;
    font-size: 12px;
    line-height: 18px;
    color: var(--muted);
    margin-top: 2px;
}

/* Matrix — the comparison, kept to one box */

.matrix {
    display: grid;
    grid-template-columns: 1.1fr 1fr 1.4fr;
    font-size: 13px;
    line-height: 18px;
}

.matrix>span {
    padding: 8px 12px 8px 0;
    border-bottom: 1px solid rgba(38, 37, 30, .10);
}

.matrix .h {
    color: var(--muted);
    font-size: 12px;
    padding-top: 0;
}

.matrix .mine {
    font-weight: 700;
    border-bottom: 0;
}

/* Code */

pre {
    border-radius: 4px;
    padding: 20px 24px;
    font-size: 12.5px;
    line-height: 19px;
    overflow-x: auto;
    margin: 24px 0;
}

pre.transcript {
    background: var(--box);
}

pre.transcript .bad {
    color: var(--accent);
}

pre.transcript .ok {
    font-weight: 700;
}

pre.shell {
    background: #26251E;
    color: #F7F7F4;
    font-size: 13px;
    line-height: 20px;
    padding: 18px 22px;
}

pre.shell .said {
    color: rgba(247, 247, 244, .55);
}

.end::after {
    content: " \25A0";
    color: var(--accent);
}

.filed {
    padding-top: 16px;
    font-size: 14px;
    line-height: 22px;
}

.filed .muted {
    display: block;
}

/* Related ---------------------------------------------------------------- */

.related {
    padding-top: 120px;
    padding-bottom: 120px;
}

.cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card {
    display: block;
    background: var(--box);
    border-radius: 4px;
    padding: 18px 20px 20px;
    text-decoration: none;
}

.card:hover {
    background: var(--box-deep);
}

.card .meta {
    display: block;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}

.card .meta.after {
    padding-top: 8px;
}

.card .name {
    display: block;
}

.more {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    padding-top: 12px;
}

.more:hover {
    text-decoration: underline;
}

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

.foot {
    background: var(--box);
    padding: 70px var(--gutter) 40px;
    font-size: 14px;
    line-height: 20px;
}

.foot .cols {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 24px;
}

.foot .cols div {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.foot .cols b {
    font-weight: 400;
    color: var(--muted);
}

.foot a {
    text-decoration: none;
}

.foot a:hover {
    text-decoration: underline;
}

.foot .bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 80px;
    color: var(--muted);
}

.foot .bottom .pill {
    height: 28px;
    font-size: 13px;
    color: var(--ink);
}

.foot .bottom .right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Theme switch — the three-state pill from Cursor's footer */

.switch {
    display: flex;
    align-items: center;
    height: 28px;
    padding: 0 3px;
    gap: 2px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
}

.switch button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

.switch button svg {
    width: 12px;
    height: 12px;
}

.switch button[aria-pressed="true"] {
    background: var(--ink);
    color: var(--bg);
}

/* Masthead — face, name, and where I am right now */

.who {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.face {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    object-fit: cover;
    flex-shrink: 0;
}

.face.sm {
    width: 22px;
    height: 22px;
    vertical-align: -6px;
    margin-right: 6px;
    display: inline-block;
}

.mast .who h1 {
    margin: 0;
}

.now {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 12px 0 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-size: 14px;
    line-height: 20px;
    margin-bottom: 30px;
}

.now .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--live);
    box-shadow: 0 0 0 3px rgba(47, 158, 91, .18);
}

.now samp {
    font-size: 13px;
}

/* Work tiles — three plates across the column */

.tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.tile {
    display: flex;
    flex-direction: column;
    background: var(--box);
    border-radius: 4px;
    border: 1px solid rgba(38, 37, 30, .06);
    overflow: hidden;
    text-decoration: none;
}

.tile:hover {
    background: var(--box-deep);
}

.tile .shot {
    display: block;
    aspect-ratio: 203 / 127;
    background: #000 center top / cover no-repeat;
}

.tile .name {
    display: block;
    padding: 12px 14px 0;
    line-height: 22px;
}

.tile .sub {
    display: block;
    padding: 2px 14px 14px;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
}

/* Pencil drawings — a frog in the margin, a postcard above the footer */

.mast {
    position: relative;
}

.marginalia {
    position: absolute;
    top: 96px;
    right: var(--gutter);
    width: 320px;
    pointer-events: none;
    user-select: none;
    mix-blend-mode: var(--sketch-blend);
    filter: var(--sketch-filter);
    -webkit-mask-image: radial-gradient(ellipse 60% 60% at 50% 55%, #000 55%, transparent 100%);
    mask-image: radial-gradient(ellipse 60% 60% at 50% 55%, #000 55%, transparent 100%);
}

/* The glyph field: ascii.js draws into it in the page's ink. */

.ascii {
    position: relative;
    height: 560px;
    overflow: hidden;
    color: var(--ink);
    background: var(--bg);
    cursor: crosshair;
    -webkit-mask-image: linear-gradient(to bottom, #000 82%, transparent);
    mask-image: linear-gradient(to bottom, #000 82%, transparent);
}

.ascii.band {
    height: 420px;
    -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%);
    mask-image: linear-gradient(to bottom, transparent, #000 30%);
}

.ascii canvas {
    display: block;
}

.ascii .fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 72%;
    mix-blend-mode: var(--sketch-blend);
    filter: var(--sketch-filter);
}

.ascii.live .fallback {
    display: none;
}

.mast.after-hero {
    padding-top: 40px;
}

.postcard {
    position: relative;
    height: 440px;
    overflow: hidden;
}

.postcard img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 72%;
    mix-blend-mode: var(--sketch-blend);
    filter: var(--sketch-filter);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 38%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 38%);
}

.home.last,
.related {
    padding-bottom: 24px;
}

/* A few things */

.things {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.things li::before {
    content: "\2014\00a0";
    color: var(--muted);
}

/* Home — the old document outline, set in this register ----------------- */

.mast {
    padding-top: 115px;
}

.mast h1 {
    font-size: 36px;
    line-height: 43px;
    font-weight: 400;
    letter-spacing: -.02em;
    margin-bottom: 30px;
}

.prose p+p {
    margin-top: 24px;
}

.home {
    padding-top: 56px;
}

.home.first {
    padding-top: 72px;
}

.home.last {
    padding-bottom: 120px;
}

.rail .lede {
    display: block;
    font-size: 14px;
    line-height: 20px;
    color: var(--muted);
    padding-top: 2px;
}

.list .row {
    display: grid;
    grid-template-columns: 96px 1fr 88px;
    gap: 12px;
    padding: 10px 0 12px;
    border-bottom: 1px solid rgba(38, 37, 30, .10);
}

.list .row:last-child {
    border-bottom: 0;
}

.list .tag,
.list .date {
    font-size: 14px;
    line-height: 24px;
    color: var(--muted);
}

.list .tag.new {
    color: var(--accent);
}

.list .date {
    text-align: right;
}

.roles .row {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: 16px;
    padding: 12px 0 16px;
    border-bottom: 1px solid rgba(38, 37, 30, .10);
}

.roles .row:last-child {
    border-bottom: 0;
}

.roles img {
    width: 40px;
    height: 40px;
    border-radius: 9px;
}

.roles .when,
.roles .what {
    display: block;
    font-size: 14px;
    line-height: 20px;
}

.roles .when {
    color: var(--muted);
}

.roles .what {
    padding-top: 4px;
}

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

@media (max-width: 1100px) {
    :root {
        --gutter: 32px;
    }

    .sheet {
        grid-template-columns: minmax(0, var(--col));
        padding-right: var(--gutter);
    }

    .rail {
        padding-bottom: 12px;
    }

    .post {
        padding-top: 72px;
    }

    .nav .links {
        display: none;
    }
}

@media (max-width: 720px) {
    :root {
        --gutter: 20px;
    }

    .mast {
        padding-top: 72px;
    }

    .list .row {
        grid-template-columns: 72px 1fr;
    }

    .list .date {
        grid-column: 2;
        text-align: left;
    }

    .tiles {
        grid-template-columns: 1fr;
    }

    .marginalia {
        display: none;
    }

    .postcard {
        height: 240px;
    }

    .ascii {
        height: 300px;
    }

    .ascii.band {
        height: 240px;
    }

    .now {
        height: auto;
        flex-wrap: wrap;
        padding: 6px 12px 6px 10px;
    }

    .foot .cols {
        grid-template-columns: 1fr 1fr;
    }

    .foot .bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .pair {
        grid-template-columns: 1fr;
    }

    .box {
        padding: 20px;
    }

    .rows>div {
        grid-template-columns: 1fr;
    }

    .rows.constants>div,
    .rows.checks>div {
        grid-template-columns: 1fr;
    }

    .matrix {
        grid-template-columns: 1fr;
    }

    .mast h1,
    .post h1 {
        font-size: 30px;
        line-height: 36px;
    }
}

@media (max-width: 520px) {
    .nav .actions>a:not(.pill) {
        display: none;
    }
}
