/* ─────────────────────────────────────────────────────────────────────────
   chromata-nexus  ·  static/css/main.css
   ───────────────────────────────────────────────────────────────────────── */

/* ── Tokens — overridden by palette script before first paint ────────────── */
:root {
    --bg: #1f1f3a;
    --bg-r: 31;
    --bg-g: 31;
    --bg-b: 58;
    --fg: rgb(255, 155, 100);
    --fg-r: 255;
    --fg-g: 155;
    --fg-b: 100;

    --fg-sub: rgba(var(--fg-r), var(--fg-g), var(--fg-b), 0.55);
    --fg-tint: rgba(var(--fg-r), var(--fg-g), var(--fg-b), 0.08);

    --font-display: "Fraunces", Georgia, serif;
    --font-slab: "Zilla Slab", Georgia, serif;
    --font-mono: "Recursive", "Courier New", monospace;
    --font-weight-mono: 500;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 19px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100dvh;
    background: var(--bg); /* solid — the only background behind content */
    color: var(--fg);
    font-family: var(--font-mono);
    font-weight: var(--font-weight-mono);
    font-size: 1rem;
    line-height: 1.75;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
}

a {
    color: inherit;
    text-decoration: none;
}
img {
    display: block;
    max-width: 100%;
}
::selection {
    background: var(--fg);
    color: var(--bg);
}

/* ── Skip link ───────────────────────────────────────────────────────────── */
.skip-link {
    position: fixed;
    top: -100%;
    left: 1rem;
    z-index: 100;
    padding: 0.4rem 0.8rem;
    background: var(--fg);
    color: var(--bg);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}
.skip-link:focus {
    top: 1rem;
}

/* ── Right-side image panel ──────────────────────────────────────────────── */
/*
  Hidden on mobile. On desktop it sits fixed on the right portion of the
  viewport. The body background (solid --bg) covers everything behind the
  content on the left.

  Halftone pipeline mirrors chromata's img-wrap exactly:
    ::before  — grey dot grid (radial-gradient #c0c0c0 → #000)
    .bg-image — photo with mix-blend-mode:hard-light
                → image brightness modulates dot size
    contrast(2000%) — thresholds composite to crisp b&w
    ::after   — var(--fg) + mix-blend-mode:multiply → colours the white dots
    mix-blend-mode:screen on wrap — dissolves black field into --bg
*/
.bg-right {
    display: none;
}

.bg-halftone-wrap {
    position: absolute;
    inset: 0;
    isolation: isolate;
    mix-blend-mode: screen;
    overflow: hidden;
}

.bg-halftone-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--fg);
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
}

.bg-halftone::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #c0c0c0, #000);
    background-size: 7px 7px;
    z-index: -1;
}

/*
 * ── Background image position controls ──────────────────────────────────────
 * Edit the three variables below to reposition / resize the image panel.
 *
 *   --bg-panel-width : right panel width — increase to push further left.
 *
 *   --bg-translate-x : horizontal shift of the halftone block (px).
 *                      Negative = shift image left; positive = right.
 *   --bg-translate-y : vertical shift of the halftone block (px).
 *                      Positive = image moves down (subject appears lower).
 *                      Negative = image moves up.
 *
 *   The block has a built-in ±25% buffer before it hits the overflow clip,
 *   so values like -200px / 200px are safe on a 1080p display.
 * ──────────────────────────────────────────────────────────────────────────── */
:root {
    --bg-panel-width:  40%;    /* panel width; larger = image bleeds further left */
    --bg-translate-x:  0px;   /* shift left: use negative px, e.g. -120px        */
    --bg-translate-y:  8%;   /* push down:  use positive px, e.g.  150px        */
}

.bg-halftone {
    position: absolute;
    inset: -25%;
    filter: contrast(2000%);
    overflow: hidden;
    transform: translate(var(--bg-translate-x), var(--bg-translate-y));
}

.bg-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    filter: grayscale(1) brightness(120%) contrast(40%) blur(1px);
    mix-blend-mode: hard-light;
}

/* ── Content card — layout only, no visual box ───────────────────────────── */
.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 680px;
}

/* ── Site header ─────────────────────────────────────────────────────────── */
.site-header {
    margin-bottom: 3.5rem;
}

.site-name {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 900;
    font-variation-settings: "opsz" 9;
    letter-spacing: -0.04em;
    line-height: 0.92;
    color: var(--fg);
    margin-bottom: 1.25rem;
}

.site-tagline {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--fg-sub);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Link list ───────────────────────────────────────────────────────────── */
.link-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 3rem;
}

.link-entry {
    display: block;
    padding: 0.75rem 0;
    color: var(--fg);
    transition: opacity 0.1s ease;
    outline: none;
}

.link-entry:hover,
.link-entry:focus-visible {
    opacity: 0.65;
}

.link-entry:focus-visible {
    outline: 1px solid var(--fg);
    outline-offset: 4px;
}

.link-entry-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.link-entry-icon {
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    line-height: 1;
    opacity: 0.7;
}

.link-entry--featured .link-entry-icon {
    opacity: 1;
}

.link-entry-title {
    font-family: var(--font-slab);
    font-size: 1.1rem;
    font-weight: 500;
}

.link-entry--featured .link-entry-title {
    font-weight: 600;
}

.link-entry-desc {
    font-size: 0.72rem;
    color: var(--fg-sub);
    margin-top: 0.2rem;
    padding-left: calc(1.1rem + 1rem);
    line-height: 1.5;
}

/* ── Footer — chromata style, social links left / Hugo right ─────────────── */
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 4rem;
    padding-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--fg-sub);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
}

.social-link {
    color: var(--fg-sub);
    transition: color 0.1s;
}

.social-link:hover,
.social-link:focus-visible {
    color: var(--fg);
}

.site-footer > a {
    color: var(--fg-sub);
    transition: color 0.1s;
}

.site-footer > a:hover {
    color: var(--fg);
}

/* ── 404 ─────────────────────────────────────────────────────────────────── */
.error-page {
    padding: 2rem 0;
}

.error-code {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-size: 6rem;
    font-weight: 900;
    color: var(--fg);
    line-height: 1;
    letter-spacing: -0.04em;
}

.error-home-link {
    display: inline-block;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--fg-sub);
    transition: color 0.1s;
}
.error-home-link:hover {
    color: var(--fg);
}

/* ── Desktop: content left, image right ──────────────────────────────────── */
@media (min-width: 1024px) {
    body {
        align-items: flex-start;
        justify-content: center;        /* vertically centre — no scroll on 1080p */
        padding: 3rem 2rem 3rem max(3rem, 6vw);
    }

    .card {
        max-width: 520px;
    }

    .site-header {
        margin-bottom: 2rem;
    }

    .link-list {
        margin-bottom: 1.5rem;
    }

    .site-footer {
        position: fixed;
        bottom: 2.5rem;
        left: max(3rem, 6vw);
        width: 520px;
        margin-top: 0;
        padding-top: 0;
    }

    /* Right image panel: fixed, full height */
    .bg-right {
        display: block;
        position: fixed;
        top: 0;
        right: 0;
        width: var(--bg-panel-width);
        height: 100%;
        z-index: 0;
        overflow: hidden;
        background: var(--bg);
    }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    html {
        font-size: 17px;
    }
    body {
        padding: 2rem 1.25rem;
        justify-content: flex-start;
    }
    .site-name {
        font-size: 3rem;
        line-height: 0.92;
    }
    .site-header {
        margin-bottom: 2rem;
    }
    .link-list {
        margin-bottom: 2rem;
    }
    .site-footer {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 2.5rem;
    }
    .footer-social {
        gap: 1.25rem;
    }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0ms !important;
    }
}

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
    .bg-right {
        display: none;
    }
    body {
        background: white;
        color: black;
    }
    .site-name,
    .link-entry-title {
        color: black;
    }
    .site-tagline,
    .link-entry-desc,
    .social-link {
        color: #444;
    }
}
