/* Handheld Horizons website. Plain CSS, no build step. */

:root {
  --bg: #070b14;
  --surface: #111827;
  --border: #1f2738;
  --text: #e8ebf2;
  --muted: #98a2b5;
  --accent: #3d8bff;
  --accent-text: #ffffff;
  --radius: 12px;
  --max: 1120px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 15% -10%, rgba(40, 90, 200, .35), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(120, 60, 200, .28), transparent 60%);
  background-attachment: fixed;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
img { max-width: 100%; height: auto; border-radius: var(--radius); display: block; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { border-bottom: 1px solid var(--border); position: relative; z-index: 2; }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px; flex-wrap: wrap;
}
.brand { color: var(--text); font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.nav { display: flex; gap: 20px; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav .button { color: var(--accent-text); padding: 6px 16px; }

/* Buttons */
.button {
  display: inline-block; padding: 12px 24px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
  font-weight: 600; text-decoration: none;
}
.button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Sections */
section { padding: 56px 0; }
.section-title { margin: 0 0 8px; font-size: 1.75rem; }
.section-lead { margin: 0 0 28px; color: var(--muted); max-width: 640px; }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .9rem; margin: 0 0 8px; }

/* Plain hero (404 page) */
.hero { padding: 80px 0 64px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0 0 16px; }
.hero p { color: var(--muted); font-size: 1.2rem; max-width: 640px; margin: 0 0 28px; }

/* ------------------------------------------------------------------------------------------
   Scroll showcase (home page). A sticky stage holds the device; the steps scroll over it and
   js/showcase.js sets data-step on .story to the step in the middle of the viewport. Each
   data-step value below moves the device; the matching .slide fades in on its screen.
   ------------------------------------------------------------------------------------------ */

.story { position: relative; overflow-x: clip; --W: min(960px, 90vw); }

.stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  display: grid; place-items: center; pointer-events: none;
}

.steps { position: relative; margin-top: -100vh; margin-top: -100svh; }
.step { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; }
.step-text { max-width: min(440px, 36vw); }
.step h2 { font-size: clamp(2rem, 4vw, 3.2rem); margin: 0 0 16px; }
.step p { color: var(--muted); font-size: 1.1rem; margin: 0; }

.step.intro { align-items: flex-start; justify-content: center; text-align: center; padding-top: 9vh; }
.step.intro .step-text { max-width: 760px; }
.step.intro h1 { font-size: clamp(2.4rem, 6.5vw, 4.2rem); margin: 0 0 16px; }
.step.intro p { font-size: 1.2rem; margin: 0 auto 28px; max-width: 620px; }
.step.intro .actions { justify-content: center; }
.step.intro .note { font-size: .9rem; margin-top: 16px; }

.js .step-text { opacity: .15; transform: translateY(16px); transition: opacity .6s, transform .6s var(--ease); }
.js .step.is-active .step-text { opacity: 1; transform: none; }

/* Device positions per step */
.device {
  --s: .8; --x: 0px; --y: 24vh;
  transform: translate(var(--x), var(--y)) scale(var(--s));
  transition: transform .9s var(--ease);
}
.story:not([data-step="intro"]) .device { --s: .62; --x: calc(46vw - var(--W) * .31); --y: 0px; }

.story[data-step="controller"] .ctrl.left { transform: translateX(-5em) rotate(-8deg); }
.story[data-step="controller"] .ctrl.right { transform: translateX(5em) rotate(8deg); }
.story[data-step="rgb"] .ring { animation-duration: 1.2s; }
.story[data-step="rgb"] .stick { box-shadow: 0 0 4em 1em rgba(150, 90, 255, .55); }

/* The device: a CSS stand-in for a Legion Go. 1em = 1% of its width. */
.device {
  width: var(--W); font-size: calc(var(--W) / 100);
  height: 43em; display: flex;
  filter: drop-shadow(0 3em 4em rgba(0, 0, 0, .6));
}
.ctrl {
  width: 17em; position: relative;
  background: linear-gradient(160deg, #2c313b, #14171d 70%);
  border: .15em solid #353b47;
  transition: transform .9s var(--ease);
}
.ctrl.left { border-radius: 7em 1.5em 1.5em 9em / 7em 1.5em 1.5em 16em; margin-right: -.6em; }
.ctrl.right { border-radius: 1.5em 7em 9em 1.5em / 1.5em 7em 16em 1.5em; margin-left: -.6em; }

.body {
  width: 66em; padding: 2.4em 2.5em; position: relative; z-index: 1;
  background: #191c22; border-radius: 1.6em; border: .15em solid #2c313b;
}
.screen { position: relative; height: 100%; border-radius: .6em; overflow: hidden; background: #000; }

.stick {
  position: absolute; left: 50%; width: 9em; height: 9em; margin-left: -4.5em;
  border-radius: 50%; background: radial-gradient(circle, #2e333c 52%, #0c0e12 54%);
  transition: box-shadow .6s;
}
.ctrl.left .stick { top: 5em; }
.ctrl.right .stick { top: 21em; }
.ring {
  position: absolute; inset: -1em; border-radius: 50%;
  background: conic-gradient(#ff3df5, #5b9cff, #3dffc8, #f5ff3d, #ff8a3d, #ff3df5);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1em), #000 calc(100% - .9em));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1em), #000 calc(100% - .9em));
  animation: spin 6s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

.dpad { position: absolute; top: 20em; left: 50%; width: 8em; height: 8em; margin-left: -4em; }
.dpad::before, .dpad::after {
  content: ""; position: absolute; background: #0f1115; border-radius: .6em; border: .1em solid #2c313b;
}
.dpad::before { left: 2.7em; width: 2.6em; height: 100%; }
.dpad::after { top: 2.7em; height: 2.6em; width: 100%; }

.abxy { position: absolute; top: 4em; left: 50%; width: 10em; height: 10em; margin-left: -5em; }
.abxy span {
  position: absolute; width: 2.3em; height: 2.3em; border-radius: 50%;
  background: #0f1115; border: .1em solid #3a404c;
  color: #6c7484; font: 700 1.4em/2.2em system-ui, sans-serif; text-align: center;
}
.abxy .y { top: 0; left: 50%; margin-left: -1.15em; }
.abxy .a { bottom: 0; left: 50%; margin-left: -1.15em; }
.abxy .x { left: 0; top: 50%; margin-top: -1.15em; }
.abxy .b { right: 0; top: 50%; margin-top: -1.15em; }

/* Screen content. Each .slide is a placeholder until a real recording replaces it (see README). */
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; }
.slide.is-active { opacity: 1; }
.slide video, .slide img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

.ph {
  height: 100%; padding: 3.5em; display: flex; flex-direction: column; gap: 2em; color: #fff;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
.ph-title { font-size: 3.4em; font-weight: 700; line-height: 1.1; }
.ph-bars { display: grid; gap: 1.6em; max-width: 34em; }
.ph-bar { height: 1.8em; border-radius: 1em; background: rgba(255, 255, 255, .16); position: relative; overflow: hidden; }
.ph-bar::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit;
  background: rgba(255, 255, 255, .8); transition: width 1.1s .3s var(--ease);
}
.slide.is-active .ph-bar::after { width: var(--v); }
.ph-tiles { display: flex; gap: 1.4em; margin-top: auto; }
.ph-tiles span { flex: 1; aspect-ratio: 3 / 4; border-radius: .8em; background: rgba(255, 255, 255, .16); }
.ph-label {
  margin-top: auto; align-self: flex-start; font-size: 1.5em; padding: .3em .8em;
  border: .1em dashed rgba(255, 255, 255, .55); border-radius: .4em; opacity: .85;
}
.ph-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 34%; padding: 3em 2.5em;
  display: flex; flex-direction: column; gap: 1.6em;
  background: rgba(10, 14, 24, .82); border-left: .1em solid rgba(255, 255, 255, .15);
  transform: translateX(105%); transition: transform .8s .35s var(--ease);
}
.slide.is-active .ph-panel { transform: none; }

/* Phones and narrow windows: device at the top, text card at the bottom. */
@media (max-width: 820px) {
  .story { --W: 94vw; }
  .device { --s: 1; --y: 20vh; }
  .story:not([data-step="intro"]) .device { --s: 1; --x: 0px; --y: -22vh; }
  .step { align-items: flex-end; padding-bottom: 8vh; }
  .step-text {
    max-width: none; padding: 20px; border-radius: var(--radius);
    background: rgba(10, 14, 24, .85); border: 1px solid var(--border);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  }
  .step.intro { padding-top: 6vh; }
  .step.intro .step-text { background: none; border: 0; padding: 0 16px; backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .device, .ctrl, .slide, .ph-bar::after, .ph-panel, .js .step-text { transition: none; }
  .ring { animation: none; }
}

/* Devices row */
.devices { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.devices li { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; }
.devices .soon { color: var(--muted); }

/* Latest-news strip on the home page */
.latest { display: grid; gap: 12px; }
.latest a {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px;
}
.latest a:hover { border-color: var(--accent); }
.latest time { color: var(--muted); font-size: .85rem; display: block; }

.cta { text-align: center; padding: 96px 0; }
.cta h2 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 24px; }
.cta .actions { justify-content: center; }

/* News page */
.page-title { padding: 48px 0 8px; }
.page-title h1 { margin: 0; }
.page-title p { color: var(--muted); margin: 4px 0 0; }

[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* News filters */
.filters { padding: 16px 0 0; display: grid; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .95rem; cursor: pointer;
  padding: 6px 16px; border-radius: 999px;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-row select, .filter-row input {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 8px 16px; min-height: 42px;
}
.filter-row input { flex: 1 1 220px; min-width: 0; }
.filter-row select:focus-visible, .filter-row input:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.filter-count { margin: 0; color: var(--muted); font-size: .9rem; }
.news-empty { padding: 32px 0 72px; color: var(--muted); }
.news-empty p { margin: 0 0 16px; }
.news-empty .button { font: inherit; font-weight: 600; cursor: pointer; }

.news { padding: 16px 0 72px; display: grid; gap: 16px; }
.post {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; scroll-margin-top: 16px;
}
.post:target { border-color: var(--accent); }
.post h2 { margin: 0 0 4px; font-size: 1.4rem; }
.post h2 a { color: var(--text); text-decoration: none; }
.post h2 a:hover { text-decoration: underline; }
.post .meta { color: var(--muted); font-size: .9rem; margin: 0 0 12px; }
.post .tag {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--border); font-size: .8rem;
}
.post img { margin: 12px 0; }
.post pre { overflow-x: auto; padding: 12px 16px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); }
.post blockquote { margin: 12px 0; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.post-links { display: flex; flex-wrap: wrap; gap: 8px; }
.post-links .button { padding: 8px 18px; }
.post > :last-child { margin-bottom: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.site-footer .wrap {
  padding-top: 24px; padding-bottom: 24px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.site-footer a { color: var(--muted); }
