/* SunriseSimulator site stylesheet — responsive, works in Safari, Chrome & Firefox */

:root {
  --bg: #ffffff;
  --bg-alt: #faf4ec;
  --text: #1f2328;
  --muted: #59606a;
  --accent: #b45309;        /* sunrise amber */
  --accent-soft: #c2620a;
  --border: #e4d9c9;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181d;
    --bg-alt: #1f2229;
    --text: #e6e4df;
    --muted: #a5a29b;
    --accent: #f4a259;
    --accent-soft: #f2b06a;
    --border: #363a43;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

/* ---------- Header & navigation ---------- */

header {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0.6rem 1.25rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.site-name {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  margin-right: auto;
}

.site-name span {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9rem;
  display: block;
  line-height: 1.2;
}

nav {
  flex-basis: 100%;
}

nav ul {
  list-style: none;
  margin: 0.25rem 0 0.35rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.35rem;
}

nav a {
  display: block;
  padding: 0.3rem 0.55rem;
  border-radius: 0.4rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

nav a:hover {
  background: var(--border);
}

nav a[aria-current="page"] {
  background: var(--accent);
  color: #fff;
}

/* Hamburger toggle — hidden on desktop */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  line-height: 0;
}

.nav-toggle-label svg {
  width: 1.4rem;
  height: 1.4rem;
  stroke: var(--text);
}

@media (max-width: 700px) {
  .nav-toggle-label {
    display: inline-block;
  }
  header nav {
    display: none;
  }
  .nav-toggle:checked ~ nav {
    display: block;
  }
  header nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0.25rem 0 0.5rem;
  }
  header nav a {
    padding: 0.55rem 0.55rem;
    white-space: normal;
  }
}

/* ---------- Content ---------- */

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0.5rem 0 1rem;
}

h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin: 2.2rem 0 0.7rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 1.6rem 0 0.4rem;
}

p {
  margin: 0 0 1rem;
  overflow-wrap: break-word;
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.35rem;
}

a {
  color: var(--accent-soft);
}

a:hover {
  color: var(--accent);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  padding: 0.1rem 0.3rem;
  overflow-wrap: anywhere;
}

/* Screenshots: never wider than the column, keep aspect ratio */
main img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4rem auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

/* ---------- Footer ---------- */

footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.footer-inner h2 {
  border: none;
  padding-top: 0;
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.footer-inner p {
  margin-bottom: 0.5rem;
}

/* ---------- Phone screenshot floated beside text ---------- */

.page-shot {
  float: right;
  width: 220px;
  max-width: 42%;
  height: auto;
  margin: 0.2rem 0 1rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  box-shadow: var(--shadow);
}

@media (max-width: 560px) {
  .page-shot {
    float: none;
    display: block;
    margin: 0 auto 1.5rem;
    max-width: 240px;
  }
}

/* ---------- Section sub-navigation (Lights group) ---------- */

.subnav {
  margin: 0.25rem 0 1.75rem;
}

.subnav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.subnav a {
  display: block;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  font-size: 0.92rem;
  color: var(--text);
  text-decoration: none;
}

.subnav a:hover {
  background: var(--bg-alt);
}

.subnav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Dark mode: original night-sky background ---------- */
/* The photo sits on a fixed pseudo-element rather than using
   background-attachment:fixed, which iOS Safari handles badly. */

@media (prefers-color-scheme: dark) {
  html {
    background-color: #000;
  }

  body {
    background-color: transparent;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: url(images/bg-nebula-1600.jpg);
    background-size: cover;
    background-position: 50% 50%;
    background-repeat: no-repeat;
    opacity: 0.32;
    pointer-events: none;
  }

  /* let the sky show through the chrome, but keep nav/footer legible */
  header,
  footer {
    background-color: rgba(12, 13, 18, 0.72);
  }
}

@media (prefers-color-scheme: dark) and (max-width: 700px) {
  body::before {
    background-image: url(images/bg-nebula-768.jpg);
  }
}
