/* IronSift site. Two skins (normal / halloween) x light/dark. Skin + theme live on <html data-skin data-theme>. */
@font-face { font-family: "Silkscreen"; src: url(/assets/fonts/silkscreen-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url(/assets/fonts/silkscreen-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Creepster"; src: url(/assets/fonts/creepster.woff2) format("woff2"); font-display: swap; }

:root {
  --bg: #f1efe9; --bg2: #e6e2d8; --panel: #ffffffee; --ink: #1d2326; --muted: #59646a; --line: #d6d1c6; --code: #e9e6de;
  --accent: #2f7d95; --accent2: #b8860b; --ok: #2f8a4c; --off: #a33b3b; --glow: transparent;
  --title-font: "Silkscreen", ui-monospace, monospace; --hero: url(/assets/hero.webp);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12171a; --bg2: #182025; --panel: #1b2328ee; --ink: #e9eef0; --muted: #9ba7ad; --line: #2c373c; --code: #222b30;
    --accent: #5fb8d4; --accent2: #e3b23c; --ok: #4cc070; --off: #e06a6a;
  }
}
:root[data-theme="dark"] {
  --bg: #12171a; --bg2: #182025; --panel: #1b2328ee; --ink: #e9eef0; --muted: #9ba7ad; --line: #2c373c; --code: #222b30;
  --accent: #5fb8d4; --accent2: #e3b23c; --ok: #4cc070; --off: #e06a6a;
}
/* Halloween is a night skin whatever the theme, with a lighter "harvest" variant for light mode */
:root[data-skin="halloween"] {
  --bg: #0d0812; --bg2: #160d1f; --panel: #1a1024e6; --ink: #f6ead8; --muted: #c2a98e; --line: #3b2348; --code: #2a1836;
  --accent: #ff8a1f; --accent2: #b06cff; --ok: #7dff6a; --off: #ff5a5a; --glow: #ff8a1f;
  --title-font: "Creepster", "Silkscreen", cursive; --hero: url(/assets/halloween-hero.webp);
}
:root[data-skin="halloween"][data-theme="light"] {
  --bg: #fbefe1; --bg2: #f5dfc6; --panel: #fffaf3ee; --ink: #2a1530; --muted: #6e4f5e; --line: #ecc9a6; --code: #f6e3cf;
  --accent: #d35d00; --accent2: #7a3fc0; --glow: #ff8a1f55;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; transition: background .6s, color .6s; }
a { color: var(--accent); }
code { background: var(--code); border-radius: 6px; padding: 2px 7px; font-size: .92em; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }
:root:not([data-skin="halloween"]) .spooky-only { display: none !important; }

/* ---------- top bar + settings ---------- */
.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 1.15rem var(--title-font); letter-spacing: .04em; }
.brand img { border-radius: 7px; image-rendering: pixelated; }
.links { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.links a { color: var(--muted); text-decoration: none; padding: 5px 9px; border-radius: 7px; font-size: .95rem; }
.links a:hover { color: var(--ink); background: var(--code); }
.links .panel-link { color: var(--accent); }
.gear { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 9px; padding: 6px; cursor: pointer; display: grid; place-items: center; }
.gear:hover { border-color: var(--accent); }
.gear[aria-expanded="true"] svg { transform: rotate(90deg); }
.gear svg { transition: transform .4s; }
.settings { position: absolute; right: 16px; top: 58px; width: min(300px, calc(100vw - 32px)); background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: 0 18px 50px #0006; backdrop-filter: blur(14px); }
.settings h2 { margin: 0 0 6px; font: 700 1rem var(--title-font); letter-spacing: .05em; }
.settings fieldset { border: 0; padding: 0; margin: 10px 0 0; }
.settings legend { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.settings label { display: flex; gap: 8px; align-items: center; padding: 4px 0; cursor: pointer; }
.settings input { accent-color: var(--accent); }
@media (max-width: 680px) { .links { display: none; } .gear { margin-left: auto; } }

/* ---------- ticker (halloween) ---------- */
.ticker { overflow: hidden; white-space: nowrap; background: linear-gradient(90deg, #ff7a00, #b04cff, #ff7a00); color: #160a1c;
  font: 700 .9rem "Silkscreen", monospace; padding: 5px 0; display: none; }
:root[data-skin="halloween"] .ticker { display: block; }
.ticker-track { display: inline-block; padding-left: 100%; animation: tick 38s linear infinite; }
@keyframes tick { to { transform: translateX(-100%); } }

/* ---------- hero ---------- */
.hero { position: relative; min-height: min(86vh, 760px); display: grid; place-items: center; overflow: hidden; isolation: isolate; perspective: 1100px; }
.hero-img { position: absolute; inset: -4%; background: var(--hero) center/cover no-repeat; z-index: -3; animation: drift 40s ease-in-out infinite alternate; }
@keyframes drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.12) translate(-2%, 1.5%); } }
.hero-shade { position: absolute; inset: 0; z-index: -2; background: radial-gradient(ellipse at 50% 45%, transparent 0 30%, color-mix(in srgb, var(--bg) 70%, transparent) 75%), linear-gradient(transparent 55%, var(--bg)); }
.hero-inner { text-align: center; padding: 48px 16px 64px; max-width: 760px; position: relative; z-index: 2; }
.emblem { width: 112px; height: 112px; image-rendering: pixelated; filter: drop-shadow(0 10px 24px #0008); animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-3deg); } }
.title { margin: 8px 0 4px; font: 700 clamp(3.2rem, 11vw, 6.6rem)/1 var(--title-font); letter-spacing: .04em; color: #fff;
  text-shadow: 0 4px 0 #0005, 0 0 30px var(--glow); }
.title .ch { display: inline-block; opacity: 0; transform: translateY(-80px) rotate(-12deg); animation: drop .9s cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: calc(var(--i) * 90ms + 150ms); }
@keyframes drop { to { opacity: 1; transform: none; } }
:root[data-skin="halloween"] .title { color: #ffb347; -webkit-text-stroke: 1px #3a0d00; }
:root[data-skin="halloween"] .title .ch { animation: drop .9s cubic-bezier(.2, 1.6, .4, 1) forwards, wobble 3.2s ease-in-out infinite, flicker 5s steps(1) infinite;
  animation-delay: calc(var(--i) * 90ms + 150ms), calc(var(--i) * 140ms + 1.2s), calc(var(--i) * 370ms); }
@keyframes wobble { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-6px) rotate(-4deg); } 75% { transform: translateY(3px) rotate(3deg); } }
@keyframes flicker { 0%, 100% { text-shadow: 0 4px 0 #0007, 0 0 28px #ff8a1f, 0 0 60px #ff5a00; } 48% { text-shadow: 0 4px 0 #0007, 0 0 10px #ff8a1f; } 50% { text-shadow: 0 4px 0 #0007, 0 0 34px #ffb347, 0 0 80px #ff5a00; } 93% { text-shadow: 0 4px 0 #0007, 0 0 4px #ff8a1f; } }
.typer { min-height: 1.7em; margin: 6px 0 18px; color: #fff; font-size: clamp(1rem, 2.6vw, 1.25rem); text-shadow: 0 2px 8px #000a; }
.caret { animation: blink 1s steps(1) infinite; color: var(--accent); margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.status { display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; padding: 9px 16px; border-radius: 99px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: ping 2s infinite; }
.dot.off { background: var(--off); }
@keyframes ping { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.status .meta { color: var(--muted); font-size: .92rem; }
.addr { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.addr code { font-size: 1.1rem; padding: 9px 14px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.copy { font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer; background: var(--accent); color: #fff; box-shadow: 0 6px 18px #0005; transition: transform .15s; }
.copy:hover { transform: translateY(-2px); }
:root[data-skin="halloween"] .copy { color: #1a0a00; }
.countdown { margin-top: 22px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.countdown .u { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-width: 70px; backdrop-filter: blur(10px); }
.countdown b { display: block; font: 700 1.8rem/1 "Silkscreen", monospace; color: var(--accent); }
.countdown span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.countdown .msg { font: 2rem var(--title-font); color: var(--accent); text-shadow: 0 0 20px var(--glow); }

/* ---------- 3D jack-o'-lanterns ---------- */
.jol { --s: 70px; position: relative; width: var(--s); height: var(--s); transform-style: preserve-3d; animation: spin var(--spd, 9s) linear infinite; }
.jol .f { position: absolute; inset: 0; background: url(/assets/pumpkin-side.webp) center/cover; backface-visibility: hidden; }
.jol .f.front { background-image: url(/assets/pumpkin-face.webp); transform: translateZ(calc(var(--s) / 2)); animation: candle 2.3s infinite; }
.jol .f.back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); filter: brightness(.8); }
.jol .f.right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.9); }
.jol .f.left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.75); }
.jol .f.top { background-image: url(/assets/pumpkin-top.webp); transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); filter: brightness(1.05); }
.jol .f.bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); filter: brightness(.45); }
@keyframes spin { from { transform: rotateX(-14deg) rotateY(0); } to { transform: rotateX(-14deg) rotateY(360deg); } }
@keyframes candle { 0%, 100% { filter: brightness(1) saturate(1); } 20% { filter: brightness(1.25) saturate(1.2); } 22% { filter: brightness(.9); } 60% { filter: brightness(1.15); } 62% { filter: brightness(.95); } }
.ring-stage { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; transform-style: preserve-3d; z-index: 1; }
:root[data-skin="halloween"] .ring-stage { display: grid; }
.ring { position: relative; width: 0; height: 0; transform-style: preserve-3d; animation: orbit 22s linear infinite; }
@keyframes orbit { from { transform: rotateX(72deg) rotateZ(0); } to { transform: rotateX(72deg) rotateZ(360deg); } }
.ring .slot { position: absolute; left: -35px; top: -35px; transform-style: preserve-3d; transform: rotateZ(var(--a)) translateX(var(--r)) rotateZ(calc(-1 * var(--a))) rotateX(-72deg); }
.ring .slot .bob { transform-style: preserve-3d; animation: hover 3s ease-in-out infinite; animation-delay: var(--d); }
@keyframes hover { 50% { transform: translateY(-14px); } }
.jol-solo { display: grid; place-items: center; min-height: 220px; perspective: 700px; }
.jol-solo .jol { --s: 130px; --spd: 7s; }
.jol-solo::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(#ff8a1f66, transparent 70%); filter: blur(12px); z-index: -1; animation: candle 2.3s infinite; }
.jol-solo { position: relative; isolation: isolate; }
.floaters .jol { position: absolute; --s: 34px; opacity: .85; }

/* ---------- ambient fx (halloween) ---------- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 20; display: none; perspective: 800px; }
:root[data-skin="halloween"] .fx { display: block; }
.fog { position: absolute; left: -50%; width: 200%; height: 40vh; bottom: -10vh; opacity: .22;
  background: radial-gradient(ellipse at 20% 50%, #b06cff 0, transparent 40%), radial-gradient(ellipse at 60% 60%, #7dff6a 0, transparent 35%), radial-gradient(ellipse at 85% 40%, #b06cff 0, transparent 40%);
  filter: blur(40px); animation: fog 30s linear infinite; }
.fog.f2 { animation-duration: 46s; animation-direction: reverse; opacity: .16; bottom: -16vh; }
.fog.f3 { top: -12vh; bottom: auto; opacity: .1; animation-duration: 60s; }
@keyframes fog { to { transform: translateX(25%); } }
.bat { position: absolute; width: 46px; height: 24px; animation: fly var(--t, 14s) linear infinite; animation-delay: var(--d, 0s); top: var(--y, 20%); left: -60px; }
.bat svg { width: 100%; height: 100%; animation: flap .22s ease-in-out infinite alternate; transform-origin: center; }
@keyframes flap { to { transform: scaleY(.35); } }
@keyframes fly { 0% { transform: translate(0, 0); } 25% { transform: translate(28vw, -6vh); } 50% { transform: translate(55vw, 4vh); } 75% { transform: translate(82vw, -8vh); } 100% { transform: translate(110vw, 0); } }
.ghost { position: absolute; width: 60px; opacity: 0; animation: haunt var(--t, 18s) ease-in-out infinite; animation-delay: var(--d, 0s); left: var(--x, 10%); bottom: -80px; }
@keyframes haunt { 0% { opacity: 0; transform: translate(0, 0) rotate(0); } 10% { opacity: .75; } 50% { transform: translate(40px, -55vh) rotate(8deg); } 90% { opacity: .6; } 100% { opacity: 0; transform: translate(-30px, -110vh) rotate(-6deg); } }

/* ---------- content ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 16px 40px; position: relative; z-index: 3; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 26px; margin: 22px 0; backdrop-filter: blur(12px); }
:root[data-skin="halloween"] .block { box-shadow: 0 0 0 1px #ff8a1f22, 0 20px 60px #0007; }
.sec-title { margin: 0 0 10px; font: 700 clamp(1.6rem, 4vw, 2.3rem)/1.1 var(--title-font); letter-spacing: .03em; color: var(--accent); }
.sec-title .ch { display: inline-block; }
.reveal .sec-title .ch { opacity: 0; transform: translateY(20px) scale(.6); }
.reveal.in .sec-title .ch { animation: pop .6s cubic-bezier(.2, 1.5, .4, 1) forwards; animation-delay: calc(var(--i) * 45ms); }
:root[data-skin="halloween"] .reveal.in .sec-title .ch { animation: pop .6s cubic-bezier(.2, 1.5, .4, 1) forwards, wave 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i) * 45ms), calc(var(--i) * 120ms + .8s); }
@keyframes pop { to { opacity: 1; transform: none; } }
@keyframes wave { 50% { transform: translateY(-5px); color: var(--accent2); } }
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s, transform .7s; }
.reveal.in { opacity: 1; transform: none; }
.lead { font-size: 1.08rem; margin: 0 0 16px; }
.note { color: var(--muted); font-size: .92rem; margin: 14px 0 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { font: inherit; font-size: .95rem; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 7px 14px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
:root[data-skin="halloween"] .tabs button[aria-selected="true"] { color: #1a0a00; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; position: relative; padding: 12px 14px 12px 56px; border-radius: 12px; background: var(--code); }
.steps li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 32px; height: 32px; display: grid; place-items: center;
  font: 700 1rem "Silkscreen", monospace; background: var(--accent); color: #fff; border-radius: 8px; }
:root[data-skin="halloween"] .steps li::before { color: #1a0a00; }
.swift { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 26px; align-items: start; }
.swift-art img { width: 100%; height: auto; border-radius: 14px; display: block; box-shadow: 0 16px 40px #0006; }
@media (max-width: 820px) { .swift { grid-template-columns: 1fr; } }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 16px; }
.fact { text-align: center; background: var(--code); border-radius: 12px; padding: 10px 6px; }
.fact b { display: block; font: 700 2rem/1 "Silkscreen", monospace; color: var(--accent); }
.fact span { font-size: .8rem; color: var(--muted); }
@media (max-width: 520px) { .facts { grid-template-columns: repeat(2, 1fr); } }
.lore { margin: 0; padding-left: 1.1em; display: grid; gap: 6px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.card { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--bg2); transition: transform .3s, box-shadow .3s; }
.card:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 18px 40px #0005; }
.card img { width: 100%; height: auto; display: block; aspect-ratio: 16/9; object-fit: cover; }
.card-body { padding: 14px 18px 18px; }
.card h3 { margin: 0; font: 700 1.3rem var(--title-font); letter-spacing: .03em; }
.card p { margin: 6px 0; }
.spooky-grid { display: grid; grid-template-columns: 240px 1fr; gap: 20px; align-items: center; }
@media (max-width: 680px) { .spooky-grid { grid-template-columns: 1fr; } }
.parents { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.parents div { background: var(--code); border-radius: 12px; padding: 14px 16px; }
.parents h3 { margin: 0 0 4px; font-size: 1.02rem; color: var(--accent); }
.parents p { margin: 0; font-size: .95rem; }
.foot { text-align: center; padding: 20px 16px 40px; color: var(--muted); position: relative; z-index: 3; }
.foot p { margin: 4px 0; }

/* calm mode + OS reduced motion: keep the look, drop the movement */
:root[data-motion="reduced"] *, :root[data-motion="reduced"] *::before, :root[data-motion="reduced"] *::after { animation: none !important; transition: none !important; }
:root[data-motion="reduced"] .title .ch, :root[data-motion="reduced"] .reveal, :root[data-motion="reduced"] .reveal .sec-title .ch { opacity: 1 !important; transform: none !important; }
:root[data-motion="reduced"] .fx .bats, :root[data-motion="reduced"] .fx .ghosts { display: none; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) *, :root:not([data-motion="full"]) *::before { animation: none !important; transition: none !important; }
  :root:not([data-motion="full"]) .title .ch, :root:not([data-motion="full"]) .reveal, :root:not([data-motion="full"]) .reveal .sec-title .ch { opacity: 1 !important; transform: none !important; }
}
