/* Maple Groove Financial — home-page styles
   Extracted from the reference mockup so CSP can drop unsafe-inline. */

:root {
  --bg: #000000;
  --ink: #ffffff;
  --ink-dim: #8a8a8a;
  --ink-faint: #3a3a3a;
  --rule: #1a1a1a;
  --rule-2: #262626;
  --accent: #d62828;       /* maple red */
  --accent-glow: #ff3a3a;
  --blue: #4ab8ff;
  --violet: #8a5cff;
  --green: #4ade80;        /* "open for business" status */
  --bar-h: 56px;
  --gutter: 28px;
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Mono', ui-monospace, monospace;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  position: relative;
}

/* ============ Subtle grid + grain texture ============ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 1;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.045 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  pointer-events: none;
  z-index: 2;
  opacity: 0.6;
  mix-blend-mode: overlay;
}

/* ============ Top bar (GitHub-style) ============ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--bar-h);
  background: #000;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
  z-index: 100;
  font-size: 13px;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-right: 24px;
  text-decoration: none;
}

.topbar__leaf {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(255, 58, 58, 0.4));
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1);
}
.topbar__brand:hover .topbar__leaf { transform: rotate(-12deg) scale(1.1); }

.topbar__name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.topbar__name span { color: var(--ink-dim); font-weight: 400; }

.topbar__sep {
  width: 1px; height: 22px; background: var(--rule-2); margin: 0 8px;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-item {
  position: relative;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-item:hover { background: var(--rule); }
.nav-item .caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid var(--ink-dim);
  margin-left: 2px;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.search {
  background: #0d0d0d;
  border: 1px solid var(--rule-2);
  border-radius: 6px;
  padding: 6px 12px;
  font-family: inherit;
  color: var(--ink-dim);
  font-size: 12px;
  width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search:hover { border-color: #3a3a3a; }
.search kbd {
  margin-left: auto;
  background: #1a1a1a;
  border: 1px solid var(--rule-2);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
}

.cta {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  padding: 7px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 0 0 0 var(--accent-glow);
}
.cta:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 20px rgba(255, 58, 58, 0.5);
}

/* ============ Main hero ============ */
main {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  padding-top: var(--bar-h);
  padding-bottom: calc(var(--bar-h) + 60px);
  display: flex;
  flex-direction: column;
}

/* corner labels — portfolio energy */
.corner {
  position: fixed;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  z-index: 50;
  pointer-events: none;
}
.corner--tl { top: calc(var(--bar-h) + 18px); left: var(--gutter); }
.corner--tr { top: calc(var(--bar-h) + 18px); right: var(--gutter); text-align: right; }
.corner--bl { bottom: calc(var(--bar-h) + 80px); left: var(--gutter); }
.corner--br { bottom: calc(var(--bar-h) + 80px); right: var(--gutter); text-align: right; }

.corner b { color: var(--ink-dim); display: block; font-weight: 400; }

/* Hero */
.hero {
  flex: 1;
  display: grid;
  place-items: center;
  position: relative;
  padding: 60px var(--gutter);
  text-align: center;
}

.hero__meta {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--green);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hero__meta::before, .hero__meta::after {
  content: '';
  width: 60px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--rule-2));
}
.hero__meta::after { background: linear-gradient(90deg, var(--rule-2), transparent); }
.hero__meta .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.hero__logo {
  width: min(56vw, 640px);
  filter: drop-shadow(0 0 80px rgba(214, 40, 40, 0.45)) drop-shadow(0 0 30px rgba(214, 40, 40, 0.25));
  animation: floatLogo 6s ease-in-out infinite, fadeUp 1.2s cubic-bezier(.2,.8,.2,1);
  user-select: none;
  -webkit-user-drag: none;
}
@keyframes floatLogo {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tagline cluster */
.hero__tag {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: 100%;
  padding: 0 var(--gutter);
}
.hero__kicker {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(20px, 2.6vw, 30px);
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  opacity: 0;
  animation: fadeUp 1.2s 0.4s cubic-bezier(.2,.8,.2,1) forwards;
}
.hero__kicker em {
  color: var(--accent);
  font-style: italic;
  text-shadow: 0 0 20px rgba(214, 40, 40, 0.5);
}
.hero__sub {
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--ink-dim);
  text-transform: uppercase;
  opacity: 0;
  animation: fadeUp 1.2s 0.6s cubic-bezier(.2,.8,.2,1) forwards;
}

/* Big background type — barely visible, portfolio touch */
.ghost-type {
  position: absolute;
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(120px, 22vw, 360px);
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.04);
  pointer-events: none;
  user-select: none;
  line-height: 0.8;
  letter-spacing: -0.02em;
  z-index: 0;
}
.ghost-type--top {
  top: 80px;
  left: -3vw;
}
.ghost-type--bot {
  bottom: 100px;
  right: -3vw;
}

/* Crosshair lines through center */
.crosshair {
  position: fixed;
  pointer-events: none;
  z-index: 3;
  background: linear-gradient(transparent, rgba(214,40,40,0.08), transparent);
}
.crosshair--v {
  top: var(--bar-h); bottom: var(--bar-h);
  left: 50%; width: 1px;
  transform: translateX(-50%);
}

/* ============ Bottom marquee bar ============ */
.bottombar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #000;
  border-top: 1px solid var(--rule);
  z-index: 100;
}

.marquee {
  overflow: hidden;
  height: 60px;
  display: flex;
  align-items: center;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
}

.marquee__track {
  display: flex;
  gap: 60px;
  animation: scroll 90s linear infinite;
  white-space: nowrap;
  padding-left: 60px;
}

@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.marquee__item {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--ink-dim);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 0.15em;
  transition: color 0.3s;
}
.marquee__item:hover { color: var(--ink); }
.marquee__item::after {
  content: '✦';
  color: var(--accent);
  font-size: 14px;
  margin-left: 60px;
}

/* status footer below marquee */
.statusbar {
  border-top: 1px solid var(--rule);
  padding: 8px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============ Dropdown ============ */
.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #0a0a0a;
  border: 1px solid var(--rule-2);
  border-radius: 8px;
  min-width: 280px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.18s ease;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.02);
}
.nav-item:hover .dropdown,
.nav-item:focus-within .dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.dropdown a {
  display: block;
  padding: 10px 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  letter-spacing: 0.02em;
}
.dropdown a small {
  display: block;
  color: var(--ink-dim);
  font-weight: 400;
  font-size: 11px;
  margin-top: 2px;
  letter-spacing: 0;
}
.dropdown a:hover { background: var(--rule); }
.dropdown a:hover small { color: var(--ink); }

/* Right-anchored variant (for nav items at the end of the bar so
   the menu doesn't run off the right edge of the viewport). */
.dropdown--right { left: auto; right: 0; }

/* Grouped variant — section headers separating clusters of links. */
.dropdown--grouped { min-width: 320px; }
.dropdown__group + .dropdown__group {
  border-top: 1px solid var(--rule);
  margin-top: 6px;
  padding-top: 6px;
}
.dropdown__group-label {
  padding: 6px 12px 4px;
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============ Mobile hamburger ============ */
/* Visually hidden checkbox; clicking the label toggles :checked. */
.topbar__toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
/* Hamburger button — desktop default is hidden; mobile media query
   reveals it. */
.topbar__hamburger {
  display: none;
}

/* Responsive */
@media (max-width: 980px) {
  .search, .topbar__nav .label-md { display: none; }
  .corner { display: none; }
}

@media (max-width: 768px) {
  /* Hide the inline nav, show the hamburger. */
  .topbar__hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 22px;
    height: 16px;
    cursor: pointer;
    margin-left: auto;       /* push to the right of the brand */
    margin-right: 12px;
    flex: 0 0 auto;
  }
  .topbar__hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
    transform-origin: 4px center;
  }
  /* Hamburger -> X when checkbox is checked. The :has() selector
     scopes the toggle's checked state to the topbar so we can style
     siblings in any order. */
  .topbar:has(.topbar__toggle:checked) .topbar__hamburger span:nth-child(1) {
    transform: rotate(45deg);
  }
  .topbar:has(.topbar__toggle:checked) .topbar__hamburger span:nth-child(2) {
    opacity: 0;
  }
  .topbar:has(.topbar__toggle:checked) .topbar__hamburger span:nth-child(3) {
    transform: rotate(-45deg);
  }

  /* Mobile nav as overlay below topbar; hidden by default.
     max-height + overflow-y so the menu scrolls within itself when
     it would otherwise overflow the viewport (e.g. expanded Links
     dropdown on a small phone with browser chrome eating real estate). */
  .topbar__nav {
    display: none;
    position: fixed;
    top: var(--bar-h);
    left: 0;
    right: 0;
    /* dvh = dynamic viewport height; on mobile this shrinks when the
       browser URL bar is visible, so the menu never extends below the
       actual visible area (vh would over-allocate). */
    max-height: calc(100dvh - var(--bar-h));
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    background: #000;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    padding: 6px var(--gutter) 10px;
    /* Above the .bottombar (z:100). */
    z-index: 105;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide the bottom marquee + statusbar entirely while the mobile
     menu is open — they were eating ~80px of viewport that the menu
     needed. The user can read the marquee after closing the menu. */
  body:has(.topbar__toggle:checked) .bottombar {
    display: none;
  }
  /* And reclaim the bottom padding main was reserving for it. */
  body:has(.topbar__toggle:checked) main {
    padding-bottom: 0;
  }
  .topbar:has(.topbar__toggle:checked) .topbar__nav {
    display: flex;
  }

  /* Mobile nav rows — full-width, dividers between, tap-friendly but
     compact enough for 5 items + expanded Links dropdown to fit on
     ~600px-tall viewports (phone w/ browser chrome). */
  .nav-item {
    padding: 11px 4px;
    font-size: 14px;
    border-bottom: 1px solid var(--rule);
    border-radius: 0;
    flex: 0 0 auto;
    align-items: flex-start;
  }
  .nav-item:last-child { border-bottom: none; }

  /* Dropdown — collapsible accordion on mobile. Hidden by default,
     expanded on tap (the parent .nav-item--end has tabindex="0", so
     tapping it gives focus and :focus-within shows the dropdown).
     Tap again outside to collapse. */
  .dropdown,
  .dropdown--right.dropdown--grouped {
    position: static;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transform: none;
    transition: max-height 0.22s ease, opacity 0.18s ease, margin-top 0.22s ease;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    min-width: auto;
    margin-top: 0;
    width: 100%;
  }
  .nav-item--end:focus-within .dropdown,
  .nav-item--end:hover .dropdown {
    opacity: 1;
    visibility: visible;
    max-height: 600px;
    margin-top: 8px;
  }
  .dropdown a { padding: 7px 4px 7px 14px; }
  .dropdown__group + .dropdown__group { margin-top: 6px; padding-top: 6px; }
  .dropdown__group-label { padding: 4px 12px 2px; }

  /* Caret rotates when the Links dropdown is open. */
  .nav-item--end .caret { transition: transform 0.22s ease; }
  .nav-item--end:focus-within .caret,
  .nav-item--end:hover .caret {
    transform: rotate(180deg);
  }

  /* Hide the brand "/ FINANCIAL" suffix at the tightest viewports
     to give the hamburger and CTA more breathing room. */
  .topbar__name span { display: none; }

  /* Outlined CTA on phone — solid red fill is too loud at this scale,
     stroke-only reads cleaner alongside the hamburger. Hover/tap
     swaps back to filled. */
  .cta {
    background: transparent;
    color: var(--accent-glow);
  }
  .cta:hover, .cta:active {
    background: var(--accent);
    color: white;
  }
}

@media (max-width: 680px) {
  .topbar__name { font-size: 14px; }
  .hero__logo { width: 78vw; }
  .ghost-type { display: none; }

  /* Hero meta: let the kicker wrap on narrow viewports. */
  .hero__meta {
    white-space: normal;
    font-size: 9px;
    letter-spacing: 0.2em;
    padding: 0 var(--gutter);
    width: 100%;
    text-align: center;
    justify-content: center;
  }
  .hero__meta::before, .hero__meta::after {
    width: 24px;
  }

  /* Status bar: stack the three regions vertically and tighten. */
  .statusbar {
    flex-direction: column;
    gap: 6px;
    padding: 10px var(--gutter);
    text-align: center;
  }

  /* Marquee: a touch smaller so the ✦ separators sit closer. */
  .marquee__item { font-size: 18px; }
  .marquee__track { gap: 36px; }
  .marquee__item::after { margin-left: 36px; }
}

/* ============ 404 page ============ */
.notfound {
  position: relative;
  z-index: 5;
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--gutter);
}
.notfound__code {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(120px, 22vw, 280px);
  line-height: 0.85;
  letter-spacing: -0.02em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.15);
}
.notfound__head {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 32px);
  margin-top: -0.3em;
}
.notfound__head em { color: var(--accent); font-style: italic; }
.notfound__sub {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--ink-dim);
  text-transform: uppercase;
}
.notfound__cta {
  display: inline-block;
  margin-top: 32px;
  padding: 9px 18px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 6px;
  transition: all 0.2s;
}
.notfound__cta:hover {
  background: var(--accent-glow);
  box-shadow: 0 0 20px rgba(255, 58, 58, 0.5);
}
