/* julianlupu.com -- dark, single frame per page.
   Advent Pro throughout, at three weights: 400 for prose, 500 for link labels,
   700 for the name and headings. Body text was previously 300 (Light), which is
   what made it hard to read -- the face is condensed, so it needs weight and a
   slightly larger size to hold up at paragraph scale.

   Indigo #5A56E0 (the color lipgloss uses) measures 3.77:1 on this background
   -- fine for large headings, short of AA for body text. Body-size indigo uses
   --indigo-text (#7B78F0, 5.68:1) instead. */

@font-face {
    font-family: 'Advent Pro';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/static/fonts/AdventPro-Regular.ttf') format('truetype');
}
@font-face {
    font-family: 'Advent Pro';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/static/fonts/AdventPro-Medium.ttf') format('truetype');
}
@font-face {
    font-family: 'Advent Pro';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/static/fonts/AdventPro-Bold.ttf') format('truetype');
}

:root {
    color-scheme: dark;

    --bg:          #030304;
    --indigo:      #5A56E0;
    --indigo-text: #7B78F0;
    --dim:         #9C9AD4;
    --border:      #302D75;

    --sans: 'Advent Pro', -apple-system, BlinkMacSystemFont, "Segoe UI",
            Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: clamp(0.75rem, 2.5vw, 1.5rem);
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--dim);
    font-family: var(--sans);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Framed, centered container */
.page {
    max-width: 44rem;
    margin: 0 auto;
    min-height: calc(100vh - 2 * clamp(0.75rem, 2.5vw, 1.5rem));
    border: 1px solid var(--border);
    padding: clamp(2rem, 6vw, 3.5rem);
}

/* --- intro --- */

.namerow {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}


/* Sized to the h1's line box (1.75rem x 1.15), so the die is never taller than
   the name beside it. It is framed to fill about 92% of the canvas at its
   widest rotation, so nothing clips as it turns. */
.dice {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    line-height: 0;
}

.dice img,
.dice canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* dice.js sets this once WebGL is up, so the static fallback gets out of the
   way rather than sitting behind the canvas. */
.dice.is-live img {
    display: none;
}

.name {
    margin: 0;
    color: var(--indigo);
    font-family: var(--sans);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    line-height: 1.15;
}

/* The release tag rides the title, because it names the thing rather than the
   link below it. text-transform is cleared so the leading v stays a v, and the
   dots get weight 500 for the same reason the github link does. */
.ver {
    margin-left: 0.15em;
    color: var(--dim);
    font-size: 0.55em;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: none;
    vertical-align: 0.32em;
}

/* Weight 500, not 400: Advent Pro's period is a very small glyph, and at this
   size in Regular it nearly vanishes against a dark background. These are
   domain names, so the dots have to read. */
.gh {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--dim);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

.gh:hover,
.gh:focus-visible {
    color: var(--indigo-text);
    text-decoration-color: var(--indigo-text);
}

.gh:focus-visible {
    outline: 1px solid var(--indigo-text);
    outline-offset: 0.4rem;
}

@media (prefers-reduced-motion: no-preference) {
    .gh {
        transition: color 140ms ease, text-decoration-color 140ms ease;
    }
}

.meta {
    margin: 0.5rem 0 0;
}

.meta .gh {
    margin-top: 0;
}

.dot {
    margin: 0 0.45rem;
    color: var(--dim);
    font-weight: 500;
    opacity: 0.55;
}

/* A button, not a link: it opens a dialog rather than going anywhere. Styled to
   sit beside the github link without looking like a control. */
.contact-open {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

/* --- contact modal --- */

.modal {
    width: min(30rem, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid var(--border);
    background-color: var(--bg);
    color: var(--dim);
}

/* Light touch: the page should still read behind the panel. The scrim does more
   to hide it than the blur does, so it stays low. */
.modal::backdrop {
    background-color: rgba(3, 3, 7, 0.3);
    backdrop-filter: blur(2.5px);
    -webkit-backdrop-filter: blur(2.5px);
}

.modal-panel {
    padding: clamp(1.5rem, 5vw, 2rem);
}

.modal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-title {
    margin: 0;
    color: var(--indigo);
    font-family: var(--sans);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.modal-close {
    padding: 0;
    border: 0;
    background: none;
    color: var(--dim);
    font-family: var(--sans);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover,
.modal-close:focus-visible {
    color: var(--indigo-text);
}

.field {
    display: block;
    margin-bottom: 1.1rem;
}

.field > span {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--indigo-text);
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.field input,
.field textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    background-color: rgba(90, 86, 224, 0.06);
    color: var(--dim);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.5;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--indigo-text);
}

.turnstile {
    margin-bottom: 1rem;
    min-height: 65px;
}

.modal-status {
    margin: 0 0 1rem;
    font-size: 0.9rem;
    min-height: 1.4em;
    color: var(--dim);
    opacity: 0.8;
}

.modal-status.is-ok {
    color: var(--indigo-text);
    opacity: 1;
}

.modal-status.is-error {
    color: #E08B8B;
    opacity: 1;
}

.modal-send {
    padding: 0;
    border: 0;
    background: none;
    color: var(--indigo-text);
    font-family: var(--sans);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
    cursor: pointer;
}

.modal-send:hover:not(:disabled),
.modal-send:focus-visible:not(:disabled) {
    color: var(--dim);
    text-decoration-color: var(--indigo-text);
}

.modal-send:disabled {
    opacity: 0.4;
    cursor: default;
}

/* --- project page --- */

.back {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: var(--dim);
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

.back:hover,
.back:focus-visible {
    color: var(--indigo-text);
    text-decoration-color: var(--indigo-text);
}

.lede {
    margin: 1rem 0 0;
    color: var(--dim);
    font-size: 1rem;
}

.demo {
    display: block;
    width: 100%;
    height: auto;
    margin-top: 2.25rem;
    border: 1px solid var(--border);
    background-color: #000;
}

.embed {
    margin-top: 2.25rem;
    aspect-ratio: 16 / 9;
    border: 1px solid var(--border);
    background-color: #000;
}

.embed iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.filelist {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}

.filelist li {
    margin-bottom: 0.8rem;
}

.filelist a {
    color: var(--indigo-text);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

.filelist a:hover,
.filelist a:focus-visible {
    text-decoration-color: var(--indigo-text);
}

.filelist .meta {
    display: block;
    margin-top: 0.15rem;
    color: var(--dim);
    font-size: 0.9rem;
    opacity: 0.9;
}

.shot {
    margin: 2rem 0 0;
}

.shot img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    background-color: #000;
}

.shot figcaption {
    margin-top: 0.6rem;
    color: var(--dim);
    font-size: 0.9rem;
    opacity: 0.9;
}

.code {
    margin: 1.25rem 0 2rem;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    background-color: rgba(90, 86, 224, 0.07);
    color: var(--dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre;
}

/* Tall, narrow boards: cap the height so they don't run off the screen.
   Sizing by height also gives the set a common baseline. */
.shot--tall img {
    width: auto;
    max-width: 100%;
    max-height: 34rem;
    margin: 0 auto;
}

.shot--tall figcaption {
    text-align: center;
}

.prose {
    margin: 0 0 1rem;
    color: var(--dim);
    font-size: 1rem;
}

.group {
    margin-top: 2.75rem;
}

.group h2 {
    margin: 0 0 1rem;
    color: var(--indigo);
    font-family: var(--sans);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.group h3 {
    margin: 2.25rem 0 0;
    color: var(--indigo-text);
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.group li {
    position: relative;
    margin: 0 0 0.6rem;
    padding-left: 1.1rem;
    color: var(--dim);
    font-size: 0.95rem;
}

.group li::before {
    content: "\2014";
    position: absolute;
    left: 0;
    color: var(--border);
}

/* Captions around a table: clearly secondary to the figures themselves. */
.note {
    margin: 0 0 1rem;
    color: var(--dim);
    font-size: 0.85rem;
    opacity: 0.65;
}

.table-scroll + .note {
    margin: 0 0 0.5rem;
}

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

/* Bit-field diagram. Field widths are only loosely to scale: a true 8/1024
   opcode would be under a pixel wide. Exact widths are labelled instead. */
.bitfield {
    display: block;
    width: 100%;
    height: auto;
    margin: 1.25rem 0 2rem;
}

.bitfield .bf-box rect {
    fill: rgba(90, 86, 224, 0.10);
    stroke: var(--border);
    stroke-width: 1;
}

.bitfield .bf-name text {
    fill: var(--indigo-text);
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.bitfield .bf-range text {
    fill: var(--dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
}

.bitfield .bf-size text {
    fill: var(--dim);
    font-family: var(--sans);
    font-size: 12px;
    opacity: 0.8;
}

.bitfield .bf-rule path {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    fill: none;
}

/* Ties the vector field to the pin slots it expands into. */
.bitfield .bf-funnel {
    fill: rgba(90, 86, 224, 0.06);
    stroke: none;
}

/* Layered stack diagram */
.stack {
    display: block;
    width: 100%;
    height: auto;
    margin: 1.75rem 0 2rem;
}

.stack .s-box rect {
    fill: rgba(90, 86, 224, 0.10);
    stroke: var(--border);
    stroke-width: 1;
}

.stack .s-badge text {
    fill: var(--indigo);
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.stack .s-name text {
    fill: var(--indigo-text);
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.stack .s-ask text {
    fill: var(--dim);
    font-family: var(--sans);
    font-size: 13px;
}

.stack .s-has text {
    fill: var(--dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
    opacity: 0.85;
}

/* Architecture block diagram */
.arch {
    display: block;
    width: 100%;
    height: auto;
    margin: 1.75rem 0 2rem;
}

.arch .a-box rect {
    fill: rgba(90, 86, 224, 0.10);
    stroke: var(--border);
    stroke-width: 1;
}

.arch .a-name text {
    fill: var(--indigo-text);
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.arch .a-sub text {
    fill: var(--dim);
    font-family: var(--sans);
    font-size: 13px;
}

.arch .a-line path {
    stroke: var(--border);
    stroke-width: 1.5;
    fill: none;
}

.arch marker path {
    fill: var(--border);
    stroke: none;
}

.table-scroll {
    overflow-x: auto;
    margin: 1.25rem 0 2rem;
}

.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    line-height: 1.45;
}

.data th {
    padding: 0 1.25rem 0.45rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--indigo-text);
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-align: left;
    white-space: nowrap;
}

.data td {
    padding: 0.45rem 1.25rem 0.45rem 0;
    border-bottom: 1px solid rgba(48, 45, 117, 0.35);
    color: var(--dim);
    vertical-align: top;
}

/* The closing rule reads as a divider against whatever follows. */
.data tbody tr:last-child td {
    border-bottom: none;
}

.data td:nth-child(2),
.data td:nth-child(3),
.data th:nth-child(2),
.data th:nth-child(3) {
    text-align: right;
    white-space: nowrap;
}

.data td:nth-child(2) {
    color: var(--indigo-text);
}

.data td.na {
    opacity: 0.4;
}

/* Third column is a description rather than a figure: let it wrap and sit
   left, and give it the leftover width. */
.data--desc th:nth-child(3),
.data--desc td:nth-child(3) {
    width: 100%;
    text-align: left;
    white-space: normal;
}

.data--desc td:first-child {
    color: var(--indigo-text);
    white-space: nowrap;
}

.data--desc td:nth-child(2) {
    color: var(--dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
}

.group code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85em;
    color: var(--indigo-text);
}

/* --- links --- */

.links {
    margin-top: 2.75rem;
}

.links ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.links li + li {
    margin-top: 1.6rem;
}

.links a {
    color: var(--indigo-text);
    font-family: var(--sans);
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--border);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.3em;
}

.desc {
    margin: 0.4rem 0 0;
    color: var(--dim);
    font-size: 0.95rem;
}

@media (prefers-reduced-motion: no-preference) {
    .links a {
        transition: color 140ms ease, text-decoration-color 140ms ease;
    }
}

.links a:hover,
.links a:focus-visible {
    color: var(--dim);
    text-decoration-color: var(--indigo-text);
}

.links a:focus-visible {
    outline: 1px solid var(--indigo-text);
    outline-offset: 0.4rem;
}
