/* Home page and site-wide touches: museum plates, the hero board, hand-drawn analysis ink, the hidden puzzle, 404.
   Uses the tokens from style.css. Every animation is switched off for people who ask for reduced motion. */
:root { --ink-g: #3b9a47; --ink-r: #c9473a; }
[data-theme="dark"] { --ink-g: #5cbf69; --ink-r: #e06a5c; }

/* ── museum plates: thin brass frame and catalogue lines ── */
.plate-label {
  position: absolute; z-index: 12; font: 500 .6rem/1.3 'DM Sans', sans-serif; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); background: var(--black); padding: .35rem .6rem; border: .5px solid var(--border); white-space: nowrap;
}
.plate-label.tl { top: -.9rem; left: 1rem; }
.plate-label.br { bottom: -.9rem; right: 1rem; }
.plate-label b { color: var(--ivory); font-weight: 600; }
.plated { position: relative; }
.plated::after {
  content: ''; position: absolute; inset: 8px; border: .5px solid rgba(201,168,76,.55); pointer-events: none; z-index: 11;
}
.plate-cap { display: flex; justify-content: space-between; gap: 1rem; font: 500 .6rem/1.4 'DM Sans', sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: .7rem 0 .2rem; }

/* ── hero board: a moment from one of my games, playing by itself ── */
.hero-board {
  grid-column: 2; grid-row: 1; align-self: end; justify-self: start; z-index: 20; position: relative;
  width: 15.5rem; margin: 0 0 -1.5rem -3.5rem; background: var(--charcoal); border: .5px solid var(--border);
  padding: .7rem .7rem .8rem; box-shadow: 0 18px 50px rgba(0,0,0,.35);
  opacity: 0; animation: fxUp .8s .9s forwards; text-decoration: none; color: inherit; display: block;
}
.hero-board::before { content: ''; position: absolute; inset: 4px; border: .5px solid rgba(201,168,76,.35); pointer-events: none; }
.hero-board .hb-top { display: flex; justify-content: space-between; gap: .5rem; font: 500 .55rem/1.3 'DM Sans', sans-serif; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); margin-bottom: .5rem; }
.hero-board svg { width: 100%; height: auto; display: block; }
.hero-board .hb-note { font-size: .74rem; line-height: 1.45; color: var(--ivory-dim); margin-top: .55rem; min-height: 3.2em; }
.hero-board .hb-note b { color: var(--ivory); font-weight: 600; margin-right: .25rem; }
.hero-board .hb-link { display: block; margin-top: .35rem; font-size: .6rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.hero-board:hover { border-color: var(--gold); }
.hero-board .pc { transition: transform .45s cubic-bezier(.3,.7,.3,1); }
.hero-photo-wrap { grid-column: 2; grid-row: 1; }
.hero-content { grid-column: 1; grid-row: 1; }
.hero-photo-badge.top { bottom: auto; top: 1.5rem; left: auto; right: -1.5rem; }
@media (max-width: 1024px) {
  .hero-board { grid-column: 1; grid-row: auto; justify-self: center; align-self: auto; margin: 0; width: min(20rem, 100%); }
  .hero-photo-wrap, .hero-content { grid-column: 1; grid-row: auto; }
  .hero-photo-badge.top { top: auto; bottom: 1.5rem; left: 0; right: auto; }
}

/* ── position of the week ── */
.potw .potw-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2.25rem; }
.potw .potw-lead { font-size: .95rem; font-weight: 300; line-height: 1.8; color: var(--ivory-dim); max-width: 34rem; margin-top: 1rem; }
.potw .tr { max-width: 62rem; }

/* ── hand-drawn analysis ink: arrows, underlines and circles that draw themselves ── */
.ink { position: relative; display: inline-block; white-space: nowrap; }
.ink > svg.ink-svg { position: absolute; pointer-events: none; overflow: visible; }
.ink[data-ink="under"] > svg.ink-svg { left: -4%; width: 108%; bottom: -.22em; height: .45em; }
.ink[data-ink="circle"] > svg.ink-svg { left: -14%; top: -22%; width: 128%; height: 144%; }
.ink[data-ink="square"] > svg.ink-svg { left: -.12em; top: .02em; width: calc(100% + .24em); height: 1.08em; }
.ink[data-ink="square"] .ink-svg path { stroke-width: 2.5; stroke-linecap: square; stroke-linejoin: miter; }
.ink[data-ink="square"]::before { content: ''; position: absolute; left: -.12em; top: .02em; right: -.12em; height: 1.08em; background: var(--ink-g); opacity: 0; transition: opacity .6s .9s; }
.ink.on[data-ink="square"]::before { opacity: .1; }
.ink[data-ink="arrow"] > svg.ink-svg { left: 0; top: 50%; width: 100%; height: .8em; transform: translateY(-50%); }
.ink[data-ink="arrow"] { min-width: 3.2em; color: transparent !important; }
.ink-svg path { fill: none; stroke: var(--ink-g); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ink.red .ink-svg path { stroke: var(--ink-r); }
.ink-svg .draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.ink.on .ink-svg .draw { transition: stroke-dashoffset .9s cubic-bezier(.6,.1,.3,1) .15s; stroke-dashoffset: 0; }
.ink.on .ink-svg .head { transition-delay: .85s; transition-duration: .3s; }

/* ── hidden puzzle (type e4 on the home page) ── */
.egg { position: fixed; inset: 0; z-index: 400; background: rgba(8,7,5,.72); display: grid; place-items: center; padding: 1rem; overflow: auto; }
.egg[hidden] { display: none; }
.egg-box { background: var(--black); border: .5px solid var(--gold); width: min(62rem, 100%); max-height: calc(100svh - 2rem); overflow: auto; padding: 1.4rem 1.5rem 1.6rem; position: relative; animation: fxUp .35s; }
.egg-box h3 { font: 500 1.5rem/1.2 'Playfair Display', serif; color: var(--ivory); margin: .4rem 0 .4rem; }
.egg-box .egg-sub { font-size: .9rem; color: var(--ivory-dim); margin-bottom: 1.2rem; }
.egg-x { position: absolute; top: .6rem; right: .7rem; width: 2.4rem; height: 2.4rem; background: none; border: .5px solid var(--border); color: var(--ivory); font-size: 1.1rem; cursor: pointer; }
.egg-x:hover { border-color: var(--gold); color: var(--gold); }
.egg-pawn { background: none; border: 0; padding: 0 .2rem; color: inherit; opacity: .45; cursor: pointer; font-size: .9em; }
.egg-pawn:hover { opacity: 1; color: var(--gold); }
@media (max-width: 680px) { .egg { padding: 0; } .egg-box { max-height: 100svh; height: 100svh; border: 0; padding: 1rem 1rem 1.5rem; } }

/* ── 404: an illegal move ── */
.nf { min-height: 100svh; display: grid; place-items: center; padding: 8rem 1.5rem 4rem; text-align: center; }
.nf-board { width: min(18rem, 80vw); margin: 0 auto 2rem; display: block; }
.nf h1 { font: 700 clamp(2.4rem, 6vw, 3.6rem)/1.05 'Playfair Display', serif; color: var(--ivory); }
.nf h1 em { color: var(--gold); }
.nf p { color: var(--ivory-dim); max-width: 28rem; margin: 1rem auto 2rem; line-height: 1.7; }
.nf .cta-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.nf .shake { animation: fxShake .5s 1s 2; transform-box: fill-box; transform-origin: center; }

@keyframes fxUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fxShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

@media (prefers-reduced-motion: reduce) {
  .hero-board, .egg-box { animation: none; opacity: 1; }
  .ink .ink-svg .draw { stroke-dashoffset: 0; transition: none !important; }
  .hero-board .pc, .nf .shake { transition: none; animation: none; }
}

/* ── blog answers: blurred until asked for ── */
.reveal { position: relative; max-width: 40rem; margin: 1.3rem auto 0; }
.reveal .reveal-body > p:first-child { margin-top: 0; }
.reveal.locked .reveal-body { filter: blur(6px); opacity: .55; user-select: none; pointer-events: none; max-height: 7.5rem; overflow: hidden; }
.reveal.open .reveal-body { animation: fxUnblur .6s ease-out; }
.reveal-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); white-space: nowrap;
  background: var(--black); border: .5px solid var(--gold); color: var(--ivory); padding: .75rem 1.2rem; cursor: pointer;
  font: 400 .85rem 'DM Sans', sans-serif; box-shadow: 0 8px 28px rgba(0,0,0,.18);
}
.reveal-btn span { color: var(--ivory-dim); }
.reveal-btn b { color: var(--gold); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .72rem; margin-left: .35rem; }
.reveal-btn:hover { border-color: var(--gold-light); }
@keyframes fxUnblur { from { filter: blur(6px); opacity: .55; } to { filter: none; opacity: 1; } }
@media (max-width: 560px) { .reveal-btn span { display: none; } }

/* ── blog: replay the full game, as a quiet link instead of a second board ── */
.prose .replay { max-width: 40rem; margin: 2rem auto 0; }
.prose .replay a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border: .5px solid var(--border); background: var(--surface); text-decoration: none; }
.prose .replay span { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ivory-dim); }
.prose .replay b { font-size: .85rem; font-weight: 600; color: var(--gold); }
.prose .replay a:hover { border-color: var(--gold); }
@media (prefers-reduced-motion: reduce) { .reveal.open .reveal-body { animation: none; } }

/* ── site-wide details ── */
::selection { background: rgba(201,168,76,.32); color: inherit; }
nav .nav-links a.here { color: var(--ivory); position: relative; }
nav .nav-links a.here::after { content: ''; position: absolute; left: 50%; bottom: -9px; width: 5px; height: 5px; margin-left: -2.5px; background: var(--gold); }
@media (max-width: 900px) { nav .nav-links a.here::after { left: -12px; bottom: 50%; margin: 0 0 -2.5px; } }
/* list markers as small board squares, alternating light and dark */
.sidebar-list li::before, .cred-line::before { content: '' !important; position: absolute; left: 0; top: .62em; width: 6px; height: 6px; background: var(--gold); font-size: 0; }
.sidebar-list li:nth-child(even)::before, .cred-line:nth-child(odd)::before { background: transparent; box-shadow: inset 0 0 0 1px var(--gold-dim); }
.cred-line { position: relative; padding-left: 1rem !important; }
.cred-dot { border-radius: 0 !important; }
.cred-item:nth-child(even) .cred-dot { background: transparent !important; box-shadow: inset 0 0 0 1px var(--gold); }
/* course numbers: a marked square on hover */
.course-index { position: relative; transition: color .25s; }
.course-index::after { content: ''; position: absolute; left: 50%; top: 50%; width: 2.4rem; height: 2.4rem; margin: -1.2rem 0 0 -1.2rem; border: 2px solid var(--ink-g); opacity: 0; transform: scale(.7); transition: opacity .25s, transform .25s; pointer-events: none; }
a:hover .course-index::after, div:hover > .course-index::after { opacity: .9; transform: none; }
/* blog cards: the post's key position */
.banner[data-fen] { gap: 1.4rem; display: flex !important; align-items: center; justify-content: center; }
.banner[data-fen] .mini { width: auto; height: 78%; aspect-ratio: 1; box-shadow: 0 0 0 4px var(--black), 0 0 0 4.5px var(--gold); transition: transform .4s cubic-bezier(.3,.7,.3,1); }
.card:hover .banner[data-fen] .mini { transform: translateY(-3px) rotate(-1.5deg); }
@media (prefers-reduced-motion: reduce) { .course-index::after, .banner[data-fen] .mini { transition: none; } }
.series .part.soon { opacity: .55; cursor: default; }
