/* ==========================================================================
   Midnight Apps — midnightapps.dev
   Single stylesheet for every page. No frameworks, no external requests.
   ========================================================================== */

:root {
  /* Surfaces */
  --bg:            #070a16;
  --bg-deep:       #04060f;
  --surface:       #0d1226;
  --surface-2:     #121935;
  --border:        rgba(146, 163, 224, 0.16);
  --border-strong: rgba(146, 163, 224, 0.30);

  /* Text */
  --text:          #f3f6ff;
  --text-soft:     #c4cdec;
  --text-muted:    #98a3c9;

  /* Accents */
  --accent:        #6e8bff;
  --accent-2:      #a98bff;
  --accent-soft:   rgba(110, 139, 255, 0.14);

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  /* Layout */
  --wrap: 1120px;
  --radius: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient midnight wash behind everything. Purely decorative. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 18% -8%,  rgba(110, 139, 255, 0.20), transparent 70%),
    radial-gradient(760px 480px at 88% 4%,   rgba(169, 139, 255, 0.16), transparent 72%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
}

img, svg { max-width: 100%; height: auto; }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 650;
}

h1 { font-size: clamp(2.1rem, 5.4vw, 3.5rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1.1em; color: var(--text-soft); }

a { color: #9db0ff; text-decoration: none; }
a:hover { color: #c3cfff; text-decoration: underline; }

strong { color: var(--text); font-weight: 620; }

ul, ol { color: var(--text-soft); padding-left: 1.25em; }
li { margin-bottom: 0.5em; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}

.lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--text-soft);
  max-width: 62ch;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a9b8ff;
  margin-bottom: 0.9rem;
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 76px 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { max-width: 66ch; margin-bottom: 2.4rem; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #06091a;
  font-weight: 650;
  padding: 12px 18px;
  border-radius: 0 0 10px 0;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid #8fa5ff;
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 10, 22, 0.82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

/* Brand / wordmark */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  padding: 6px 0;
}
.brand:hover { text-decoration: none; color: var(--text); }

.brand-mark { flex: 0 0 auto; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }

.brand-name {
  font-size: 1.06rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.brand-sub {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* Nav */
.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  padding: 8px 12px;
  cursor: pointer;
}
.nav-toggle:hover { background: var(--surface-2); }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 9px 13px;
  border-radius: 9px;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-soft);
  transition: background-color 0.16s ease, color 0.16s ease;
}
.site-nav a:hover {
  background: var(--accent-soft);
  color: var(--text);
  text-decoration: none;
}
.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--accent-soft);
}

.site-nav .nav-cta {
  margin-left: 6px;
  color: #06091a;
  font-weight: 620;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.site-nav .nav-cta:hover { color: #06091a; filter: brightness(1.08); }

/* The collapsible menu only exists when scripting is available. Without JS
   the full nav simply stacks, so navigation never depends on the toggle. */
@media (max-width: 820px) {
  .js .nav-toggle { display: inline-flex; }
  .site-nav {
    width: 100%;
    padding-bottom: 14px;
  }
  .js .site-nav { display: none; }
  .js .site-nav.is-open { display: block; }
  .header-inner { flex-wrap: wrap; }
  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .site-nav a { padding: 12px 14px; }
  .site-nav .nav-cta { margin-left: 0; text-align: center; }
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 11px;
  font-size: 0.98rem;
  font-weight: 620;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.16s ease, filter 0.16s ease,
              background-color 0.16s ease, border-color 0.16s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06091a;
}
.btn-primary:hover { color: #06091a; filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface); color: var(--text); }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 2rem;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(64px, 11vw, 120px) 0 clamp(56px, 8vw, 96px);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, var(--border-strong) 22%, var(--border-strong) 78%, transparent);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(18, 25, 53, 0.6);
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 1.6rem;
}
.hero-badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(110, 139, 255, 0.9);
}

.hero h1 { max-width: 18ch; }

.hero .gradient-text {
  background: linear-gradient(120deg, #ffffff 18%, #b9c6ff 52%, #cbb6ff 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-entity {
  margin-top: 1.9rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.hero-entity strong { color: var(--text-soft); }

/* --------------------------------------------------------------------------
   Cards & grids
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: linear-gradient(180deg, var(--surface) 0%, rgba(13, 18, 38, 0.6) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card h3 { margin-bottom: 0.45em; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: #b4c2ff;
}

/* App / portfolio card */
.app-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 22px;
  align-items: start;
}
.app-icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(150deg, #1b2450, #2a1f52);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 480px) {
  .app-card { grid-template-columns: 1fr; }
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 620;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(169, 139, 255, 0.12);
  border: 1px solid rgba(169, 139, 255, 0.34);
  color: #cbb8ff;
  margin-bottom: 0.9rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
}
.tag-row li {
  margin: 0;
  padding: 5px 12px;
  font-size: 0.83rem;
  color: var(--text-soft);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* Entity / contact panel */
.panel {
  background: linear-gradient(135deg, rgba(110, 139, 255, 0.10), rgba(169, 139, 255, 0.07));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: clamp(26px, 4vw, 40px);
}

.definition-list {
  display: grid;
  gap: 18px 28px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin: 0;
}
.definition-list dt {
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.definition-list dd {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  word-break: break-word;
}

.contact-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 1.6rem;
}
.contact-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.contact-item .label {
  display: block;
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.contact-item a {
  font-size: 1rem;
  font-weight: 560;
  word-break: break-word;
}

/* Legal document pages */
.doc-header {
  padding: clamp(48px, 7vw, 78px) 0 34px;
  border-bottom: 1px solid var(--border);
}
.doc-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.doc {
  max-width: 76ch;
  padding: 44px 0 78px;
}
.doc h2 {
  font-size: 1.35rem;
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
}
.doc h2:first-of-type { margin-top: 1rem; border-top: 0; padding-top: 0; }
.doc h3 { margin-top: 1.8rem; }

.note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 22px;
  margin: 1.6rem 0;
}
.note p:last-child { margin-bottom: 0; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin-bottom: 2rem;
}
.toc h2 {
  font-size: 0.78rem !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.8em !important;
  padding: 0 !important;
  border: 0 !important;
}
.toc ol { margin: 0; padding-left: 1.2em; }
.toc li { margin-bottom: 0.35em; }

/* Support page steps */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 16px;
}
.steps li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 20px 24px 20px 66px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 22px;
  top: 20px;
  width: 28px; height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--border-strong);
  color: #b4c2ff;
  font-size: 0.85rem;
  font-weight: 650;
}

/* Centered 404 */
.centered {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 70px 0;
}
.centered .lede { margin-left: auto; margin-right: auto; }
.error-code {
  font-family: var(--font-mono);
  font-size: clamp(3.4rem, 13vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0 0 1rem;
  background: linear-gradient(120deg, #7f97ff, #b79dff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(4, 6, 15, 0.6);
  padding: 56px 0 40px;
  margin-top: 0;
}

.footer-top {
  display: grid;
  gap: 34px;
  grid-template-columns: minmax(240px, 1.4fr) repeat(auto-fit, minmax(150px, 1fr));
  padding-bottom: 34px;
  border-bottom: 1px solid var(--border);
}

.footer-blurb {
  font-size: 0.94rem;
  color: var(--text-muted);
  max-width: 40ch;
  margin: 14px 0 0;
}

.footer-col h2 {
  font-size: 0.76rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.9em;
}
.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-col li { margin-bottom: 0.55em; }
.footer-col a {
  font-size: 0.94rem;
  color: var(--text-soft);
}
.footer-col a:hover { color: var(--text); }

.footer-legal {
  padding-top: 26px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.footer-legal p { margin: 0 0 0.4em; color: var(--text-muted); font-size: 0.88rem; }
.footer-legal p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Motion — tasteful, and fully disabled when the user prefers reduced motion
   -------------------------------------------------------------------------- */

/* Scoped to .js so that with scripting off nothing is ever left invisible. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover { transform: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  body::before, .site-header, .site-footer, .btn-row { display: none; }
  body { background: #fff; color: #000; }
  p, li, dd { color: #000; }
  a { color: #000; text-decoration: underline; }
}
