/* ═══════════════════════════════════════════════════════
   Mile High Sandbox — Alpine Noir
   ═══════════════════════════════════════════════════════ */

:root {
  --void: #07090f;
  --deep: #0d1117;
  --surface: #151b25;
  --surface-raised: #1c2333;
  --border: rgba(196, 149, 106, 0.12);
  --border-focus: rgba(196, 149, 106, 0.35);
  --text-primary: #e8e0d6;
  --text-secondary: rgba(232, 224, 214, 0.85);
  --text-tertiary: rgba(232, 224, 214, 0.6);
  --amber: #c4956a;
  --amber-glow: rgba(196, 149, 106, 0.15);
  --amber-bright: #daa87c;
  --slate: #5a6a7a;
  --error: #c46a6a;
  --error-bg: rgba(196, 106, 106, 0.08);
  --font-body: 'Quicksand', sans-serif;
  --font-display: 'Cormorant Garamond', serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--void);
  line-height: 1.7;
  overflow-x: hidden;
}

::selection {
  background: var(--amber);
  color: var(--void);
}


/* ── Landing Page ─────────────────────────────────────── */

.landing {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.landing__bg {
  position: absolute;
  inset: 0;
  background: url('/static/images/mhsb1-mobile.webp') no-repeat center center;
  background-size: cover;
  transform: scale(1.05);
  animation: bgSettle 2.4s var(--ease-out-expo) forwards;
}

@media (min-width: 768px) {
  .landing__bg {
    background-image: url('/static/images/mhsb1-web.webp');
  }
}

@keyframes bgSettle {
  to { transform: scale(1); }
}

.landing__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg,
      rgba(7, 9, 15, 0.45) 0%,
      rgba(7, 9, 15, 0.55) 40%,
      rgba(7, 9, 15, 0.75) 100%
    );
}

/* Topographic contour decoration */
.landing__contours {
  position: absolute;
  inset: 0;
  opacity: 0;
  animation: contoursReveal 3s 0.8s var(--ease-out-expo) forwards;
  pointer-events: none;
}

@keyframes contoursReveal {
  to { opacity: 1; }
}

.landing__contours svg {
  position: absolute;
  bottom: -5%;
  left: -10%;
  width: 120%;
  height: 60%;
  opacity: 0.04;
}

.landing__content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 820px;
  padding: 0 2rem;
}

.landing__name {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.8rem, 7vw, 5.2rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(30px);
  animation: riseIn 1.2s 0.3s var(--ease-out-expo) forwards;
}

.landing__name span {
  display: block;
  font-size: 0.38em;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.8rem;
  opacity: 0;
  animation: riseIn 1s 0.1s var(--ease-out-expo) forwards;
}

@keyframes riseIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.landing__rule {
  width: 60px;
  height: 1px;
  background: var(--amber);
  border: none;
  margin: 2.5rem auto;
  opacity: 0;
  animation: riseIn 1s 0.6s var(--ease-out-expo) forwards;
}

.landing__desc {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 600px;
  margin: 0 auto;
  opacity: 0;
  transform: translateY(20px);
  animation: riseIn 1.2s 0.7s var(--ease-out-expo) forwards;
}

.landing__desc strong {
  color: var(--text-primary);
  font-weight: 600;
}

.landing__markets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.2rem;
  margin-top: 2rem;
  opacity: 0;
  animation: riseIn 1s 1s var(--ease-out-expo) forwards;
}

.landing__markets li {
  list-style: none;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  position: relative;
  padding-left: 1rem;
}

.landing__markets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 4px;
  height: 4px;
  background: var(--amber);
  border-radius: 50%;
  transform: translateY(-50%);
}

/* Client access link — bottom right */
.landing__access {
  position: fixed;
  bottom: 2rem;
  right: 2.5rem;
  z-index: 10;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  padding: 0.5rem 0;
  border-bottom: 1px solid transparent;
  transition: color 0.4s, border-color 0.4s;
  opacity: 0;
  animation: riseIn 1s 1.5s var(--ease-out-expo) forwards;
}

.landing__access:hover {
  color: var(--amber);
  border-bottom-color: var(--amber);
}


/* ── Access Page ──────────────────────────────────────── */

.access-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--void);
  position: relative;
}

.access-page::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--amber-glow), transparent 70%);
  transform: translateX(-50%);
  pointer-events: none;
}

.access-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 3rem 2.5rem;
  margin: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  opacity: 0;
  transform: translateY(20px);
  animation: riseIn 0.8s 0.2s var(--ease-out-expo) forwards;
}

.access-card__back {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-decoration: none;
  margin-bottom: 2.5rem;
  transition: color 0.3s;
}

.access-card__back:hover {
  color: var(--amber);
}

.access-card__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.access-card__subtitle {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 2rem;
}

.access-card__input-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.access-card__input {
  width: 100%;
  padding: 1rem 1.2rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 2px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  text-align: center;
}

.access-card__input::placeholder {
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.access-card__input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--amber-glow);
}

.access-card__submit {
  width: 100%;
  padding: 0.9rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--void);
  background: var(--amber);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.3s, transform 0.15s;
}

.access-card__submit:hover {
  background: var(--amber-bright);
}

.access-card__submit:active {
  transform: scale(0.985);
}

.access-card__error {
  margin-top: 1.2rem;
  padding: 0.8rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--error);
  background: var(--error-bg);
  border-left: 2px solid var(--error);
  border-radius: 0 2px 2px 0;
}


/* ── Document Viewer ──────────────────────────────────── */

.doc-page {
  min-height: 100vh;
  background: var(--deep);
}

.doc-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 2rem;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.doc-header__back {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.3s;
}

.doc-header__back:hover {
  color: var(--amber);
}

.doc-header__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.doc-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
  opacity: 0;
  animation: riseIn 0.8s 0.15s var(--ease-out-expo) forwards;
}

/* Document title */
.doc-container > h1:first-child,
.doc-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* Prose styling for rendered markdown */
.doc-content h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.2rem;
  line-height: 1.25;
  color: var(--text-primary);
  margin: 3rem 0 1rem;
}

.doc-content h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.65rem;
  line-height: 1.3;
  color: var(--text-primary);
  margin: 2.8rem 0 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.doc-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  margin: 2rem 0 0.6rem;
}

.doc-content h4 {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 1.8rem 0 0.5rem;
}

.doc-content p {
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
  font-size: 1.02rem;
}

.doc-content a {
  color: var(--amber);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(196, 149, 106, 0.3);
  transition: text-decoration-color 0.3s;
}

.doc-content a:hover {
  text-decoration-color: var(--amber);
}

.doc-content strong {
  color: var(--text-primary);
  font-weight: 700;
}

.doc-content ul, .doc-content ol {
  color: var(--text-secondary);
  margin: 0 0 1.2rem 1.5rem;
}

.doc-content li {
  margin-bottom: 0.4rem;
}

.doc-content li::marker {
  color: var(--amber);
}

.doc-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--amber);
  background: var(--surface);
  border-radius: 0 2px 2px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.doc-content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2.5rem 0;
}

/* Inline code */
.doc-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.88em;
  padding: 0.15em 0.45em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--amber-bright);
}

/* Code blocks (Pygments codehilite) */
.doc-content .highlight,
.doc-content .codehilite {
  margin: 1.5rem 0;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.doc-content .highlight pre,
.doc-content .codehilite pre {
  margin: 0;
  padding: 1.2rem 1.5rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  background: var(--void) !important;
  color: var(--text-secondary);
}

.doc-content .highlight pre code,
.doc-content .codehilite pre code {
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
  font-size: inherit;
}

/* Tables */
.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}

.doc-content thead th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.doc-content tbody td {
  padding: 0.7rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.doc-content tbody tr:hover td {
  background: var(--surface);
}

/* TOC */
.doc-content .toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 1.5rem 2rem;
  margin-bottom: 2.5rem;
}

.doc-content .toc > ul {
  margin: 0;
  list-style: none;
  padding: 0;
}

.doc-content .toc ul ul {
  margin: 0.2rem 0 0 1.2rem;
  list-style: none;
}

.doc-content .toc li {
  margin-bottom: 0.25rem;
}

.doc-content .toc a {
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--text-secondary);
}

.doc-content .toc a:hover {
  color: var(--amber);
}

/* Permalink anchors from TOC extension */
.doc-content .headerlink {
  font-size: 0.8em;
  color: var(--text-tertiary);
  text-decoration: none;
  margin-left: 0.4em;
  opacity: 0;
  transition: opacity 0.2s;
}

.doc-content h1:hover .headerlink,
.doc-content h2:hover .headerlink,
.doc-content h3:hover .headerlink,
.doc-content h4:hover .headerlink {
  opacity: 1;
}


/* ── Pygments Dark Theme ──────────────────────────────── */

.highlight .hll { background-color: var(--surface-raised); }
.highlight .c,
.highlight .c1,
.highlight .cm,
.highlight .cs,
.highlight .ch,
.highlight .cpf { color: #5a6a7a; font-style: italic; }  /* comments */
.highlight .k,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kc,
.highlight .kd,
.highlight .kt { color: #c792ea; }  /* keywords */
.highlight .s,
.highlight .s1,
.highlight .s2,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .dl,
.highlight .sd,
.highlight .se,
.highlight .sh,
.highlight .sx { color: #c3e88d; }  /* strings */
.highlight .mi,
.highlight .mf,
.highlight .mh,
.highlight .mo,
.highlight .mb,
.highlight .il { color: #f78c6c; }  /* numbers */
.highlight .na,
.highlight .nb { color: #82aaff; }  /* names/builtins */
.highlight .nc,
.highlight .nd,
.highlight .ni,
.highlight .ne { color: #ffcb6b; }  /* class/decorator/entity */
.highlight .nf,
.highlight .fm { color: #82aaff; }  /* functions */
.highlight .nt { color: #f07178; }  /* tags */
.highlight .o,
.highlight .ow { color: #89ddff; }  /* operators */
.highlight .p { color: #89ddff; }   /* punctuation */
.highlight .gd { color: #f07178; }  /* diff deleted */
.highlight .gi { color: #c3e88d; }  /* diff inserted */
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: bold; }
.highlight .err { color: #f07178; }


/* ── 404 Page ─────────────────────────────────────────── */

.error-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--void);
  text-align: center;
  padding: 2rem;
}

.error-page__code {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(5rem, 15vw, 10rem);
  line-height: 1;
  color: var(--surface-raised);
}

.error-page__msg {
  font-size: 1rem;
  color: var(--text-tertiary);
  margin: 1rem 0 2.5rem;
}

.error-page__link {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--amber);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

.error-page__link:hover {
  border-bottom-color: var(--amber);
}


/* ── Responsive ───────────────────────────────────────── */

@media (max-width: 600px) {
  .access-card {
    padding: 2.5rem 1.5rem;
  }

  .doc-container {
    padding: 2rem 1.2rem 4rem;
  }

  .doc-header {
    padding: 0.8rem 1.2rem;
  }

  .landing__access {
    right: 1.2rem;
    bottom: 1.2rem;
  }

  .landing__content {
    padding: 0 1.2rem;
  }
}
