/* demist website — one stylesheet for a one-page site.
   The palette, spacing and radius tokens are the app's (app/htdocs/styles/base.css),
   kept to a subset, so the site and the app look like the same product. */

:root {
    color-scheme: light dark;

    --primary-color: #007bff;
    --primary-hover-color: #0056b3;
    --background-color: light-dark(#ffffff, #1a1a1a);
    --surface-color: light-dark(#f8f9fa, #242424);
    --text-color: light-dark(#333333, #e5e7eb);
    --text-strong-color: light-dark(#1e293b, #f0f1f3);
    --text-muted-color: light-dark(#64748b, #94a3b8);
    --border-color: light-dark(#dee2e6, #3a3a3a);

    /* The icons are black line art, so they need inverting on a dark background. */
    --icon-filter: none;

    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    --border-radius-md: 8px;
    --border-radius-lg: 12px;

    --content-width: 60rem;
}

@media (prefers-color-scheme: dark) {
    :root { --icon-filter: invert(1); }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
}

h1, h2, h3 {
    color: var(--text-strong-color);
    line-height: 1.25;
}

a {
    color: var(--primary-color);
}

img {
    max-width: 100%;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-strong-color);
    text-decoration: none;
}

/* The brand hand inverts with the line art in dark mode — black hand, white
   stroke — as on the ai site. */
.brand img {
    filter: var(--icon-filter);
}

.site-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    margin-inline-start: auto;
}

.site-navigation a {
    color: var(--text-color);
    text-decoration: none;
}

.site-navigation a:hover {
    color: var(--primary-color);
}

.language-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* The market's control, which borrowed it from the app (styles/settings.css
   there): no icon, the slate chevron drawn over the right edge instead of
   the native arrow, pointing up while the picker is open. */
.language-selector select {
    box-sizing: border-box;
    height: 2rem;
    padding-block: 0.2rem;
    padding-inline: 0.45rem 1.75rem;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    appearance: none;
    /* No focus ring (the browser draws one even for mouse opens): a focused
       menu keeps its resting frame, and the chevron alone tells the open
       state. */
    outline: none;
    background: var(--background-color)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        no-repeat right 0.5rem center;
}

.language-selector select:open {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 6.5 6 1.5 11 6.5' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Sections */

main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

section {
    padding: var(--spacing-xxl) 0;
    border-bottom: 1px solid var(--border-color);
}

section:last-child {
    border-bottom: none;
}

.hero {
    text-align: center;
    padding-top: var(--spacing-xxl);
}

.hero h1 {
    margin: 0 0 var(--spacing-md);
    font-size: clamp(2rem, 5vw, 3rem);
}

.lead {
    max-width: 45rem;
    margin: 0 auto var(--spacing-xl);
    font-size: 1.15rem;
}

/* The alpha network */

/* Compact on purpose: a light, four figures and where they come from. The
   generous section padding above would turn a strip into a page of its own. */
.network {
    padding: var(--spacing-lg) 0;
}

.network-state {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: 0 0 var(--spacing-md);
    font-weight: 600;
    color: var(--text-strong-color);
}

/* Green while the chain is producing blocks, red otherwise. The word beside it
   says the same thing, so the state never rests on color alone — red and green
   are nearly one color to a red-green colorblind reader. */
.network-light {
    flex: none;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--network-light-color, var(--text-muted-color));
}

.network[data-state="running"] { --network-light-color: light-dark(#16a34a, #4ade80); }
.network[data-state="stopped"],
.network[data-state="unknown"] { --network-light-color: light-dark(#dc2626, #f87171); }

.network-figures {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md) var(--spacing-xl);
    margin: 0;
}

.network-figures dt {
    font-size: 0.9rem;
    color: var(--text-muted-color);
}

.network-figures dd {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-strong-color);
    /* Figures that change under the reader must not shift width as they do. */
    font-variant-numeric: tabular-nums;
}

/* The indexer is a name, not a figure: set at reading size beside numbers
   meant to be caught at a glance, so it labels the row rather than joining it. */
.network-figures dd.network-indexer {
    font-size: 1rem;
}

/* Buttons */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.hero .actions,
.alpha .actions,
.open .actions,
.newsletter .actions {
    justify-content: center;
}

.button {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    background: var(--background-color);
    border: 2px solid var(--primary-color);
    border-radius: var(--border-radius-md);
}

.button:hover {
    background: var(--surface-color);
}

.button.primary {
    color: #ffffff;
    background: var(--primary-color);
}

.button.primary:hover {
    background: var(--primary-hover-color);
    border-color: var(--primary-hover-color);
}

/* Alpha campaign */

.alpha {
    text-align: center;
}

.alpha .dates {
    margin: 0 0 var(--spacing-md);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.alpha > p:not(.dates):not(.note) {
    max-width: 45rem;
    margin-inline: auto;
}

.steps {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    margin: var(--spacing-xl) 0;
    padding: 0;
    text-align: start;
    list-style: none;
    counter-reset: step;
}

.steps li {
    padding: var(--spacing-lg);
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    counter-increment: step;
}

.steps h3 {
    margin: 0 0 var(--spacing-sm);
}

.steps h3::before {
    content: counter(step) ". ";
    color: var(--primary-color);
}

.steps p {
    margin: 0;
}

.note {
    font-size: 0.95rem;
    color: var(--text-muted-color);
}

/* Cards */

.cards {
    display: grid;
    gap: var(--spacing-lg);
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    margin: var(--spacing-xl) 0 0;
    padding: 0;
    list-style: none;
}

.cards li {
    padding: var(--spacing-lg);
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
}

.cards img {
    filter: var(--icon-filter);
}

.cards h3 {
    margin: var(--spacing-sm) 0;
}

.cards p {
    margin: 0 0 var(--spacing-sm);
}

/* Donations */

.donation-methods {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--spacing-sm) var(--spacing-lg);
    align-items: baseline;
    margin: var(--spacing-lg) 0;
}

.donation-methods dt {
    font-weight: 600;
    color: var(--text-strong-color);
}

.donation-methods dd {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow-wrap: anywhere;
}

/* Sponsors */

.sponsors-title {
    margin: var(--spacing-xl) 0 var(--spacing-md);
}

.sponsors {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: var(--spacing-lg);
}

/* The logo and the name are one link, as the site's own brand is: a sponsor's
   mark and their name point at the same place, and two links side by side to
   one page are one link too many. */
.sponsor {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-strong-color);
    text-decoration: none;
}

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

/* A sponsor's logo is their own artwork, in their own colors: it must NOT go
   through the --icon-filter that inverts this site's black line art for dark
   mode, which would repaint someone else's mark. */
.sponsor img {
    flex: none;
    filter: none;
}

.sponsors p {
    margin: var(--spacing-sm) 0 0;
    color: var(--text-muted-color);
}

/* Footer */

.site-footer {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-xxl);
    color: var(--text-muted-color);
    text-align: center;
}

.site-footer p {
    margin: var(--spacing-sm) 0;
}

@media (max-width: 40rem) {
    .site-navigation {
        order: 3;
        width: 100%;
        margin-inline-start: 0;
        justify-content: space-between;
        gap: var(--spacing-md);
        font-size: 0.95rem;
    }

    .language-selector {
        margin-inline-start: auto;
    }

    .donation-methods {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .donation-methods dd {
        margin-bottom: var(--spacing-md);
    }
}

/* Under a right-to-left language the chevron follows the padding-inline-end
   to the left; background-position is physical and needs saying explicitly. */
.language-selector select:dir(rtl) {
    background-position: left 0.5rem center;
}
