:root {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #30363d;
  --text: #ffffff;
  --text-dim: #d5dbe2;
  --link: #58a6ff;
  --nav-height: 56px;
  --subnav-height: 44px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, Segoe UI, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.75rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  z-index: 10;
}
nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
}
nav a:hover { background: rgba(255,255,255,0.08); color: var(--text); }
nav a.active { background: var(--link); color: #0d1117; font-weight: 600; }
nav a.home { color: var(--text); font-weight: 700; margin-right: 0.5rem; }

.subnav {
  position: fixed;
  top: var(--nav-height);
  left: 0; right: 0;
  height: var(--subnav-height);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.75rem 0 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  white-space: nowrap;
  z-index: 9;
}
.subnav .subnav-label {
  color: var(--text);
  opacity: 0.85;
  font-size: 0.95rem;
  margin-right: 0.5rem;
}
.subnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
}
.subnav a:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.subnav a.active { color: var(--text); font-weight: 600; background: rgba(88,166,255,0.15); }

body.has-subnav main {
  padding-top: calc(var(--nav-height) + var(--subnav-height));
}

main {
  padding-top: var(--nav-height);
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
main picture { display: contents; }
main img {
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - var(--nav-height) - 2rem);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  margin: 1rem;
}
body.has-subnav main img {
  max-height: calc(100vh - var(--nav-height) - var(--subnav-height) - 2rem);
}
.status {
  color: var(--text-dim);
  font-size: 1.1rem;
  text-align: center;
  padding: 2rem;
}

/* Landing page (index) uses a scrollable list instead of the full-screen layout */
body.landing main {
  display: block;
  height: auto;
  min-height: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 1.5rem) 1rem 2rem;
}
body.landing h1 { font-size: 1.6rem; }
body.landing p.intro { color: var(--text-dim); }
body.landing ul.pillar-list { list-style: none; padding: 0; }
body.landing ul.pillar-list li { margin: 0.6rem 0; }
body.landing ul.pillar-list a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.9rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  white-space: normal;
}
body.landing ul.pillar-list a:hover { border-color: var(--link); }
body.landing ul.pillar-list .pillar-name { display: block; }
body.landing ul.pillar-list .pillar-desc {
  display: block;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-dim);
  font-weight: 400;
}
body.landing footer {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
body.landing footer a { color: var(--link); }

/* Mobile: wrap the top nav so every tab is visible, size both bars to
   their text (no reserved empty strip), and keep them sticky. */
@media (max-width: 700px) {
  /* Take nav/subnav out of fixed pixel boxes so they hug their text.
     Sticky keeps them on screen; in-flow height means main doesn't need
     a guessed --nav-height / --subnav-height spacer. Landing stays block
     so the pillar list can grow and scroll. */
  body:not(.landing) {
    display: flex;
    flex-direction: column;
  }
  nav {
    position: sticky;
    top: 0;
    height: auto;
    flex-shrink: 0;
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
    padding: 0.35rem 0.5rem;
    align-content: center;
    row-gap: 0.15rem;
    column-gap: 0.15rem;
  }
  nav a {
    font-size: 0.88rem;
    line-height: 1.25;
    padding: 0.3rem 0.55rem;
  }
  .subnav {
    position: sticky;
    top: 0;
    height: auto;
    flex-shrink: 0;
    flex-wrap: wrap;
    overflow-x: visible;
    white-space: normal;
    min-height: 0;
    padding: 0.3rem 0.45rem;
    align-content: center;
    align-items: center;
    row-gap: 0.12rem;
    column-gap: 0.12rem;
  }
  .subnav a {
    flex: 0 0 auto;
    font-size: 0.9rem;
    line-height: 1.25;
    padding: 0.28rem 0.5rem;
  }
  main,
  body.has-subnav main {
    padding-top: 0;
  }
  body:not(.landing) main,
  body:not(.landing).has-subnav main {
    flex: 1;
    min-height: 0;
  }
  body.landing main {
    padding: 0.15rem 1rem 2rem;
  }
  body.landing p.intro {
    margin-top: 0.15rem;
  }
  body.has-subnav main img {
    max-height: calc(100vh - 8rem);
  }
  .subnav-label {
    /* The parent nav tab above is already highlighted as active, so this
       label is redundant on a wrapped phone row. */
    display: none;
  }
  /* Nav already has the site name; the in-page h1 duplicates it and pushes
     the pillar list below the fold. */
  body.landing h1 { display: none; }
  body.landing footer {
    border-top: none;
    padding-top: 0;
  }
}
