@font-face {
    font-family: 'Euphorigenic';
    src: url('/fonts/Euphorigenic-Regular.woff2') format('woff2'),
        url('/fonts/Euphorigenic-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Helgoland';
    src: url('HelgolandRegular.woff2') format('woff2'),
        url('HelgolandRegular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Sen';
    src: url('Sen-Regular.woff2') format('woff2'),
        url('Sen-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'NewAmsterdam';
    src: url('NewAmsterdam-Regular.woff2') format('woff2'),
        url('NewAmsterdam-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'BarberChop';
    src: url('BarberChop-Regular.woff2') format('woff2'),
        url('BarberChop-Regular.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #1c1b1c;
    --bgl: #372938;
    --fg: #f0cfc7;
    --fgl: #DCA06D;
    --fgWeak: #c1a9a4;

    --center-width: 300px; /* fixed opaque center width */
    --center-half: calc(var(--center-width) / 2);
    --fade-width: 200px;

    --article-width: 600px;
    
    /* font size for rem scaling */
    font-size: 17px;
    --title-size: 2.5rem;
    --subtitle-size: 0.9rem;
    --md-h1-size: 1.8rem;
    --md-h2-size: 1.6rem;
    --md-h3-size: 1.4rem;
    --md-p-size: 1rem;   
}

header {
    margin: 0;
    margin-bottom: 14px;
    font-family: 'Sen';
    font-size: 24px;
    font-weight: bolder;
    background-color: var(--fgl);
    color: black;
    text-align: center;

    /* funky background */
    background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.15) 0 8px, transparent 8px 16px);
    background-blend-mode: multiply;
    -webkit-mask-image: linear-gradient(
        to right,
        transparent calc(50% - var(--center-half) - var(--fade-width)),
        black calc(50% - var(--center-half)),
        black calc(50% + var(--center-half)),
        transparent calc(50% + var(--center-half) + var(--fade-width))
    );
    mask-image: linear-gradient(
        to right,
        transparent calc(50% - var(--center-half) - var(--fade-width)),
        black calc(50% - var(--center-half)),
        black calc(50% + var(--center-half)),
        transparent calc(50% + var(--center-half) + var(--fade-width))
    );
}

body {
    color: var(--fgl);
    background-color: black;
    margin: 0
}

body, button, input, textarea {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
    /* Provide a smooth font rendering base */
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

#articles {
    display: flex;
    flex-direction: column;
    align-items: center; /* centers child articles horizontally */
    width: 100%;
    gap: 32px;
    box-sizing: border-box;
    padding: 0 1rem 0 1rem
}

article {
    margin: 0px;
    min-width: min-content;
    width: var(--article-width);
    max-width: 100%;
    box-sizing: border-box;
    /* enable container queries for better title scaling */
    container-type: inline-size;
    container-name: article;
}

.separator {
    /* a thin horizontal separator that's full color on the left and fades to transparent on the right */
    display: block;
    margin-top: 24px;
    margin-bottom: 12px;
    margin-left: 0;
    margin-right: clamp(-5%, -2vw, 0);
    height: clamp(1px, 0.3vw, 2px);
    background: linear-gradient(90deg, var(--fgl) 20%, transparent 100%);
    opacity: 0.8;
    pointer-events: none;
}

article:last-child .separator {
    opacity: 0;
}


/* article top level */
article h1 {
    margin: 0;
    font-family: 'NewAmsterdam';
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    font-size: var(--title-size);
    color: var(--fgl);
}

/* Conditional shrink: compute an estimated font size from container width and title length.
   Only applied in browsers with container query units support. */
@supports (font-size: 1cqw) {
    article h1 {
        /* estimated size = containerWidth / (charCount * charK)
           charK ~ average character width in ems; tweak as needed for the chosen font. */
        font-size: clamp(
            1rem,
            calc(100cqw / (var(--title-chars, 20) * var(--charK, 0.4))),
            var(--title-size)
        );
    }
}

/* clickable self-link anchor styling */
article h1 a.article-title__anchor {
    position: relative;
    color: inherit;
    text-decoration: none;
    display: inline-block;
    padding-right: 0.75em; /* space for paragraph indicator */
    transition: color 0.2s ease;
}

article h1 a.article-title__anchor:hover,
article h1 a.article-title__anchor:focus {
    color: var(--fg);
}

/* paragraph sign indicator appears on hover/focus to hint copy/link behavior */
article h1 a.article-title__anchor::after {
    content: '\00B6'; /* pilcrow sign */
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-55%);
    font-size: 0.6em;
    opacity: 0;
    color: var(--fgl);
    transition: opacity 0.2s ease, color 0.2s ease;
    pointer-events: none;
}

article h1 a.article-title__anchor:hover::after,
article h1 a.article-title__anchor:focus::after {
    opacity: 0.85;
    color: var(--fg);
}

article h2 {
    margin: 0;
    margin-bottom: 12px;
    font-family: 'Sen';
    font-weight: 100;
    font-size: var(--subtitle-size);
    color: var(--fgl);
}

/* markdown specific */
.md h1 {
    margin: 0;
    margin-top: 1.5rem;
    margin-bottom: 0.2rem;
    font-family: 'NewAmsterdam';
    /* font-weight: 1000; */
    font-size: var(--md-h1-size);
    color: var(--fgl);
}

.md h2 {
    margin: 0;
    margin-top: 1.2rem;
    margin-bottom: 0.2rem;
    font-family: 'NewAmsterdam';
    /* font-weight: 500; */
    font-size: var(--md-h2-size);
    color: var(--fgl);
}

.md h3 {
    margin: 0;
    margin-top: 1.2rem;
    margin-bottom: 0.2rem;
    font-family: 'NewAmsterdam';
    font-weight: 100;
    font-size: var(--md-h3-size);
    color: var(--fgl);
}

.md p {
    font-family: 'Sen';
    font-size: var(--md-p-size);
    color: var(--fg);
    margin: 0;
    /* margin-top: 0.7rem;
    margin-bottom: 0.7rem; */
    /* margin-left: 8px; */
}

.md p + p {
    margin-top: 0.7rem;
}

.md a
{
    color: var(--fgl);
}

.md ol {
    padding-left: 1.2rem;
    padding-right: 0.2rem;
    color:var(--fg)
}

.md div.breather {
    margin: 0;
    padding: 0;
    padding-top:2em;
}

.md blockquote {
    background-color: rgba(255,255,255,0.1);
}

.md blockquote p {
    color: var(--fgWeak)
}


/* Tables: full-width, centered, regular text color; use .important / <mark> for highlights */

.md .table-wrap {
    width: 100%;
    margin: 0.75rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.md table {
    width: 100%;
    margin-top: 0.8rem;
    margin-bottom: 0.8rem;
    /* margin: 0 auto; */
    border-collapse: collapse;
    border-spacing: 0;
    font-family: 'Sen';
    font-size: var(--md-p-size);
    color: var(--fg); /* regular text color inside tables */
}

/* cells */
.md table th,
.md table td {
    padding: 0.5rem 0.57rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* header styling (subtle emphasis) */
.md table thead th {
    color: var(--fgl);
    font-weight: 600;
    background: rgba(255,255,255,0.3);
}

/* soft zebra for readability */
.md table tr:nth-child(even) td {
    background: rgba(255,255,255,0.1);
}

.md table tr:nth-child(odd) td {
    background: rgba(255,255,255,0.15);
}

/* highlight via semantic <mark> */
.md table mark {
    background: var(--fgl);
    color: #000;
    padding: 0.08em 0.35em;
    border-radius: 3px;
    font-weight: 600;
}

#footer-nav {
    /* position:fixed; */
    /* left:0; */
    /* bottom: 0; */
    padding: 3px;
    margin: 0;
    opacity: 1;
    /* background-color: #000; */
}

#footer-nav a {
    font-family: monospace;
    color: var(--fgl);
    text-decoration: none;
    text-decoration-skip-ink: none;
}

footer {
    margin-bottom: 0.5rem;
}

.image-gallery {
    margin-top: 1.3rem;
    margin-bottom: 0.6rem;

    display: flex;
    flex-flow: wrap;
    gap: 0.7rem;
    
    /* keep columns from stretching to fill the row so the whole grid can be centered */
    /* grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 20vw, 125px), max-content)); */
    /* gap: 1rem; */
    /* center the whole grid tracks horizontally when there's extra space */
    justify-content: center;
    /* center items inside each grid cell */
    justify-items: center;
}

.image-gallery a {
    max-width: 48%;
 }
/* When there is only one item in the gallery, let it span full width */
.image-gallery a:only-child {
    max-width: 100%;
}

.image-gallery img {
    width: 100%;
    height: clamp(170px, 30vw, 200px);
    object-fit: cover;
    border-radius: 8px;
    background-color: #111;
    /* subtle interactive affordance */
    transform: translateY(0) scale(1); /* establish base transform for smoother interpolation */
    transition: transform 260ms cubic-bezier(.15,.65,.25,1), box-shadow 260ms ease;
    cursor: zoom-in; /* hint that clicking opens larger view */
}

.image-gallery.custom-size img {
    width: var(--width);
    height: var(--height);
}

/* hover / keyboard focus: gentle lift + slight scale */
.image-gallery img:hover,
.image-gallery img:focus-visible {
    transform: translateY(-4px) scale(1.025);
}

/* @media (prefers-color-scheme: dark) {
} */

/* Overlay container hidden by default; shown when targeted */
.lightbox {
    position: fixed;
    inset: 0;
    display: none; /* becomes flex when targeted */
    align-items: center;
    justify-content: center;
    /* dark overlay */
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    padding: 2rem;
    cursor: zoom-out; /* hint that clicking will close */
}

.lightbox:target {
    display: flex;
}

.lightbox__inner {
    display: grid;
    align-items: center;
    justify-items: center;
    border-radius: 12px;
    max-width: 95vw;
    max-height: 95vh;
    overflow: visible; /* allow image to determine size */
}

.lightbox__inner img {
    grid-area: 1 / 1;
    display: block;
    width: auto;
    height: auto;
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain; /* ensure full image is visible without cropping */
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

.lightbox__inner .placeholder {
    filter: blur(6px);
    transform: scale(0.99); /* hide blur edges */
    z-index: 1;
}

.lightbox__inner .hires {
    z-index: 2;
    background-color: transparent;
}

/* subtle close hint */
.lightbox:target::after {
    content: 'x';
    position: fixed;
    top: 12px;
    right: 16px;
    color: #fff;
    font-family: 'Sen', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0.02em;
    opacity: 0.75;
    z-index: 3;
}