/* ============================================================
   THE DEV NOTEBOOK — blog.yashbhavsar.in
   Engineer's-notebook theme: paper, graph grid, pencil, ink.
   (Deliberately the opposite of the portfolio: light, quiet,
   text-first, no heavy boxes or offset shadows.)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Indie+Flower&display=swap');

:root {
    --desk: #e4dac5; /* the table the notebook lies on */
    --paper: #f7f2e7;
    --paper-2: #efe8d8;
    --ink: #1f2430;
    --ink-soft: #4b5160;
    --pencil: #7a7d86;
    --blue: #2b4f8a; /* ink-blue: links + accents */
    --red: #c4442f; /* red-pen / margin line */
    --grid: rgba(60, 100, 170, 0.13);
    --margin: rgba(196, 68, 47, 0.55);
    --hl: #ffe45e; /* highlighter */
    --hl-block: rgba(255, 228, 94, 0.55);
    --shadow: 60, 40, 10;

    --font-display: "Caveat", Georgia, serif;
    --font-body: "Indie Flower", "Caveat", serif;
    --font-ui: "Work Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
    --font-hand: "Caveat", "Bradley Hand", "Segoe Script", cursive;

    --sheet-max: 1040px;
    --margin-x: clamp(38px, 6vw, 84px); /* where the red margin line sits */
}

/* Night desk: warm charcoal, never pure black */
[data-theme="dark"] {
    --desk: #131110;
    --paper: #25221e;
    --paper-2: #2d2924;
    --ink: #ece4d3;
    --ink-soft: #b9b0a0;
    --pencil: #9a948a;
    --blue: #93b3ec;
    --red: #ee8a74;
    --grid: rgba(150, 180, 230, 0.075);
    --margin: rgba(238, 138, 116, 0.4);
    --hl-block: rgba(255, 214, 60, 0.2);
    --shadow: 0, 0, 0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
}
body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: var(--font-body);
    font-weight: 400;
    font-style: normal;
    font-size: 1.125rem;
    line-height: 1.7;
    background-color: var(--desk);
    background-image:
        radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.28), transparent 45%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.014) 0 2px, transparent 2px 5px);
    -webkit-font-smoothing: antialiased;
}
[data-theme="dark"] body {
    background-image:
        radial-gradient(circle at 15% 8%, rgba(255, 255, 255, 0.04), transparent 45%),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 5px);
}
a {
    color: var(--blue);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}
::selection {
    background: var(--hl);
    color: #1f2430;
}
:focus-visible {
    outline: 2px dashed var(--blue);
    outline-offset: 3px;
}

.hand {
    font-family: var(--font-hand);
}
.hl {
    background: linear-gradient(transparent 52%, var(--hl) 52% 90%, transparent 90%);
    padding: 0 0.12em;
    margin: 0 -0.12em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}
[data-theme="dark"] .hl {
    background: linear-gradient(transparent 52%, rgba(255, 214, 60, 0.35) 52% 90%, transparent 90%);
}

/* hand-drawn wobbly border radius, reused on chips and boxes */
.wobble {
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}

/* ============ TOP BAR (sits on the desk) ============ */
.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: var(--sheet-max);
    margin: 0 auto;
    padding: 22px clamp(16px, 4vw, 32px) 18px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}
.topbar a {
    color: var(--ink);
    text-decoration: none;
}
.topbar > a {
    white-space: nowrap;
}
.topbar a:hover {
    text-decoration: underline wavy var(--blue);
    text-underline-offset: 5px;
}
.topbar nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 20px;
}
.theme-toggle {
    font: inherit;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--ink-soft);
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    transition: background 0.15s, color 0.15s;
}
.theme-toggle:hover {
    background: var(--ink);
    color: var(--paper);
}

/* ============ THE SHEET (a real piece of grid paper) ============ */
.sheet-page {
    position: relative;
    max-width: var(--sheet-max);
    margin: 0 auto 90px;
    padding: clamp(30px, 5vw, 60px) clamp(22px, 5vw, 72px) 90px calc(var(--margin-x) + clamp(20px, 3.5vw, 44px));
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 28px 28px;
    border-radius: 3px 3px 5px 5px;
    box-shadow:
        0 1px 0 rgba(0, 0, 0, 0.05),
        0 22px 44px -16px rgba(var(--shadow), 0.4),
        0 3px 8px rgba(var(--shadow), 0.18);
    animation: sheet-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes sheet-in {
    from {
        opacity: 0;
        transform: translateY(60px) rotate(-0.6deg);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
/* red margin line */
.sheet-page::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--margin-x);
    width: 2px;
    background: var(--margin);
    box-shadow: 4px 0 0 -1px var(--margin);
}
/* binder holes */
.holes {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 10px;
    width: 34px;
    background:
        radial-gradient(circle at 50% 50%, var(--desk) 0 8px, rgba(0, 0, 0, 0.2) 9px 10px, transparent 11px) 0 70px / 34px 260px repeat-y;
    pointer-events: none;
}
/* strips of tape holding the sheet down */
.tape {
    position: absolute;
    width: 110px;
    height: 28px;
    background: rgba(255, 232, 130, 0.6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    z-index: 2;
}
.tape--tl {
    top: -12px;
    left: 6%;
    transform: rotate(-4deg);
}
.tape--tr {
    top: -10px;
    right: 7%;
    transform: rotate(3deg);
}
/* coffee ring */
.stain {
    position: absolute;
    top: 38%;
    right: 3%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 7px solid rgba(120, 78, 30, 0.1);
    box-shadow: inset 0 0 8px rgba(120, 78, 30, 0.08), 0 0 6px rgba(120, 78, 30, 0.06);
    transform: scale(1.1, 0.96) rotate(14deg);
    pointer-events: none;
}
.page-no {
    position: absolute;
    right: 28px;
    bottom: 20px;
    font-family: var(--font-hand);
    font-size: 1.3rem;
    color: var(--pencil);
}

/* pencil sketch peeking over the bottom border of the page */
.edge-doodle {
    position: absolute;
    right: clamp(40px, 9vw, 120px);
    bottom: -1px;
    width: clamp(120px, 17vw, 190px);
    height: auto;
    pointer-events: none;
    z-index: 3;
    opacity: 0.92;
}
[data-theme="dark"] .edge-doodle {
    filter: invert(0.9) hue-rotate(180deg);
}
.bolt {
    position: absolute;
    right: clamp(18px, 4vw, 50px);
    bottom: 54px;
    width: 38px;
    transform: rotate(14deg);
    pointer-events: none;
}

/* ============ HOME: HERO ============ */
.hero {
    display: grid;
    grid-template-columns: 1fr minmax(210px, 260px);
    gap: 28px 40px;
    align-items: start;
}
.kicker {
    margin: 0 0 10px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--pencil);
}
.hero-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.8rem, 7vw, 5rem);
    line-height: 1;
    letter-spacing: -0.02em;
}
.hero-sub {
    margin: 18px 0 0;
    max-width: 30em;
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    font-style: italic;
    color: var(--ink-soft);
}
.hero-intro {
    margin: 16px 0 0;
    max-width: 34em;
    color: var(--ink-soft);
    font-size: 1.02rem;
}
.sticky {
    position: relative;
    margin-top: 10px;
    padding: 22px 20px 22px;
    background: #fff1a8;
    color: #3b3200;
    font-family: var(--font-hand);
    font-size: 1.45rem;
    line-height: 1.15;
    transform: rotate(2.5deg);
    box-shadow: 0 10px 18px -8px rgba(var(--shadow), 0.45), 0 2px 3px rgba(var(--shadow), 0.2);
}
.sticky::before {
    content: "";
    position: absolute;
    top: -11px;
    left: 50%;
    width: 78px;
    height: 22px;
    margin-left: -39px;
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    transform: rotate(-2deg);
}
.sticky b {
    display: block;
    margin-bottom: 4px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8a6d00;
}

/* ============ HOME: SERIES TABS ============ */
.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 22px;
    margin: 64px 0 18px;
}
.section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.9rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 14' preserveAspectRatio='none'%3E%3Cpath d='M2 9 Q 40 2 80 8 T 160 7 T 240 8 T 298 5' fill='none' stroke='%232b4f8a' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left bottom / 100% 12px;
    padding-bottom: 10px;
}
.section-head .note {
    font-family: var(--font-hand);
    font-size: 1.35rem;
    color: var(--blue);
}
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 6px;
}
.tab {
    font: 500 0.82rem var(--font-ui);
    color: var(--ink);
    background: transparent;
    border: 1.8px solid var(--ink);
    padding: 5px 14px;
    cursor: pointer;
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
    transition: background 0.15s, transform 0.15s;
}
.tab:nth-child(even) {
    transform: rotate(0.8deg);
}
.tab:nth-child(odd) {
    transform: rotate(-0.8deg);
}
.tab:hover {
    background: var(--hl-block);
}
.tab.is-active {
    background: var(--hl);
    color: #1f2430;
}

/* ============ HOME: NOTEBOOK ENTRY CARDS ============ */
.pages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px 34px;
    margin-top: 12px;
}
.entry {
    position: relative;
    display: block;
    color: inherit;
    text-decoration: none;
    margin-top: 70px; /* room for the page to slide up */
    transition: opacity 0.25s;
}
.entry.is-dim {
    opacity: 0.22;
}
.entry-stage {
    position: relative;
    aspect-ratio: 4 / 4.6;
}
.entry-stage::after {
    /* soft contact shadow under the book */
    content: "";
    position: absolute;
    left: 6%;
    right: 6%;
    bottom: -12px;
    height: 20px;
    background: radial-gradient(ellipse at center, rgba(var(--shadow), 0.4), transparent 70%);
    z-index: 0;
}

/* the sheet of paper peeking out of the book */
.entry-sheet {
    position: absolute;
    z-index: 1;
    left: 8%;
    right: 8%;
    top: 0;
    height: 82%;
    padding: 18px 20px 0 42px;
    background-color: #fbf7ec;
    background-image: repeating-linear-gradient(transparent 0 25px, rgba(60, 100, 170, 0.28) 25px 26px);
    background-position: 0 14px;
    color: #1f2430;
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 6px rgba(var(--shadow), 0.18), 0 4px 10px rgba(var(--shadow), 0.14);
    transform-origin: 50% 100%;
    transform: rotate(-0.8deg);
    transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25), box-shadow 0.4s;
}
.entry-sheet::before {
    /* the paper's own red margin */
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 30px;
    width: 1.5px;
    background: rgba(196, 68, 47, 0.5);
}
.sheet-no {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    color: #8a8f9b;
}
.sheet-title {
    margin: 6px 0 4px;
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: clamp(1.9rem, 3.2vw, 2.3rem);
    line-height: 0.95;
    color: #1f2430;
}
.sheet-meta {
    margin: 8px 0 0;
    font-family: var(--font-hand);
    font-size: 1.25rem;
    line-height: 1.1;
    color: #2b4f8a;
}

/* the notebook (cover) */
.entry-book {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    height: 44%;
    border-radius: 6px 12px 12px 6px;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.12) 0 1px, transparent 2px) 0 0 / 7px 7px,
        linear-gradient(135deg, var(--cover, #c79a63), var(--cover-2, #a67740));
    box-shadow:
        0 5px 0 -2px #e9e0c8,
        0 8px 0 -3px #cbbd9c,
        0 14px 22px -8px rgba(var(--shadow), 0.5);
    transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.entry-book::before {
    /* stitched spine */
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 26px;
    border-radius: 6px 0 0 6px;
    background: rgba(0, 0, 0, 0.18);
    border-right: 2px dashed rgba(255, 255, 255, 0.35);
}
.entry-book::after {
    /* elastic band */
    content: "";
    position: absolute;
    top: -2px;
    bottom: -2px;
    right: 15%;
    width: 11px;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.3));
}
.book-label {
    position: absolute;
    left: 44px;
    top: 24px;
    padding: 8px 12px 7px;
    background: #f4ecd8;
    color: #2a2f3a;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    line-height: 1.35;
    transform: rotate(-2deg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.book-label b {
    display: block;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
}
.book-doodle {
    position: absolute;
    right: 24%;
    bottom: 14px;
    width: 30px;
    opacity: 0.75;
}
.entry--navy {
    --cover: #2f4670;
    --cover-2: #20304f;
}
.entry--green {
    --cover: #3d6b57;
    --cover-2: #284a3a;
}

.entry-hint {
    position: absolute;
    left: 8%;
    bottom: -44px;
    font-family: var(--font-hand);
    font-size: 1.35rem;
    color: var(--blue);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}

/* hover: the page starts sliding out */
a.entry:hover .entry-sheet,
a.entry:focus-visible .entry-sheet {
    transform: translateY(-16%) rotate(1deg);
    box-shadow: 0 -6px 14px rgba(var(--shadow), 0.2), 0 8px 18px rgba(var(--shadow), 0.2);
}
a.entry:hover .entry-book,
a.entry:focus-visible .entry-book {
    transform: translateY(3px) rotate(0.5deg);
}
a.entry:hover .entry-hint,
a.entry:focus-visible .entry-hint {
    opacity: 1;
    transform: none;
}

/* click: the page comes fully out, then the page turns to paper */
a.entry.is-opening {
    z-index: 20;
}
a.entry.is-opening .entry-sheet {
    transform: translateY(-62%) scale(1.22) rotate(0deg);
    box-shadow: 0 30px 50px -10px rgba(var(--shadow), 0.55);
    transition: transform 0.7s cubic-bezier(0.25, 0.9, 0.3, 1), box-shadow 0.5s;
}
a.entry.is-opening .entry-book {
    transform: translateY(10px) scale(0.97);
}
body.is-leaving .entry:not(.is-opening) {
    opacity: 0.1;
    transition: opacity 0.4s;
}
body.is-leaving::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 90;
    background: var(--paper);
    opacity: 0;
    animation: wipe 0.45s 0.45s ease-in forwards;
}
@keyframes wipe {
    to {
        opacity: 1;
    }
}

/* an empty notebook that's still being written */
.entry--empty {
    cursor: default;
}
.entry--empty .entry-sheet {
    background-image: repeating-linear-gradient(transparent 0 25px, rgba(60, 100, 170, 0.2) 25px 26px);
}
.entry--empty .sheet-title {
    color: #9aa0ad;
    font-size: 1.7rem;
}
.entry--empty:hover .entry-sheet {
    transform: translateY(-4%) rotate(-0.2deg);
}
.entry--empty .entry-book {
    filter: saturate(0.7);
}

/* ============ HOME: FOOTER ============ */
.colophon {
    margin-top: 80px;
    padding-top: 22px;
    border-top: 2px dashed var(--pencil);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 24px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-soft);
}
.colophon a {
    color: var(--ink-soft);
}

/* ============ POST PAGE ============ */
.post {
    max-width: 640px;
    position: relative;
}
.post-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    color: var(--pencil);
}
.post-kicker .chip {
    padding: 2px 10px;
    border: 1.5px solid var(--ink-soft);
    color: var(--ink-soft);
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
.post h1 {
    margin: 16px 0 10px;
    padding-bottom: 16px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.3rem, 5.6vw, 3.5rem);
    line-height: 1.04;
    letter-spacing: -0.02em;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 14' preserveAspectRatio='none'%3E%3Cpath d='M2 9 Q 40 2 80 8 T 160 7 T 240 8 T 298 5' fill='none' stroke='%232b4f8a' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left bottom / 100% 12px;
}
.post .dek {
    margin: 18px 0 0;
    font-size: 1.28rem;
    font-style: italic;
    color: var(--ink-soft);
}
.post p {
    margin: 0 0 1.15em;
}
.post .lead::first-letter {
    float: left;
    padding: 6px 12px 0 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 4rem;
    line-height: 0.82;
    color: var(--blue);
}
.post h2 {
    margin: 2.2em 0 0.6em;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.7rem;
    line-height: 1.15;
}
.post h2 .sec {
    display: block;
    margin-bottom: 2px;
    font: 500 0.75rem var(--font-mono);
    letter-spacing: 0.14em;
    color: var(--red);
}
.post ul {
    margin: 0 0 1.2em;
    padding-left: 1.2em;
}
.post li {
    margin-bottom: 0.4em;
}
.post li::marker {
    color: var(--blue);
}

/* margin notes live in the right margin of the sheet */
.margin-note {
    float: right;
    clear: right;
    width: 168px;
    margin: 0.2em -206px 0.6em 0;
    font-family: var(--font-hand);
    font-size: 1.35rem;
    line-height: 1.1;
    color: var(--blue);
    transform: rotate(-2deg);
}
.margin-note::before {
    content: "↙ ";
}

/* quote lines: highlighted block */
.pull {
    position: relative;
    margin: 40px -16px;
    padding: 24px 26px 20px 34px;
    background: var(--hl-block);
    border-left: 6px solid var(--ink);
    transform: rotate(-0.5deg);
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.4rem;
    line-height: 1.35;
    color: var(--ink);
    box-shadow: 0 6px 14px -8px rgba(var(--shadow), 0.4);
}
.pull::before {
    content: "\201C";
    position: absolute;
    left: 10px;
    top: -14px;
    font-size: 4.4rem;
    line-height: 1;
    color: var(--blue);
}
.pull:nth-of-type(even) {
    transform: rotate(0.5deg);
}
.pull cite {
    display: block;
    margin-top: 10px;
    font: 700 1.25rem var(--font-hand);
    font-style: normal;
    color: var(--blue);
}

/* photos / sketches, taped to the page */
.fig {
    position: relative;
    margin: 44px -22px;
    padding: 12px 12px 6px;
    background: #fffdf7;
    box-shadow: 0 12px 24px -12px rgba(var(--shadow), 0.55), 0 2px 4px rgba(var(--shadow), 0.18);
    transform: rotate(-0.8deg);
}
.fig:nth-of-type(even) {
    transform: rotate(0.7deg);
}
.fig::before {
    content: "";
    position: absolute;
    top: -13px;
    left: 50%;
    width: 100px;
    height: 26px;
    margin-left: -50px;
    background: rgba(255, 232, 130, 0.65);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
    transform: rotate(-3deg);
}
.fig img {
    display: block;
    width: 100%;
    height: auto;
}
.fig figcaption {
    padding: 8px 6px 4px;
    font: 700 1.25rem var(--font-hand);
    color: #3a3f4b;
}
.fig figcaption i {
    font-style: normal;
    color: var(--red);
}

/* a pasted-in code slip */
.insert {
    position: relative;
    margin: 34px 0 30px;
    padding: 18px 18px 14px 30px;
    overflow-x: auto;
    background-color: #fffdf7;
    background-image: repeating-linear-gradient(transparent 0 23px, rgba(60, 100, 170, 0.2) 23px 24px);
    background-position: 0 6px;
    border: 1.5px solid #1f2430;
    border-radius: 3px;
    font: 500 0.88rem/24px var(--font-mono);
    color: #2a2f3a;
    transform: rotate(0.3deg);
}
.insert::before {
    content: attr(data-file);
    position: absolute;
    top: 12px;
    left: 18px;
    padding: 1px 10px;
    background: #fffdf7;
    border: 1.5px solid #1f2430;
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    line-height: 20px;
}
.insert::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 16px;
    width: 1.5px;
    background: rgba(196, 68, 47, 0.45);
}
.insert pre {
    margin: 0;
    font: inherit;
}
.insert .c {
    color: #b0382a;
}
.insert .k {
    color: #2b4f8a;
    font-weight: 600;
}

/* "What broke" — a stamped, boxed aside */
.broke {
    position: relative;
    margin: 42px 0;
    padding: 26px 26px 14px;
    border: 2px solid var(--ink);
    background: color-mix(in srgb, var(--paper-2) 75%, transparent);
    border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
}
.broke .stamp {
    position: absolute;
    top: -15px;
    left: 24px;
    padding: 1px 12px;
    background: var(--paper);
    border: 2px solid var(--red);
    color: var(--red);
    font: 600 0.74rem var(--font-mono);
    letter-spacing: 0.16em;
    transform: rotate(-2.5deg);
}

.takeaway {
    margin: 44px 0 10px;
    padding: 20px 24px 6px;
    background: var(--hl-block);
    border-radius: 4px;
    transform: rotate(0.3deg);
}
.takeaway b {
    display: block;
    margin-bottom: 6px;
    font: 600 0.74rem var(--font-mono);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-soft);
}
.signoff {
    margin: 30px 0 0;
    font: 700 2.2rem var(--font-hand);
    color: var(--blue);
}

hr.squiggle {
    height: 14px;
    margin: 40px 0;
    border: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 14' preserveAspectRatio='none'%3E%3Cpath d='M2 8 Q 20 1 40 8 T 80 8 T 120 8 T 160 8 T 200 8 T 240 8 T 298 8' fill='none' stroke='%237a7d86' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}

.post-nav {
    margin-bottom: 70px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px 20px;
    margin-top: 52px;
    padding-top: 20px;
    border-top: 2px dashed var(--pencil);
    font: 500 0.85rem var(--font-mono);
}

/* reading progress: a pencil line drawn across the top of the window */
.pencil-bar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    width: 0;
    height: 4px;
    background: linear-gradient(90deg, #555 0 70%, #888);
    border-radius: 0 2px 2px 0;
}
.pencil-bar::after {
    content: "";
    position: absolute;
    right: -14px;
    top: -2px;
    border-left: 14px solid #d9b777;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
    /* margin notes drop into the text as little boxed asides */
    .margin-note {
        float: none;
        width: auto;
        margin: 0 0 1.2em;
        padding: 6px 12px;
        border-left: 3px solid var(--blue);
        transform: none;
    }
    .margin-note::before {
        content: "";
    }
}
@media (max-width: 760px) {
    body {
        font-size: 1.05rem;
    }
    .hero {
        grid-template-columns: 1fr;
    }
    .sticky {
        max-width: 280px;
    }
    .pull,
    .fig {
        margin-left: 0;
        margin-right: 0;
    }
    .holes {
        display: none;
    }
    .stain {
        display: none;
    }
    .sheet-page {
        padding-left: calc(var(--margin-x) + 14px);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

/* lighter pencil/ink underline on the night desk */
[data-theme="dark"] .post h1,
[data-theme="dark"] .section-head h2 {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 14' preserveAspectRatio='none'%3E%3Cpath d='M2 9 Q 40 2 80 8 T 160 7 T 240 8 T 298 5' fill='none' stroke='%2393b3ec' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ============================================================
   PATCH — append this to the END of notebook.css
   (it overrides the old .topbar rules, so nothing else needs
   to be deleted; you can remove the old "TOP BAR" block and the
   old .colophon block later if you want a tidier file)
   ============================================================ */

/* ---------- NAVBAR: shared ---------- */
.topbar {
    max-width: var(--sheet-max);
    margin: 0 auto;
}

/* ---------- NAVBAR: home ----------
   theme toggle on the left, links centered, empty right side */
.topbar--home {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
}
.topbar--home .theme-toggle {
    justify-self: end;
}
.topbar--home nav {
    justify-content: center;
    gap: 6px 28px;
}
.topbar-spacer {
    display: block;
}

/* ---------- NAVBAR: blog post ----------
   theme toggle on the left, "The Dev Notebook" + return arrow on the right */
.topbar--post {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}
.topbar .brand {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    text-decoration: none;
}
.topbar .brand:hover {
    text-decoration: none;
}
.brand-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(1.6rem, 3.4vw, 2.1rem);
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
    white-space: nowrap;
}
.brand-back {
    width: 40px;
    height: 16px;
    color: var(--pencil);
    opacity: 0.7;
    transition: transform 0.25s, opacity 0.25s, color 0.25s;
}
.topbar .brand:hover .brand-back,
.topbar .brand:focus-visible .brand-back {
    transform: translateX(-6px);
    opacity: 1;
    color: var(--blue);
}

@media (max-width: 640px) {
    .topbar--home {
        grid-template-columns: 1fr;
        justify-items: center;
    }
    .topbar--home .theme-toggle {
        justify-self: start;
    }
    .topbar-spacer {
        display: none;
    }
}

/* ---------- FOOTER (home): one quiet line ---------- */
.colophon--note {
    justify-content: center;
    text-align: center;
}

/* ---------- ABOUT ---------- */
.about {
    scroll-margin-top: 20px;
}
.about .section-head {
    margin-top: 84px;
}
.about-text {
    max-width: 38em;
}
.about-text p {
    margin: 0 0 1.1em;
}
.about-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 56px 120px;
    margin: 52px 0 10px;
    padding-left: 6px;
}

/* ---------- ORIGAMI CTA ----------
   a sheet folded into four triangles; on hover/focus/click the
   flaps swing open one after another and reveal the destination */
.origami {
    --o-t: #3d63a3;
    --o-l: #2b4f8a;
    --o-r: #34599a;
    --o-b: #20407a;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    color: var(--ink);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.origami--red {
    --o-t: #d9593f;
    --o-l: #c4442f;
    --o-r: #cf4e38;
    --o-b: #a93624;
}
.origami-paper {
    position: relative;
    display: block;
    width: 160px;
    height: 100px;
    perspective: 700px;
    filter: drop-shadow(0 8px 7px rgba(var(--shadow), 0.3));
    transition: transform 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.origami:hover .origami-paper,
.origami:focus-visible .origami-paper,
.origami.is-unfolded .origami-paper {
    transform: rotate(-1.5deg) scale(1.03);
}

/* what is hidden underneath the folds */
.origami-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: var(--paper-2);
    border: 1.5px solid var(--ink-soft);
    border-radius: 2px;
}
.origami-face small {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    letter-spacing: 0.08em;
    color: var(--pencil);
}
.origami-face b {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.75rem;
    line-height: 1;
    color: var(--blue);
}
.origami--red .origami-face b {
    color: var(--red);
}

/* the four triangular flaps (an X cut through the rectangle) */
.fold {
    position: absolute;
    display: block;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.14));
    transition: transform 0.8s cubic-bezier(0.3, 0.9, 0.3, 1.08);
}
.fold--t {
    left: 0;
    top: 0;
    width: 100%;
    height: 50%;
    background-color: var(--o-t);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transform-origin: 50% 0;
    z-index: 4;
}
.fold--l {
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: var(--o-l);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
    transform-origin: 0 50%;
    transition-delay: 0.07s;
    z-index: 3;
}
.fold--r {
    left: 50%;
    top: 0;
    width: 50%;
    height: 100%;
    background-color: var(--o-r);
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
    transform-origin: 100% 50%;
    transition-delay: 0.14s;
    z-index: 3;
}
.fold--b {
    left: 0;
    top: 50%;
    width: 100%;
    height: 50%;
    background-color: var(--o-b);
    clip-path: polygon(0 100%, 100% 100%, 50% 0);
    transform-origin: 50% 100%;
    transition-delay: 0.21s;
    z-index: 2;
}

/* unfolding */
.origami:hover .fold--t,
.origami:focus-visible .fold--t,
.origami.is-unfolded .fold--t {
    transform: rotateX(165deg);
}
.origami:hover .fold--l,
.origami:focus-visible .fold--l,
.origami.is-unfolded .fold--l {
    transform: rotateY(-165deg);
}
.origami:hover .fold--r,
.origami:focus-visible .fold--r,
.origami.is-unfolded .fold--r {
    transform: rotateY(165deg);
}
.origami:hover .fold--b,
.origami:focus-visible .fold--b,
.origami.is-unfolded .fold--b {
    transform: rotateX(-165deg);
}

/* caption under the paper */
.origami-cap {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.origami-cap b {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.05;
    color: var(--ink);
}
.origami-cap span {
    font-size: 0.95rem;
    color: var(--ink-soft);
}
.origami:hover .origami-cap b,
.origami:focus-visible .origami-cap b {
    color: var(--blue);
}
.origami--red:hover .origami-cap b,
.origami--red:focus-visible .origami-cap b {
    color: var(--red);
}

/* ---------- ABOUT: title + first paragraph with a sticky beside them ---------- */
.about-top {
    display: grid;
    grid-template-columns: minmax(0, 38em) minmax(190px, 240px);
    gap: 0 44px;
    align-items: start;
}
.about-top > div > p {
    margin: 0 0 1.1em;
}
.about-top .sticky {
    margin-top: 104px; /* lines up with the About title, below the section-head gap */
    transform: rotate(-2deg);
}
.sticky--green {
    background: #cfe9b8;
    color: #1f3a12;
}
.sticky--green b {
    color: #4a7a26;
}

@media (max-width: 900px) {
    .about-top {
        grid-template-columns: 1fr;
    }
    .about-top .sticky {
        margin-top: 4px;
        max-width: 280px;
    }
}

@media (max-width: 760px) {
    .about-cta {
        gap: 64px 100px;
    }
}