/* fonts, the same families as destack.sh */
@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url("/fonts/ibm-plex-sans.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
        U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url("/fonts/ibm-plex-sans-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
        U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
        U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "IBM Plex Mono";
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Mono";
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/ibm-plex-mono-600.woff2") format("woff2");
}

@font-face {
    font-family: "Limelight";
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/limelight.woff2") format("woff2");
}

/* tokens: the lattice of destack.sh, drawn in the colours of its universe */
:root {
    color-scheme: dark;
    --width: min(1200px, calc(100vw - 48px));
    --bar: 64px;
    --inset: 24px;
    --space: #081723;
    --cream: #f1eadb;
    --soft: rgb(241 234 219 / 62%);
    --rule: rgb(241 234 219 / 18%);
    --signal: #ff792e;
    --signal-ink: #12313c;
    --sans: "IBM Plex Sans", system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --poster: "Limelight", "Futura", "Arial Black", sans-serif;
}

/* switch to four full-width columns on phones */
@media (max-width: 767px) {
    :root {
        --width: 100vw;
        --bar: 56px;
        --inset: 20px;
    }
}

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

html,
body {
    margin: 0;
    overflow-x: clip;
}

/* stack the bars and the page into one screen, over the sky */
body {
    background: var(--space) url("/stars.svg");
    color: var(--cream);
    display: grid;
    font-family: var(--sans);
    font-size: 1.0625rem;
    grid-template-rows: auto 1fr auto;
    line-height: 1.55;
    min-height: 100svh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: var(--signal);
    color: var(--signal-ink);
}

/* the sky shader, faded in once it paints */
.sky {
    height: 100%;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    transition: opacity 600ms ease;
    width: 100%;
    z-index: -1;
}

.sky.is-painted {
    opacity: 1;
}

/* the twelve-column frame and its rules */
.frame {
    border-inline: 1px solid var(--rule);
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    margin-inline: auto;
    max-width: var(--width);
    width: 100%;
}

.rule-right {
    border-right: 1px solid var(--rule);
}

.rule-left {
    border-left: 1px solid var(--rule);
}

@media (max-width: 767px) {
    .frame {
        border-inline-width: 0;
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* top and bottom bars */
.bar {
    align-items: stretch;
    font-size: 0.875rem;
    height: var(--bar);
}

header.bar {
    border-bottom: 1px solid var(--rule);
}

footer.bar {
    border-top: 1px solid var(--rule);
}

.brand {
    align-items: center;
    display: flex;
    font-weight: 600;
    grid-column: span 3;
    padding-inline: var(--inset);
}

.links {
    display: grid;
    grid-column: 9 / span 4;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.links a {
    align-items: center;
    display: flex;
    justify-content: center;
}

.brand:hover,
.links a:hover,
.legal-links a:hover,
.legal a:hover {
    color: var(--signal);
}

.company {
    align-items: center;
    color: var(--soft);
    display: flex;
    font-family: var(--mono);
    font-size: 0.75rem;
    grid-column: span 8;
    padding-inline: var(--inset);
}

.legal-links {
    align-items: center;
    display: flex;
    gap: 1.5rem;
    grid-column: span 4;
    justify-content: flex-end;
    padding-inline: var(--inset);
}

@media (max-width: 767px) {
    .brand {
        grid-column: span 2;
    }

    .links {
        grid-column: span 2;
    }

    footer.bar {
        height: auto;
    }

    .company,
    .legal-links {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-block: 0.875rem;
    }

    .legal-links {
        border-top: 1px solid var(--rule);
    }
}

/* the poster: the dictionary entry beside the planet, filling the one screen between the bars */
main {
    display: grid;
}

.poster {
    grid-template-rows: minmax(0, 1fr);
}

.entry {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    grid-column: 1 / span 8;
}

/* the wordmark: letters of starry space outlined in cream, spaced evenly, with the dictionary dot between the syllables */
/* size it so the letters, 5.1 ems wide in all, fill about 84% of the column */
.wordmark {
    border-bottom: 1px solid var(--rule);
    display: flex;
    font-family: var(--poster);
    font-size: calc((100cqi - 2 * var(--inset)) / 6.1);
    font-weight: 400;
    line-height: 1;
    margin: 0;
    padding: 0.12em var(--inset) 0.04em;
}

.letter {
    background: var(--space) url("/stars.svg");
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
    transform: scaleX(1.2);
    -webkit-text-stroke: 1.5px var(--cream);
}

/* shift each letter's view of the stars, since transformed letters each start the tile afresh */
.letter:nth-of-type(2) { background-position: 97px 53px; }
.letter:nth-of-type(3) { background-position: 194px 106px; }
.letter:nth-of-type(4) { background-position: 51px 39px; }
.letter:nth-of-type(5) { background-position: 148px 92px; }
.letter:nth-of-type(6) { background-position: 5px 25px; }

.gap {
    align-items: center;
    display: flex;
    flex-grow: 1;
    justify-content: center;
}

.dot {
    background: var(--signal);
    border: 1.5px solid var(--cream);
    border-radius: 50%;
    height: 0.12em;
    translate: 0 -0.05em;
    width: 0.12em;
}

.definition {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
    padding: 1.5rem var(--inset) 2rem;
}

.kicker {
    align-items: baseline;
    align-self: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.75rem;
}

.headword {
    color: var(--signal);
    font-size: 1.25rem;
    font-weight: 600;
}

.pronunciation,
.origin,
.source {
    color: var(--soft);
    font-family: var(--mono);
    font-size: 0.8125rem;
}

.part {
    color: var(--soft);
    font-style: italic;
}

.origin {
    margin: 0.5rem 0 0;
    max-width: 44rem;
}

.senses {
    display: grid;
    font-size: 1.125rem;
    gap: 0.75rem;
    margin: 1.25rem 0 0;
    max-width: 44rem;
    padding-left: 1.5rem;
}

.senses li::marker {
    color: var(--signal);
    font-family: var(--mono);
    font-size: 0.875rem;
}

.field {
    color: var(--soft);
    font-style: italic;
}

.source {
    display: block;
    font-style: normal;
    margin-top: 1rem;
}

.statement {
    border-top: 1px solid var(--rule);
    font-size: clamp(1.375rem, 2.2vw, 1.75rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    margin: 0;
    padding: 1.25rem var(--inset) 1.5rem;
}

.statement a {
    color: var(--signal);
}

.statement a:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* the side: the Destack plate on top, the company's numbered rows below */
.side {
    display: flex;
    flex-direction: column;
    grid-column: 9 / span 4;
}

.plate {
    align-items: center;
    background: rgb(4 12 19 / 30%);
    border: 2px solid rgb(241 234 219 / 85%);
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.75rem;
    padding: 1.5rem var(--inset) var(--inset);
    text-align: center;
}

.plate img {
    animation: float 9s ease-in-out infinite;
    display: block;
    margin-bottom: 0.75rem;
    transition: rotate 700ms cubic-bezier(0.3, 1.4, 0.5, 1), scale 700ms cubic-bezier(0.3, 1.4, 0.5, 1),
        filter 700ms ease;
    width: min(70%, 14rem);
}

.plate:hover img {
    filter: drop-shadow(0 0 1.5rem rgb(255 121 46 / 35%));
    rotate: -10deg;
    scale: 1.06;
}

.name {
    font-family: var(--poster);
    font-size: 1.75rem;
    line-height: 1;
}

.tagline {
    color: var(--soft);
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
    max-width: 17rem;
}

.visit {
    align-self: stretch;
    background: var(--signal);
    box-shadow: 3px 3px 0 var(--cream);
    color: var(--signal-ink);
    font-size: 0.9375rem;
    font-weight: 600;
    padding-block: 0.625rem;
}

.plate:hover .visit {
    background: color-mix(in srgb, var(--signal) 88%, white);
}

@keyframes float {
    50% {
        translate: 0 -0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .plate img {
        animation: none;
        transition: none;
    }
}

@media (max-width: 1099px) {
    .entry {
        grid-column: 1 / span 7;
    }

    .side {
        grid-column: 8 / span 5;
    }
}

@media (max-width: 767px) {
    .entry,
    .side {
        border-right-width: 0;
        grid-column: 1 / -1;
    }

    .side {
        border-top: 1px solid var(--rule);
    }
}

/* legal pages */
.legal {
    grid-column: 3 / span 8;
    padding: 2.5rem var(--inset) 4rem;
}

.legal h1 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 1.5rem;
}

.legal h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 2rem 0 0.5rem;
}

.legal p {
    margin: 0 0 0.75rem;
}

.legal dl {
    display: grid;
    gap: 0.25rem 1.5rem;
    grid-template-columns: max-content minmax(0, 1fr);
    margin: 0;
}

.legal dt {
    color: var(--soft);
}

.legal dd {
    margin: 0;
}

.legal a {
    text-decoration: underline;
    text-decoration-color: var(--rule);
    text-underline-offset: 0.2em;
}

@media (max-width: 1099px) {
    .legal {
        grid-column: 1 / -1;
    }
}

@media (max-width: 767px) {
    .legal dl {
        grid-template-columns: minmax(0, 1fr);
    }

    .legal dd {
        margin-bottom: 0.75rem;
    }
}

/* placeholders for details still to fill in */
mark {
    background: rgb(255 121 46 / 30%);
    color: inherit;
    padding-inline: 0.2em;
}
