/* ==============================
   Reset & Base
   ============================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  color: #1a1a1a;
  background: #f5f5f5;
}

/* ==============================
   Sticky Header
   ============================== */

#site-header {
  background: #1a1a2e;
  color: #fff;
  padding: 1rem 1.5rem;
  z-index: 100;
  transition: box-shadow 0.2s;
}

#site-header[data-keeptrack-stuck] {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background: #16213e;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.stuck-indicator {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

#site-header[data-keeptrack-stuck] .stuck-indicator {
  background: #e94560;
}

.header-info {
  margin-left: auto;
  font-size: 0.75rem;
  opacity: 0.7;
}

.header-info code {
  color: #7ec8e3;
}

/* ==============================
   Sub-nav (second sticky bar)
   ============================== */

.subnav-container {
  /* The sub-nav unsticks when this container scrolls out of view */
}

#sub-nav {
  background: #0f3460;
  color: #fff;
  min-height: 48px;
  padding: 0.6rem 1.5rem;
  z-index: 99;
  transition: box-shadow 0.2s, background 0.2s;
}

#sub-nav[data-keeptrack-stuck] {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background: #0a2647;
}

.subnav-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto;
  flex-wrap: wrap;
}

#sub-nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s;
}

#sub-nav a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

#sub-nav[data-keeptrack-stuck] .subnav-stuck-indicator {
  background: #e94560;
}

.unstick-notice {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.unstick-notice p {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 1rem;
  margin: 0;
  font-size: 0.85rem;
  color: #664d03;
}

/* ==============================
   Main
   ============================== */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* ==============================
   Test Sections
   ============================== */

.test-section {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.test-section h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.test-section p {
  margin-top: 0;
  color: #555;
  font-size: 0.9rem;
}

.test-section code {
  background: #f0f0f0;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.85em;
}

/* ==============================
   Boxes
   ============================== */

.box {
  background: #e8f4f8;
  border: 2px solid #b8d8e8;
  border-radius: 8px;
  padding: 1rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
}

.box-info {
  font-size: 0.8rem;
  color: #555;
}

.box-info code {
  color: #0a6abf;
  font-weight: 600;
}

/* Resizable boxes */
.resizable {
  resize: both;
  overflow: auto;
  min-width: 150px;
  max-width: 100%;
  cursor: nwse-resize;
}

/* Consumer box (uses tracked variable) */
.consumer {
  background: #f0e8f8;
  border-color: #d0b8e8;
  min-height: var(--tracked-box-height, 80px);
  transition: min-height 0.2s;
}

/* Multi-property box */
.multi {
  padding-top: 2rem;
  border-radius: 16px;
}

/* ==============================
   Parent / Wrapper / Layout tests
   ============================== */

.grandparent {
  background: #fff8e1;
  border: 2px dashed #f0c040;
  border-radius: 8px;
  padding: 1rem;
}

.parent-box {
  padding: 0.5rem;
}

.wrapper {
  background: #e8f8e8;
  border: 2px dashed #80c080;
  border-radius: 8px;
  padding: 1rem;
}

.layout {
  background: #f8e8f0;
  border: 2px dashed #c080a0;
  border-radius: 8px;
  padding: 1rem;
}

/* ==============================
   Poll box (hover changes bg)
   ============================== */

.poll-box {
  background: #3498db;
  color: #fff;
  border-color: #2980b9;
  transition: background-color 0.3s;
  cursor: pointer;
}

.poll-box:hover {
  background: #e74c3c;
  border-color: #c0392b;
}

.poll-box .box-info {
  color: rgba(255, 255, 255, 0.8);
}

.poll-box .box-info code {
  color: #fff;
}

/* ==============================
   Buttons
   ============================== */

.button-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

button {
  background: #1a1a2e;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

button:hover {
  background: #16213e;
}

button:active {
  background: #0f3460;
}

/* ==============================
   onChange Log
   ============================== */

.log {
  background: #1a1a2e;
  color: #7ec8e3;
  font-family: "SF Mono", "Fira Code", "Fira Mono", monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  padding: 1rem;
  border-radius: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.log div {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0;
}

/* ==============================
   Spacer (for scroll testing)
   ============================== */

.spacer {
  height: 120vh;
}

/* ==============================
   Section Headings
   ============================== */

.section-heading {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #ddd;
}

/* ==============================
   Anchor nav & sections
   ============================== */

.anchor-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.anchor-nav a {
  background: #e8f4f8;
  border: 1px solid #b8d8e8;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85rem;
}

.anchor-nav a:hover {
  background: #d0ecf4;
}

.anchor-section {
  min-height: 50vh;
}

.anchor-filler {
  height: 30vh;
}

/* ==============================
   Anchor link
   ============================== */

a {
  color: #0a6abf;
}
