/* ============================================
   PROJECTpro — Shared Styles
   ============================================ */

:root {
  --bg: #0a0e14;
  --bg-2: #0f141c;
  --ink: #e8e4d8;
  --ink-dim: #8a8678;
  --ink-faint: #4a4940;
  --accent: #ff7a3d;
  --accent-glow: rgba(255, 122, 61, 0.4);
  --grid: rgba(232, 228, 216, 0.04);
  --rule: rgba(232, 228, 216, 0.08);
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Fraunces', Georgia, serif;
  font-feature-settings: "ss01", "ss02";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

/* Background grid + grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(ellipse at 20% 0%, rgba(255, 122, 61, 0.08), transparent 50%),
                    radial-gradient(ellipse at 80% 100%, rgba(80, 130, 200, 0.06), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Layout shell */
.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 48px;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Top bar / Navigation
   ============================================ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rule);
  animation: fadeIn 1s ease 0.2s both;
}

.topbar .left {
  display: flex;
  gap: 14px;
  align-items: center;
}

.topbar .brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.2s ease;
}
.topbar .brand-link:hover { opacity: 0.85; }
.topbar .brand-link:hover .topbar-logo { transform: rotate(-3deg) scale(1.05); }

.topbar .topbar-logo {
  width: 28px;
  height: 28px;
  display: block;
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 12px rgba(255, 122, 61, 0.18));
  animation: logoBreath 4s ease-in-out infinite;
}

@keyframes logoBreath {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 122, 61, 0.15)); }
  50% { filter: drop-shadow(0 0 16px rgba(255, 122, 61, 0.30)); }
}

.topbar .brand {
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0.12em;
}

.topbar nav {
  display: flex;
  gap: 28px;
  align-items: center;
}

.topbar nav a {
  color: var(--ink-dim);
  position: relative;
  padding: 4px 0;
  transition: color 0.2s ease;
}
.topbar nav a:hover,
.topbar nav a.active { color: var(--ink); }
.topbar nav a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ============================================
   Footer
   ============================================ */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 24px;
  margin-top: auto;
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
  animation: fadeIn 1s ease 1.4s both;
}
.footer .copyright { color: var(--ink-dim); }
.footer .right { display: flex; gap: 20px; align-items: center; }
.footer .ip-notice { color: var(--accent); }

/* ============================================
   Common page elements
   ============================================ */
.page-header {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--rule);
  animation: slideUp 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both;
}

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.eyebrow::before {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: var(--accent);
}

.page-title {
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}
.page-title em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

.page-lede {
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.5;
  color: var(--ink);
  max-width: 680px;
}

.section {
  padding: 64px 0;
  border-bottom: 1px solid var(--rule);
}
.section:last-of-type { border-bottom: none; }

.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  margin-bottom: 32px;
}

.prose {
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  max-width: 680px;
}
.prose p { margin-bottom: 20px; }
.prose p:last-child { margin-bottom: 0; }
.prose em { color: var(--accent); font-style: italic; }
.prose strong { font-weight: 600; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.25s ease;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(4px);
}
.btn.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn.primary:hover {
  background: transparent;
  color: var(--accent);
  transform: translateX(4px);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  padding: 32px 0 0;
  transition: all 0.2s ease;
}
.back-link:hover { color: var(--accent); transform: translateX(-4px); }

/* ============================================
   Animations
   ============================================ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================
   Mascot
   ============================================ */
#mascot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px) scale(0.9);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  filter: drop-shadow(0 4px 20px rgba(255, 122, 61, 0.25));
}
#mascot.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
#mascot:hover {
  transform: translateY(-4px) scale(1.05);
}
#mascot canvas {
  display: block;
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#mascot-bubble {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  max-width: 240px;
  white-space: normal;
  width: max-content;
}
#mascot-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  right: 24px;
  border: 6px solid transparent;
  border-top-color: var(--bg-2);
}
#mascot-bubble.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 900px) {
  .shell { padding: 20px 24px; }
  .topbar { font-size: 10px; gap: 12px; }
  .topbar nav { gap: 18px; }
  .footer { flex-direction: column; gap: 12px; align-items: flex-start; }
  .footer .right { flex-wrap: wrap; }
  #mascot canvas { width: 72px; height: 72px; }
}

@media (max-width: 540px) {
  .shell { padding: 16px 20px; }
  .topbar .topbar-logo { width: 24px; height: 24px; }
  /* On mobile: hide horizontal nav, hamburger becomes primary nav */
  .topbar nav { display: none; }
  .topbar .menu-toggle { display: inline-flex; }
}

/* ============================================
   Side navigation drawer
   ============================================ */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 8px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  cursor: pointer;
  padding: 0;
  border-radius: 2px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.menu-toggle .icon-line {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  margin: 2px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Show menu toggle on desktop too — power-user navigation */
@media (min-width: 541px) {
  .menu-toggle { display: inline-flex; }
}

/* Drawer */
#sitemap-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 300px;
  max-width: 85vw;
  background: linear-gradient(180deg, #0d1218 0%, #060a10 100%);
  border-right: 1px solid var(--rule);
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.5);
}
#sitemap-drawer.open { transform: translateX(0); }

#sitemap-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
#sitemap-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

#sitemap-drawer .drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--rule);
}
#sitemap-drawer .drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#sitemap-drawer .drawer-brand img { width: 22px; height: 22px; }
#sitemap-drawer .drawer-close {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: all 0.2s ease;
}
#sitemap-drawer .drawer-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#sitemap-drawer .drawer-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
  padding: 24px 24px 8px;
}

#sitemap-drawer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
#sitemap-drawer .nav-section {
  padding: 0 12px 8px;
}
#sitemap-drawer .nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 2px;
  transition: background 0.2s ease, color 0.2s ease, padding 0.2s ease;
}
#sitemap-drawer .nav-link:hover {
  background: rgba(255, 122, 61, 0.06);
  color: var(--accent);
  padding-left: 18px;
}
#sitemap-drawer .nav-link.active {
  color: var(--accent);
  background: rgba(255, 122, 61, 0.08);
}
#sitemap-drawer .nav-link.active::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--accent);
  margin-right: 10px;
  margin-left: -13px;
}
#sitemap-drawer .nav-link .arrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-faint);
  transition: transform 0.25s ease, color 0.25s ease;
}
#sitemap-drawer .nav-link:hover .arrow,
#sitemap-drawer .nav-link.expanded .arrow {
  color: var(--accent);
  transform: rotate(90deg);
}

#sitemap-drawer .sub-nav {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  padding-left: 14px;
  border-left: 1px solid var(--rule);
  margin-left: 22px;
}
#sitemap-drawer .sub-nav.expanded {
  max-height: 440px;
}
#sitemap-drawer .sub-link {
  display: block;
  padding: 8px 14px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 13px;
  font-family: 'Fraunces', serif;
  font-weight: 400;
  border-radius: 2px;
  transition: color 0.2s ease, padding 0.2s ease;
}
#sitemap-drawer .sub-link:hover {
  color: var(--accent);
  padding-left: 18px;
}
#sitemap-drawer .sub-link.active {
  color: var(--accent);
}

#sitemap-drawer .drawer-foot {
  margin-top: auto;
  padding: 24px;
  border-top: 1px solid var(--rule);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}
#sitemap-drawer .drawer-foot .accent {
  color: var(--accent);
  margin-top: 6px;
  display: block;
}
