body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgb(18, 18, 18);
    color: rgb(255, 255, 255);
    font-family: "Inconsolata", monospace;
    font-size: 1.25rem;
    -webkit-tap-highlight-color: transparent;
}

/* contour background laid on a plane tilted away from the viewer */
body::before {
    content: "";
    position: fixed;
    inset: -80% -60% -30%;
    z-index: -2;
    background: url(bg.svg) center / cover;
    transform: perspective(1200px) rotateX(35deg);
    transform-origin: 50% 100%;
    mask-image: linear-gradient(to top, black 45%, transparent 85%);  /* fade out toward the horizon */
    pointer-events: none;
}

h1 { font-size: 3rem; margin: 0 1rem; }
p  { font-size: 1em; opacity: 0.7; }
a { color: inherit; }

/* "?" rises from behind the word: the window ends at the word's bottom edge, and padding pushes the text in or out of it */
.puzzle-link { position: relative; }
.puzzle-link::before {
    content: "?";
    position: absolute;
    left: 0;
    right: 0;
    top: -1.2em;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    box-sizing: border-box;
    padding-top: 4em;
    font-size: 0.5em;
    line-height: 1.2em;
    pointer-events: none;
    transition: padding-top 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@media (hover: hover) {
    .puzzle-link:hover::before { padding-top: 0; }
}

.puzzle { font-size: 1.5rem; }
.big { font-size: 1.5em; opacity: 1; margin: 0.25rem 1rem; }
hr { width: 12em; border: none; border-top: 1px solid rgba(255, 255, 255, 0.2); margin: 1.5rem auto; }

input {
    font: inherit;
    color: inherit;
    text-align: center;
    width: 12em;
    outline: none;
    padding: 0.5rem;
    border: none;
    border-radius: 8px;
    background: rgb(40, 40, 40);
    -webkit-appearance: none;
    appearance: none;
}

#result { min-height: 1.2em; }

nav { display: flex; gap: 2rem; margin-top: 2rem; }

nav a {
    width: 72px;
    height: 72px;
    border-radius: 22%;
    background: rgb(40, 40, 40);
    display: grid;
    place-items: center;
    color: inherit;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}

/* hover only on real pointers, so taps don't leave a tile stuck lifted */
@media (hover: hover) {
    nav a:hover {
        transform: translateY(-4px) scale(1.12);
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
    }
}

nav a:active { transform: scale(0.94); }

nav img { width: 36px; filter: invert(1); }

#caption {
    position: fixed;
    bottom: 2rem;
    line-height: 1.6;
    white-space: pre;
    pointer-events: none;
}

#caption:has(span:empty) { display: none; }
@media (hover: none) { #caption { display: none; } }

#caption span {
    padding: 0.3rem 0.6rem;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* back layer: per-line backgrounds blurred together into one rounded shape */
#caption div:first-child { filter: url(#goo); opacity: 0.85; }
#caption div:first-child span { background: black; color: transparent; }

#caption div:last-child { position: absolute; inset: 0; }

/* posts */
.back { position: absolute; top: 1.5rem; left: 1.5rem; font-size: 1.25rem; opacity: 0.7; text-decoration: none; }

#cards { display: grid; gap: 1rem; width: min(36rem, 100% - 2rem); margin-top: 2rem; }

.card {
    display: block;
    text-align: left;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgb(40, 40, 40);
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
}
.card h2 { margin: 0 0 0.25rem; font-size: 1.2em; }
.card p { margin: 0 0 0.5rem; }
.card small { opacity: 0.5; }
@media (hover: hover) {
    .card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6); }
}
.card:active { transform: scale(0.98); }

#post { width: min(60rem, 100% - 2rem); text-align: left; line-height: 1.6; padding: 5rem 0 3rem; }
html { scroll-behavior: smooth; }
#post :is(h1, h2, h3, h4) { scroll-margin-top: 1.5rem; }
#post h1 { font-size: 2.25rem; line-height: 1.2; margin: 0 0 1.5rem; }
#post p, #post li { opacity: 0.9; }
#post img { max-width: 100%; border-radius: 8px; }

.player { position: relative; margin: 1rem 0; border-radius: 12px; overflow: hidden; background: rgb(40, 40, 40); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); }
.player video { display: block; width: 100%; cursor: pointer; }
.player-bar { height: 6px; cursor: pointer; background: rgb(40, 40, 40); }
.player-bar div { height: 100%; background: rgba(255, 255, 255, 0.7); }
/* paused: a play button in the same rounded-tile style as the home page icons */
.player.paused::after {
    content: "";
    position: absolute; top: 50%; left: 50%; width: 72px; height: 72px;
    transform: translate(-50%, -50%);
    border-radius: 22%;
    background: rgb(40, 40, 40) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='m11.596 8.697-6.363 3.692c-.54.313-1.233-.066-1.233-.697V4.308c0-.63.692-1.01 1.233-.696l6.363 3.692a.802.802 0 0 1 0 1.393'/%3E%3C/svg%3E") center / 40px no-repeat;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.6);
    pointer-events: none;
}
#post code { font: inherit; background: rgb(40, 40, 40); padding: 0.1em 0.3em; border-radius: 4px; }
#post blockquote { margin: 0; padding-left: 1rem; border-left: 2px solid rgba(255, 255, 255, 0.2); }

/* SAT questions inside posts */
.sat { margin: 1.5rem 0; padding: 1rem 1.25rem; border-radius: 12px; background: rgb(40, 40, 40); }
.sat small { display: block; opacity: 0.5; margin-bottom: 0.5rem; }
.sat li p { margin: 0.25rem 0; }
.sat summary { cursor: pointer; opacity: 0.7; }
.sat img.math-img { filter: invert(1); mix-blend-mode: screen; vertical-align: middle; }  /* older questions draw math as black-on-white images */
.sat figure { margin: 1rem 0; }
.sat figure svg { display: block; margin: auto; max-width: 100%; height: auto; filter: invert(1); mix-blend-mode: screen; }  /* black-on-white graphs -> white lines; screen drops the (now black) background and label boxes */
.sat .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }  /* graph descriptions for screen readers only */

/* Desmos-style expression rows in posts */
.desmos { margin: 1rem 0; background: black; border: 1px solid rgb(60, 60, 60); border-radius: 6px; overflow-x: auto; }
.desmos-row { position: relative; padding: 0.9rem 1rem 0.9rem 3.5rem; font-size: 1.3em; }
.desmos-row + .desmos-row { border-top: 1px solid rgb(60, 60, 60); }
.desmos-result { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 0.4rem; }
.desmos-result > span { padding: 0.1rem 0.6rem; border: 1px solid rgb(80, 80, 80); border-radius: 6px; }
.desmos-table { border-collapse: collapse; border-style: hidden; }  /* hidden: only the inner grid lines show, like Desmos */
.desmos-table th, .desmos-table td { min-width: 4rem; padding: 0.3rem 0.9rem; border: 1px solid rgb(70, 70, 70); text-align: center; font-weight: normal; }
.desmos-table th { border-bottom: 2px solid rgb(130, 130, 130); }
.desmos-row::before {
    content: attr(data-n);
    position: absolute; inset: 0 auto 0 0; width: 2.2rem;
    padding: 0.2rem 0.3rem; box-sizing: border-box;
    background: rgb(25, 25, 25); border-right: 1px solid rgb(60, 60, 60);
    font: 0.75rem sans-serif; color: rgb(170, 170, 170);
}

/* phones */
@media (max-width: 480px) {
    h1 { font-size: 2.25rem; }
    nav { gap: 0.75rem; }
    nav a { width: 60px; height: 60px; }
    nav img { width: 30px; }
    .puzzle { font-size: 1.25rem; }
}
