/* ==========================================================================
   STYLE GUIDE: "TECH-GRID + 3D MASCOT"
   Neo-brutalist blueprint layout with soft glossy 3D accents.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700;800&family=Space+Grotesk:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Blueprint Tech-Grid Palette */
  --bg:           #ECECEA;  /* warm light gray page background */
  --surface:      #F6F6F4;  /* cells and cards */
  --surface-2:    #E2E2DE;
  --ink:          #0E0E0E;  /* text and strong borders */
  --ink-soft:     #5A5A58;  /* secondary text */
  --dim:          #8A8A86;  /* tertiary / meta */
  --line:         #CFCFCB;  /* grid lines */
  --line-bold:    #0E0E0E;  /* primary structural lines */
  --accent:       #FF5A1F;  /* the one vibrant orange */
  --accent-hover: #E64A12;
  --accent-glow:  #FFB48F;  /* soft glow behind 3D */
  --accent-soft:  rgba(255, 90, 31, 0.12);
  --accent-ink:   #0E0E0E;

  /* State colors */
  --ok:           #0B8A44;
  --ok-soft:      #E4F5EB;
  --warn:         #C27803;
  --warn-soft:    #FEF5E7;
  --err:          #D92D20;
  --err-soft:     #FEE4E2;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Dimensions & Grid */
  --max-w:        1280px;
  --grid-gap:     16px;
  --radius:       4px;      /* Sharp, technical corners */
  --radius-sm:    2px;
  --radius-lg:    8px;

  /* Hard offset shadows (neo-brutalist) */
  --shadow-hard:    3px 3px 0 #0E0E0E;
  --shadow-hard-lg: 6px 6px 0 #0E0E0E;
}

[data-theme="dark"] {
  --bg:           #0B0B0C;
  --surface:      #151516;
  --surface-2:    #202022;
  --ink:          #F2F2F0;
  --ink-soft:     #9E9EA0;
  --dim:          #68686B;
  --line:         #2A2A2C;
  --line-bold:    #F2F2F0;
  --accent:       #FF5A1F;
  --accent-hover: #FF7442;
  --accent-glow:  rgba(255, 90, 31, 0.35);
  --accent-soft:  rgba(255, 90, 31, 0.18);
  --accent-ink:   #0E0E0E;
  --shadow-hard:    3px 3px 0 #FF5A1F;
  --shadow-hard-lg: 6px 6px 0 #FF5A1F;
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: 
    linear-gradient(to right, rgba(0,0,0,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.035) 1px, transparent 1px);
  background-size: 40px 40px;
}
[data-theme="dark"] body {
  background-image: 
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }

/* Blueprint Containers */
.wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}
.narrow { max-width: 780px; }

/* Technical Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin: 0;
}
h1 { font-size: clamp(48px, 7vw, 92px); }
h2 { font-size: clamp(32px, 4.5vw, 54px); }
h3 { font-size: 22px; line-height: 1.2; letter-spacing: -0.02em; }
h4 { font-size: 15px; font-family: var(--font-mono); letter-spacing: 0.04em; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-soft); }
.dim { color: var(--dim); }

.tag-label, .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 14px;
}
.tag-label::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.lede {
  font-size: clamp(17px, 1.8vw, 20px);
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1.5px solid var(--ink);
  transition: background 0.2s ease;
}
.nav .wrap {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand .mark {
  width: 26px;
  height: 26px;
  background: var(--accent);
  border: 1.5px solid var(--ink);
  display: grid;
  place-items: center;
  color: #0E0E0E;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  box-shadow: 2px 2px 0 var(--ink);
}
.nav .links {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  white-space: nowrap;
}
.nav .links a {
  padding: 6px 2px;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}
.nav .links a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.nav .spacer { flex: 1; min-width: 8px; }
.nav .nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 980px) {
  .nav .links { display: none; }
}

/* ==========================================================================
   BUTTONS (Neo-Brutalist Hard Offset Shadows)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  user-select: none;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hard);
  background: #fff;
}
.btn:active {
  transform: translate(0, 0);
  box-shadow: none;
}

.btn.primary, .btn-primary {
  background: var(--accent);
  color: #0E0E0E;
  border-color: var(--ink);
}
.btn.primary:hover, .btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-hard);
}

.btn.secondary, .btn-secondary {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
}
.btn.sm {
  padding: 7px 14px;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn.lg {
  padding: 16px 28px;
  font-size: 14.5px;
}
.btns {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

/* ==========================================================================
   BLUEPRINT GRID CELLS & REGISTRATION CORNERS
   ========================================================================== */
.grid-box, .cell {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: var(--radius);
}
/* Orange 8x8px square registration marks on opposite corners for blueprint containers */
.grid-box::before, .grid-box::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--accent);
  z-index: 5;
  pointer-events: none;
}
.grid-box::before { top: -4px; left: -4px; }
.grid-box::after   { bottom: -4px; right: -4px; }

/* Grid systems */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Technical cell borders */
.cell-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  border-top: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  background: var(--surface);
}
.cell-strip > div {
  padding: 20px 24px;
  border-right: 1px solid var(--line);
}
.cell-strip > div:last-child {
  border-right: none;
}

/* ==========================================================================
   HERO & 3D CANVAS STAGE
   ========================================================================== */
.hero {
  position: relative;
  padding: clamp(60px, 8vw, 100px) 0 clamp(40px, 6vw, 60px);
  border-bottom: 1.5px solid var(--ink);
  overflow: hidden;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }
}

.hero-content {
  position: relative;
  z-index: 2;
}
.hero h1 {
  margin-bottom: 24px;
  word-break: break-word;
}
.hero .lede {
  max-width: 54ch;
  margin-bottom: 32px;
}
.hero-meta {
  margin-top: 24px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--dim);
}

/* 3D Mascot Stage */
.stage-3d-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1.5px solid var(--ink);
  box-shadow: var(--shadow-hard-lg);
  overflow: hidden;
}
.stage-3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.stage-3d-canvas:active {
  cursor: grabbing;
}
.stage-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(255,90,31,0) 70%);
  filter: blur(28px);
  opacity: 0.65;
  pointer-events: none;
  z-index: 1;
}
.stage-caption {
  position: absolute;
  bottom: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  z-index: 3;
  pointer-events: none;
}
.stage-badge {
  background: #0E0E0E;
  color: var(--accent);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
}

/* Secondary 3D Widget Box */
.secondary-3d-box {
  width: 130px;
  height: 130px;
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--bg);
  border: 1px solid var(--ink);
  z-index: 4;
}
.secondary-3d-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   PARTNER / LOGO STRIP (Bordered Cells)
   ========================================================================== */
.logo-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1.5px solid var(--ink);
  background: var(--surface);
}
@media (max-width: 900px) {
  .logo-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 540px) {
  .logo-strip { grid-template-columns: repeat(2, 1fr); }
}
.logo-cell {
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: var(--font-mono);
  gap: 4px;
  transition: background 0.15s;
}
.logo-cell:hover {
  background: var(--surface-2);
}
.logo-cell:last-child {
  border-right: none;
}
.logo-cell .brand-name {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.logo-cell .brand-spec {
  font-size: 10.5px;
  color: var(--dim);
}

/* ==========================================================================
   TERMINAL & CODE BLOCKS
   ========================================================================== */
.term {
  background: #0E0E0E;
  color: #F2F2F0;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-hard);
}
.term .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #18181A;
  border-bottom: 1px solid #28282C;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #A0A0A5;
}
.term .bar .dots {
  display: flex;
  gap: 6px;
}
.term .bar .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #333338;
}
.term .bar .dot.active { background: var(--accent); }
pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
}
pre .c { color: #727278; }
pre .g { color: #52D88C; }
pre .y { color: #FFBB38; }
pre .o { color: var(--accent); font-weight: 700; }
pre .b { color: #6EA8FE; }

/* ==========================================================================
   SECTIONS & TECHNICAL LAYOUTS
   ========================================================================== */
section {
  padding: clamp(64px, 8vw, 100px) 0;
  border-bottom: 1.5px solid var(--ink);
}
.sec-head {
  max-width: 720px;
  margin-bottom: 40px;
}
.sec-head h2 {
  margin-bottom: 16px;
}

/* Steps (Blueprint numbered list) */
.steps {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}
.step {
  display: grid;
  grid-template-columns: 70px 1fr;
  padding: 28px 24px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.step:last-child { border-bottom: none; }
.step .n {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--ink-soft); font-size: 15px; max-width: 68ch; }

/* Tables */
.tbl-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tbl th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 14px 18px;
  border-bottom: 1.5px solid var(--ink);
  background: var(--bg);
}
.tbl td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl .method-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
}
.tbl .method-badge.post { background: var(--accent); color: #0E0E0E; }
.tbl .method-badge.get  { background: #34D399; color: #0E0E0E; }
.tbl .method-badge.del  { background: #F87171; color: #0E0E0E; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.accent { background: var(--accent); color: #0E0E0E; }

/* ==========================================================================
   FOOTER (Technical Blueprint Footer)
   ========================================================================== */
footer {
  background: var(--surface);
  border-top: 1.5px solid var(--ink);
  padding: 60px 0 36px;
}
.foot-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 36px;
}
@media (max-width: 840px) {
  .foot-grid { grid-template-columns: 1fr 1fr; }
}
footer h4 {
  color: var(--dim);
  margin-bottom: 16px;
}
footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-soft);
}
footer li { margin-bottom: 10px; }
footer a:hover { color: var(--accent); }
.foot-bottom {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dim);
}

/* Reduced Motion fallback */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}