/* ============================================
   SITE — shared design system (every page). The home page adds home.css.
   Near-black, one red, Anton display, Inter Tight text, JetBrains Mono labels, Instrument Serif accents.
   ============================================ */

:root {
  --bg: #0a0a0a;
  --bg-2: #121211;
  --bg-3: #1a1a19;
  --fg: #f2efe8;
  --text: #d9d5cd;          /* long-form body text on --bg: 13.9:1 */
  --mute: #8f8b83;          /* 5.8:1 on --bg */
  --line: rgba(242, 239, 232, .1);
  --line-2: rgba(242, 239, 232, .2);
  --red: #ff3b2f;           /* type and large shapes: 5.6:1 on --bg */
  --red-btn: #d42a1f;       /* behind white text: 5.06:1 */
  --display: 'Anton', 'Impact', 'Arial Narrow', sans-serif;
  --sans: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --max: 1440px;
  --read: 44rem;            /* one reading column for title, body and footer: ~75 characters */
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--fg); font: 400 1rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }
main { position: relative; z-index: 1; }

/* ——— shared pieces ——— */
.mono, .label { font-family: var(--mono); font-size: .74rem; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }
.kicker { color: var(--red); }
.display { font-family: var(--display); font-weight: 400; text-transform: uppercase; line-height: .86; }
.btn, .pill { display: inline-flex; align-items: center; gap: .5rem; padding: .8rem 1.3rem; border-radius: 999px; font: 600 .86rem/1 var(--sans);
  background: var(--red-btn); color: #fff; white-space: nowrap; transition: background .3s, color .3s, box-shadow .3s, transform .5s var(--ease); }
.btn:hover { background: #b9231a; transform: translateY(-2px); }
.btn-ghost, .pill { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover, .pill:hover { background: var(--fg); color: var(--bg); box-shadow: none; }
.chips, .tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li, .tag { font: 500 .66rem/1 var(--mono); text-transform: uppercase; letter-spacing: .02em; padding: .4rem .6rem; border-radius: 999px; color: var(--mute); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ——— header ——— */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 50; color: var(--fg); background: linear-gradient(var(--bg) 30%, rgba(10,10,10,0)); pointer-events: none; }
.nav-inner { max-width: var(--max); margin: 0 auto; padding: 1.1rem var(--pad); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.nav-inner > * { pointer-events: auto; }
.nav-logo { display: flex; align-items: center; gap: .6rem; }
.nav-logo svg { width: 28px; height: 28px; }
.nav-logo span { font: 700 .8rem/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.nav-links { display: flex; align-items: center; gap: 1.8rem; }
.nav-links a { position: relative; font: 600 .74rem/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: -5px; height: 1.5px; background: var(--red); transition: right .4s var(--ease); }
.nav-links a:hover::after, .nav-links a.active::after { right: 0; }
.nav-cta a { background: var(--red-btn); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; }
.nav-cta a::after { display: none; }
.nav-toggle { display: none; }

/* ——— footer ——— */
.site-footer { position: relative; z-index: 1; border-top: 1px solid var(--line); color: var(--mute); padding: 2rem 0 2.4rem; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-name { font: 400 1.3rem/1 var(--display); text-transform: uppercase; color: var(--fg); }
.footer-social { display: flex; gap: 1.4rem; }
.footer-social a { font: 500 .74rem/1 var(--mono); text-transform: uppercase; }
.footer-social a:hover { color: var(--red); }
.footer-copy { width: 100%; font: 500 .7rem/1 var(--mono); text-transform: uppercase; opacity: .8; }

/* ============================================
   PAGE HEADER (blog, tags, other lists)
   ============================================ */
.page-header { max-width: var(--max); margin: 0 auto; padding: clamp(8rem, 16vw, 11rem) var(--pad) clamp(2.5rem, 5vw, 4rem); }
.page-header-inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); align-items: end; gap: 1rem 3rem; }
.page-label { grid-column: 1 / -1; color: var(--red); font: 500 .74rem/1 var(--mono); text-transform: uppercase; }
.page-title { font: 400 clamp(4rem, 13vw, 12rem)/.84 var(--display); text-transform: uppercase; overflow-wrap: anywhere; }
.page-title em { font-style: normal; color: var(--red); }
.page-subtitle { color: var(--mute); max-width: 44ch; }

/* ============================================
   BLOG LIST — hairline rows, poster on the left
   ============================================ */
.blog-list { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad) clamp(5rem, 10vw, 8rem); }
.year-marker { display: flex; align-items: baseline; gap: 1rem; padding: 2.6rem 0 1rem; border-bottom: 1px solid var(--line-2); }
.year-marker span { font: 400 clamp(2.4rem, 5vw, 4rem)/1 var(--display); color: var(--red); }
.year-marker small { font: 500 .72rem/1 var(--mono); text-transform: uppercase; color: var(--mute); }
.blog-list-item { border-bottom: 1px solid var(--line); }
.blog-list-link { display: grid; grid-template-columns: clamp(9rem, 18vw, 15rem) minmax(0, 1fr) minmax(0, 14rem); gap: clamp(1.2rem, 3vw, 2.6rem); align-items: center; padding: clamp(1.2rem, 2.4vw, 1.8rem) 0; }
.blog-list-thumb { aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--bg-2); }
.blog-list-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.blog-list-thumb.empty { display: grid; place-items: center; font: 400 2.4rem/1 var(--display); color: var(--bg-3); text-transform: uppercase; }
.blog-list-date { font: 500 .72rem/1 var(--mono); text-transform: uppercase; color: var(--red); }
.blog-list-title { margin: .5rem 0 .45rem; font: 600 clamp(1.25rem, 2.2vw, 1.75rem)/1.2 var(--sans); letter-spacing: -.012em; transition: color .3s; }
.blog-list-desc { color: var(--mute); font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 62ch; }
.blog-list-views { display: inline-block; margin-top: .7rem; font: 500 .7rem/1 var(--mono); text-transform: uppercase; color: var(--mute); }
.blog-list-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.blog-list-link:hover .blog-list-title { color: var(--red); }
.blog-list-link:hover .blog-list-thumb img { transform: scale(1.05); }
.page-title-sm { font-size: clamp(3rem, 7.5vw, 7rem); overflow-wrap: normal; word-break: normal; hyphens: auto; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .6rem; padding-top: 1.6rem; border-top: 1px solid var(--line-2); }
.tag-cloud a { display: inline-flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font: 500 .8rem/1 var(--mono); text-transform: uppercase; transition: background .3s, color .3s; }
.tag-cloud span { color: var(--red); }
.tag-cloud a:hover { background: var(--fg); color: var(--bg); }
/* lists without a poster column (tags, default sections) */
.blog-list-link:not(:has(.blog-list-thumb)) { grid-template-columns: 9rem minmax(0, 1fr); }

/* ============================================
   POST
   ============================================ */
.post-article { max-width: var(--max); margin: 0 auto; padding: clamp(7.5rem, 14vw, 10rem) var(--pad) clamp(4rem, 8vw, 6rem); }
.post-header-inner { max-width: var(--read); margin: 0 auto; }
.post-back { display: inline-flex; gap: .4rem; font: 500 .74rem/1 var(--mono); text-transform: uppercase; color: var(--mute); margin-bottom: 2rem; transition: color .3s; }
.post-back:hover { color: var(--red); }
.post-header-meta { font: 500 .72rem/1.9 var(--mono); text-transform: uppercase; color: var(--mute); }
.post-header-meta time { color: var(--red); }
.post-header-meta .meta-sep { margin: 0 .5em; opacity: .5; }
.post-header-meta .post-views { color: var(--fg); }
.post-title { margin: 1rem 0 1.2rem; font: 400 clamp(2.8rem, 6vw, 5.2rem)/.9 var(--display); text-transform: uppercase; letter-spacing: .002em; overflow-wrap: anywhere; }
.post-description { max-width: 60ch; font-size: clamp(1.08rem, 1.6vw, 1.3rem); line-height: 1.5; color: var(--text); }
.post-byline { margin-top: 1.2rem; font: italic 400 1.15rem/1.3 var(--serif); color: var(--mute); }
.post-byline a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.post-header-rule { width: 64px; height: 3px; margin-top: 2rem; background: var(--red); }
.post-poster { position: relative; left: 50%; translate: -50% 0; width: min(64rem, calc(100vw - 2 * var(--pad))); margin-top: 2.6rem; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }   /* breaks out wider than the text */
.post-poster img { width: 100%; height: auto; }

.post-body { padding-top: clamp(2.5rem, 5vw, 4rem); }
.post-content { max-width: var(--read); margin: 0 auto; font-size: 1.1rem; line-height: 1.78; color: var(--text); }
.post-content > * + * { margin-top: 1.35em; }
.post-content h2 { margin-top: 2.4em; font: 400 clamp(1.9rem, 3.6vw, 2.8rem)/.95 var(--display); text-transform: uppercase; color: var(--fg); letter-spacing: .004em; }
.post-content h3 { margin-top: 2em; font: 600 1.3rem/1.3 var(--sans); color: var(--fg); }
.post-content h2 + *, .post-content h3 + * { margin-top: .8em; }
.post-content a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; text-underline-offset: 3px; transition: color .3s; }
.post-content a:hover { color: var(--red); }
.post-content strong { color: var(--fg); font-weight: 600; }
.post-content em { font-style: italic; }
.post-content blockquote { padding: .2em 0 .2em 1.4em; border-left: 3px solid var(--red); font: italic 400 1.5rem/1.35 var(--serif); color: var(--fg); }
.post-content blockquote p + p { margin-top: .6em; }
.post-content ul, .post-content ol { padding-left: 1.3em; }
.post-content li { margin-top: .45em; }
.post-content ul li { list-style: none; position: relative; }
.post-content ul li::before { content: ""; position: absolute; left: -1.1em; top: .72em; width: 6px; height: 6px; background: var(--red); border-radius: 50%; }
.post-content ol li { list-style: decimal; }
.post-content ol li::marker { color: var(--red); font-family: var(--mono); font-size: .85em; }
.post-content hr { border: 0; height: 1px; background: var(--line-2); margin: 3em 0; }
.post-content img, .post-content video { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); }
.post-content code { font-family: var(--mono); font-size: .84em; padding: .12em .4em; border-radius: 4px; background: var(--bg-3); color: var(--fg); }
.post-content pre { padding: 1.3rem 1.4rem; border-radius: 10px; overflow-x: auto; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); font-size: .86rem; line-height: 1.65; color: #e8e5de; }
.post-content pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.post-content pre .z-comment { color: #7f7b74; font-style: italic; }
.post-content pre .z-string { color: #ffb86b; }
.post-content pre .z-constant.z-numeric, .post-content pre .z-constant.z-language { color: #ff8a80; }
.post-content pre .z-keyword, .post-content pre .z-storage { color: #ff5f56; }
.post-content pre .z-support.z-function, .post-content pre .z-entity.z-name.z-function { color: #8fb6ff; }
.post-content pre .z-entity.z-name.z-class, .post-content pre .z-entity.z-name.z-type { color: #ffd479; }
.post-content pre .z-punctuation { color: #8f8b83; }
.post-content table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.post-content th, .post-content td { text-align: left; padding: .6em .8em; border-bottom: 1px solid var(--line); }
.post-content th { font: 500 .72rem/1.3 var(--mono); text-transform: uppercase; color: var(--mute); }

.related-posts, .post-footer { max-width: var(--read); margin: 0 auto; }
.related-posts { margin-top: clamp(3rem, 6vw, 5rem); padding-top: 1.6rem; border-top: 1px solid var(--line-2); }
.related-posts-title { font: 500 .74rem/1 var(--mono); text-transform: uppercase; color: var(--red); margin-bottom: .6rem; }
.related-posts-list a { display: block; padding: .9rem 0; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 1.1rem; transition: color .3s; }
.related-posts-list a:hover { color: var(--red); }
.post-footer { margin-top: clamp(3rem, 6vw, 4.5rem); }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.post-nav-link { display: flex; flex-direction: column; gap: .5rem; padding: 1.3rem 1.4rem; border-radius: 10px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .3s; }
.post-nav-link:hover { box-shadow: inset 0 0 0 1px var(--red); }
.post-nav-next { text-align: right; }
.post-nav-label { font: 500 .7rem/1 var(--mono); text-transform: uppercase; color: var(--red); }
.post-nav-title { font-weight: 600; line-height: 1.3; }
.post-share { display: flex; justify-content: center; margin: 2.4rem 0 1.2rem; }
.post-share-btn { display: inline-flex; align-items: center; gap: .55rem; padding: .8rem 1.3rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-2); font: 600 .84rem/1 var(--sans); transition: background .3s, color .3s; }
.post-share-btn svg { width: 15px; height: 15px; }
.post-share-btn:hover, .post-share-btn.is-copied { background: var(--fg); color: var(--bg); }
.post-footer-cta { text-align: center; color: var(--mute); }
.post-footer-cta a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
html.read-mode .site-header, html.read-mode .site-footer, html.read-mode .post-back, html.read-mode .post-footer-cta { display: none !important; }

/* ============================================
   CARD PAGES (About → Right now, Scars, …)
   ============================================ */
.cp-head { max-width: var(--max); margin: 0 auto; padding: clamp(8rem, 15vw, 10.5rem) var(--pad) clamp(2.5rem, 5vw, 4rem); border-bottom: 1px solid var(--line); }
.cp-head .wrap { max-width: none; padding: 0; }
.cp-back { display: inline-block; margin-bottom: 2rem; color: var(--mute); transition: color .3s; }
.cp-back:hover { color: var(--red); }
.cp-title-row { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.2rem; color: var(--red); }
.cp-head h1 { font-size: clamp(3.6rem, 11vw, 10rem); max-width: 12ch; overflow-wrap: anywhere; }
.cp-teaser { margin-top: 1.3rem; max-width: 46ch; font: italic 400 clamp(1.3rem, 2.2vw, 1.8rem)/1.3 var(--serif); color: var(--text); }
.wc-icon { width: 30px; height: 30px; }
.cp-body { max-width: 60rem; padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem; }
.cp-note { color: var(--mute); margin-bottom: 1.8rem; font-family: var(--mono); font-size: .76rem; text-transform: uppercase; }
.cp-body h2 { margin: 2.6rem 0 1rem; font: 500 .76rem/1 var(--mono); text-transform: uppercase; color: var(--red); }
.cp-body h2:first-of-type { margin-top: 0; }
.cp-body p { color: var(--text); max-width: 62ch; }
.cp-body p + p { margin-top: 1em; }
.cp-body a { text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }
.cp-body ol { counter-reset: n; border-top: 1px solid var(--line-2); }
.cp-body ol li { counter-increment: n; position: relative; padding: 1.4rem 0 1.4rem 5.2rem; border-bottom: 1px solid var(--line); font-size: clamp(1.05rem, 1.7vw, 1.3rem); line-height: 1.45; color: var(--text); }
.cp-body ol li::before { content: counter(n, decimal-leading-zero); position: absolute; left: 0; top: 1.25rem; font: 400 2.1rem/1 var(--display); color: var(--red); }
.cp-body strong { color: var(--fg); font-weight: 600; }
.cp-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.cp-photos figure { position: relative; overflow: hidden; border-radius: 10px; aspect-ratio: 3 / 4; background: var(--bg-2); }
.cp-photos img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.cp-photos figure:hover img { transform: scale(1.05); }
.cp-photos figcaption { position: absolute; inset: auto 0 0 0; padding: 2.4rem .9rem .8rem; font: 500 .7rem/1.3 var(--mono); text-transform: uppercase; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.cp-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.5rem 0 clamp(4rem, 8vw, 6rem); }

/* ——— easter eggs ——— */
.secret-toast { position: fixed; left: 50%; bottom: 2rem; z-index: 90; transform: translate(-50%, 20px); padding: 1rem 1.4rem; border-radius: 12px; background: var(--red); color: #fff;
  font: 400 1.1rem/1.15 var(--display); text-transform: uppercase; white-space: pre-line; text-align: center; opacity: 0; transition: opacity .4s var(--ease), transform .6s var(--ease); }
.secret-toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti-piece { position: fixed; top: -12px; width: 8px; height: 14px; z-index: 95; pointer-events: none; animation: fall 2s linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .2; } }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .page-header-inner { grid-template-columns: 1fr; }
  .blog-list-link { grid-template-columns: clamp(8rem, 30vw, 12rem) minmax(0, 1fr); }
  .blog-list-tags { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 720px) {
  .nav-links { display: none; position: absolute; top: 100%; right: var(--pad); flex-direction: column; align-items: flex-end; gap: 1.1rem; padding: 1.2rem 1.4rem;
    border-radius: 12px; background: var(--bg-2); box-shadow: 0 0 0 1px var(--line-2), 0 20px 40px rgba(0,0,0,.6); }
  .nav-inner.open .nav-links { display: flex; }
  .nav-toggle { display: grid; place-items: center; width: 40px; height: 40px; }
  .nav-toggle span { display: block; width: 22px; height: 2px; margin: 3px 0; background: var(--fg); transition: transform .3s; }
  .nav-inner.open .nav-toggle span:first-child { transform: translateY(4px) rotate(45deg); }
  .nav-inner.open .nav-toggle span:last-child { transform: translateY(-4px) rotate(-45deg); }
  .blog-list-link, .blog-list-link:not(:has(.blog-list-thumb)) { grid-template-columns: 1fr; gap: .9rem; }
  .blog-list-tags { grid-column: 1; }
  .post-content { font-size: 1.04rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav-next { text-align: left; }
  .cp-body ol li { padding-left: 3.8rem; }
  .cp-body ol li::before { font-size: 1.7rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}
