/* GitHub Pages stability and responsive layout fixes */

:root {
  --safe-page-width: min(1180px, calc(100vw - 32px));
  --header-x-padding: max(16px, calc((100vw - 1180px) / 2));
}

html,
body {
  width: 100%;
  max-width: 100%;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

button,
a,
input {
  touch-action: manipulation;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.hero-shell,
.section-band,
.widgets-band,
.kotlin-band,
.ledger-band,
.status-band,
.roadmap-band,
.site-footer {
  width: var(--safe-page-width);
}

.site-header {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px var(--header-x-padding);
  background: rgba(11, 19, 38, 0.72);
  border-bottom: 1px solid rgba(218, 226, 253, 0.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

.brand-mark {
  align-items: center;
  line-height: 1;
}

.brand-glyph {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.brand-glyph img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.brand-glyph::before {
  content: none;
}

.hero-note {
  max-width: 560px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.demo-stage {
  justify-self: center;
  width: 100%;
}

.primary-action {
  border-color: rgba(210, 187, 255, 0.72);
}

.control-button:hover {
  border-color: rgba(210, 187, 255, 0.62);
}

.screen-fox {
  object-fit: contain;
}

.fox-widget {
  position: relative;
  overflow: hidden;
}

.fox-widget > img {
  opacity: 0;
}

.fox-widget::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 0;
  width: min(52%, 210px);
  height: 82%;
  background-position: right bottom;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 1;
}

.fox-widget.widget-hot::after {
  background-image: url("assets/site/chibi_streak.webp");
}

.fox-widget.widget-calm::after {
  background-image: url("assets/site/chibi_dumbbell.webp");
}

.fox-widget.widget-alert::after {
  background-image: url("assets/site/chibi_watch.webp");
}

.fox-widget .widget-score,
.fox-widget p {
  position: relative;
  z-index: 2;
}

.feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.feature-grid .system-card {
  min-height: 280px;
}

.status-band,
.roadmap-band {
  margin: 0 auto;
  padding: 84px 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.status-card,
.roadmap-list div {
  border: 1px solid rgba(218, 226, 253, 0.12);
  border-radius: var(--radius);
  background: rgba(23, 31, 51, 0.72);
}

.status-card {
  padding: 20px;
  min-height: 210px;
  transform: translateY(18px);
  opacity: 0;
  transition: transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 520ms ease;
}

.status-card.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.status-card span,
.roadmap-list strong {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-card strong {
  display: block;
  margin-top: 20px;
  font-size: 24px;
  line-height: 1.1;
}

.status-card p {
  margin: 14px 0 0;
  color: var(--subtext);
  font-size: 14px;
  line-height: 1.6;
}

.roadmap-band {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(340px, 1fr);
  gap: 24px;
  align-items: start;
  border-top: 1px solid rgba(218, 226, 253, 0.12);
}

.roadmap-band > div:first-child {
  max-width: 620px;
}

.roadmap-band h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.02;
  font-weight: 950;
}

.roadmap-band p {
  color: var(--subtext);
  font-size: 17px;
  line-height: 1.65;
}

.roadmap-list {
  display: grid;
  gap: 10px;
}

.roadmap-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  color: var(--text);
}

.roadmap-list span {
  color: var(--subtext);
}

.roadmap-band .primary-action {
  justify-self: start;
  grid-column: 1 / -1;
}

@media (max-width: 1180px) {
  :root {
    --header-x-padding: 16px;
  }

  .hero-shell {
    grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  }

  .demo-stage {
    grid-template-columns: minmax(300px, 410px) minmax(210px, 280px);
  }

  .feature-grid,
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  :root {
    --safe-page-width: min(760px, calc(100vw - 32px));
  }

  .hero-shell {
    min-height: auto;
    align-items: start;
  }

  .demo-stage {
    max-width: 560px;
    margin-inline: auto;
  }

  .demo-controls {
    min-height: unset;
  }

  .system-grid:not(.feature-grid),
  .widget-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .system-grid:not(.feature-grid) .system-card:last-child,
  .fox-widget:last-child {
    grid-column: 1 / -1;
  }

  .roadmap-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --safe-page-width: min(560px, calc(100vw - 24px));
    --header-x-padding: 12px;
  }

  .site-header {
    min-height: 64px;
    padding-block: 10px;
  }

  .brand-glyph {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .hero-shell {
    padding: 18px 0 54px;
  }

  .section-band,
  .widgets-band,
  .kotlin-band,
  .ledger-band,
  .status-band,
  .roadmap-band {
    padding: 58px 0;
  }

  .system-grid,
  .widget-grid,
  .status-grid,
  .system-card:last-child,
  .fox-widget:last-child {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .system-card,
  .feature-grid .system-card {
    min-height: 190px;
  }

  .system-card h3 {
    margin-top: 44px;
  }

  .roadmap-list div {
    flex-direction: column;
    gap: 6px;
  }

  .kotlin-band,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 620px) {
  :root {
    --safe-page-width: calc(100vw - 22px);
  }

  .hero-shell,
  .section-band,
  .widgets-band,
  .kotlin-band,
  .ledger-band,
  .status-band,
  .roadmap-band,
  .site-footer {
    width: var(--safe-page-width);
    max-width: var(--safe-page-width);
  }

  .site-header {
    width: 100%;
    max-width: none;
  }

  .nav-links {
    display: none;
  }

  .hero-copy h1 {
    font-size: clamp(50px, 20vw, 76px);
  }

  .hero-lede {
    font-size: 17px;
  }

  .phone-shell {
    width: var(--safe-page-width);
    max-width: var(--safe-page-width);
    min-height: auto;
  }

  .phone-screen {
    min-height: 540px;
  }

  .metric-panel {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .metric-value {
    min-width: 0;
    font-size: 40px;
  }

  .lift-row,
  .signal-meter {
    grid-template-columns: 62px minmax(0, 1fr) 36px;
    gap: 8px;
  }

  .phone-nav {
    gap: 4px;
    padding: 5px;
  }

  .phone-nav button {
    font-size: 10px;
    padding-inline: 2px;
  }

  .demo-controls {
    padding: 16px;
  }

  .demo-controls h2 {
    font-size: 24px;
  }

  .fox-widget {
    min-height: 320px;
  }

  .fox-widget::after {
    width: 58%;
    height: 78%;
    right: 8px;
  }
}

@media (max-width: 380px) {
  .brand-mark span:last-child {
    display: none;
  }

  .brand-glyph {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }

  .screen-top {
    padding-right: 68px;
  }

  .screen-fox {
    width: 64px;
    height: 64px;
  }

  .phone-nav button {
    font-size: 9px;
  }
}
