/* =========================================================
   VALYRA CONSULTING SERVICES — DESIGN SYSTEM
   Enabling Reliable Digital Transformation
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600&family=Nunito+Sans:ital,opsz,wght@0,6..12,300;0,6..12,400;0,6..12,500;0,6..12,600;0,6..12,700;1,6..12,300;1,6..12,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #0B1A2D;
  --ink-soft: #1B2B40;
  --ink-mute: #4A5568;
  --paper: #FAF7F0;
  --paper-warm: #F4EFE3;
  --paper-line: #E5DCC6;
  --accent: #C8553D;
  --accent-deep: #A03E2B;
  --accent-soft: #F2DDD6;
  --cobalt: #2447A8;
  --cobalt-soft: #DDE4F4;
  --gold: #B8924A;
  --green: #3D7A4F;
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-body: 'Nunito Sans', -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
  --max-w: 1280px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); background: var(--paper); color: var(--ink); line-height: 1.65; font-size: 16px; overflow-x: hidden; font-weight: 400; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; background-image: radial-gradient(circle at 20% 30%, rgba(11,26,45,0.018) 0%, transparent 40%), radial-gradient(circle at 80% 70%, rgba(200,85,61,0.022) 0%, transparent 40%); }
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* TYPOGRAPHY */
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.08; letter-spacing: -0.01em; }
.eyebrow { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent); font-weight: 500; display: inline-flex; align-items: center; gap: 0.6rem; }
.eyebrow::before { content: ""; width: 1.5rem; height: 1px; background: var(--accent); }
.display-1 { font-size: clamp(2rem, 4.5vw, 3.8rem); font-weight: 400; line-height: 1.08; letter-spacing: -0.015em; }
.display-1 em, .display-2 em, .display-3 em { font-style: italic; font-weight: 400; color: var(--accent); }
.display-2 { font-size: clamp(1.8rem, 3.8vw, 3.2rem); font-weight: 400; line-height: 1.08; letter-spacing: -0.01em; }
.display-3 { font-size: clamp(2rem, 3.8vw, 3.2rem); font-weight: 400; line-height: 1.1; }
.lead { font-size: clamp(0.92rem, 1.2vw, 1rem); line-height: 1.65; color: var(--ink-mute); max-width: 60ch; font-weight: 400; }

/* LAYOUT */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gutter); position: relative; z-index: 2; }
section { padding: clamp(4rem, 9vw, 8rem) 0; }
.rule { border-top: 1px solid var(--paper-line); }

/* NAV */
.nav { position: sticky; top: 0; z-index: 100; background: #FAF7F0; }
.nav-inner { max-width: var(--max-w); margin: 0 auto; padding: 0.3rem var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; flex-shrink: 0; }
@media (max-width: 540px) { .brand-logo { height: 38px; } }

/* Hero banner */
.hero { padding: 0 0 1.5rem; position: relative; }
.hero-banner-wrap { width: 100%; overflow: hidden; background: var(--paper); margin-top: 0; }
.hero-banner-img { width: 100%; height: auto; display: block; }

.nav { position: sticky; top: 0; z-index: 100; background: #0B1A2D; }
.nav-links { display: flex; gap: 1.4rem; align-items: center; list-style: none; flex-wrap: nowrap; }
.nav-links a { font-size: 0.97rem; font-weight: 600; position: relative; padding: 0.3rem 0; transition: color 0.2s var(--ease); white-space: nowrap; letter-spacing: 0.01em; color: rgba(250,247,240,0.85); }
.nav-links a:hover, .nav-links a.active { color: #fff; }
.nav-links a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1.5px; background: var(--accent); }
.nav-cta { background: var(--accent); color: #fff; padding: 0.6rem 1.2rem; border-radius: 100px; font-size: 0.92rem; font-weight: 600; transition: all 0.2s var(--ease); white-space: nowrap; flex-shrink: 0; }
.nav-cta:hover { background: #fff; color: var(--ink); transform: translateY(-1px); }
.brand-logo { height: 55px; width: auto; display: block; }

.nav-toggle { display: none; width: 36px; height: 36px; flex-direction: column; justify-content: center; align-items: center; gap: 5px; }
.nav-toggle span { width: 22px; height: 1.5px; background: #fff; transition: all 0.3s var(--ease); }
@media (max-width: 980px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle { display: flex; }
  body.menu-open .nav-links { display: flex; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: flex-start; background: var(--paper); padding: 2rem var(--gutter) 1rem; border-bottom: 1px solid var(--paper-line); gap: 1.25rem; }
  body.menu-open .nav-cta { display: inline-flex; position: absolute; top: 100%; left: var(--gutter); margin-top: 380px; }
}

/* HERO */

.hero-meta { display: flex; gap: 2rem; flex-wrap: wrap; font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-mute); margin-bottom: 2rem; }
.hero-meta span { display: inline-flex; gap: 0.5rem; align-items: center; }
.hero-meta span::before { content: ""; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.hero h1 { margin-bottom: 0.75rem; max-width: 22ch; }
.hero-foot { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2rem; align-items: end; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--paper-line); }
@media (max-width: 720px) { .hero-foot { grid-template-columns: 1fr; gap: 1.5rem; } }
.hero-cta-row { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.25rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.95rem 1.6rem; border-radius: 100px; font-weight: 500; font-size: 0.95rem; transition: all 0.25s var(--ease); border: 1px solid transparent; font-family: var(--font-body); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); transform: translateY(-2px); }

/* Accent words inside primary buttons — orange in the default state,
   flipping to cream on hover so they remain legible when the button
   background itself turns orange. Forced upright (not italic) since
   <em> defaults to italic in browsers. */
.btn-primary em { color: var(--accent); font-style: normal; }
.btn-primary:hover em { color: var(--paper); }
.btn-ghost { border-color: var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); transform: translateY(-2px); }
.btn-light { background: var(--paper); color: var(--ink); }
.btn-light:hover { background: var(--accent); color: var(--paper); transform: translateY(-2px); }
.btn-arrow { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.btn:hover .btn-arrow { transform: translateX(4px); }

/* MARQUEE */
.stack-strip { border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); padding: 2.5rem 0; overflow: hidden; }
.stack-strip-label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--ink-mute); margin-bottom: 1.5rem; padding: 0 var(--gutter); }
.marquee { display: flex; overflow: hidden; mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent); }
.marquee-track { display: flex; gap: 4rem; animation: marquee 40s linear infinite; flex-shrink: 0; padding-right: 4rem; align-items: center; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.marquee-item { display: flex; align-items: center; gap: 0.8rem; font-family: var(--font-display); font-size: 1.4rem; font-weight: 400; white-space: nowrap; }
.marquee-item .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

/* SECTION HEAD */
.section-head { display: grid; grid-template-columns: 1fr 1.5fr; gap: 3rem; margin-bottom: 4rem; align-items: end; }
@media (max-width: 800px) { .section-head { grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2.5rem; } }

/* SERVICES GRID */
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); border-top: 1px solid var(--paper-line); border-left: 1px solid var(--paper-line); }
.service-card { padding: 2.25rem 2rem 2rem; border-right: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); background: var(--paper); transition: background 0.3s var(--ease); position: relative; display: flex; flex-direction: column; gap: 1.1rem; min-height: 320px; }
.service-card:hover { background: var(--paper-warm); }
.service-card:hover .service-arrow { transform: translate(4px, -4px); color: var(--accent); }
.service-num { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; color: var(--ink-mute); }
.service-icon-wrap { display: flex; align-items: center; gap: 0.85rem; }
.service-icon { width: 44px; height: 44px; flex-shrink: 0; }
.service-card h3 { font-size: 1.75rem; line-height: 1.12; font-weight: 500; }
.service-card p { color: var(--ink-mute); font-size: 0.97rem; line-height: 1.65; }
.service-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; padding-top: 1rem; }
.service-tag { font-family: var(--font-mono); font-size: 0.7rem; padding: 0.3rem 0.6rem; border: 1px solid var(--paper-line); border-radius: 4px; color: var(--ink-mute); }
.service-arrow { position: absolute; top: 2rem; right: 2rem; width: 18px; height: 18px; color: var(--ink-mute); transition: all 0.25s var(--ease); }

/* STATS */
.stats { background: var(--ink); color: var(--paper); padding: clamp(4rem, 8vw, 6rem) 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 3rem 2rem; }
.stat { display: flex; flex-direction: column; gap: 0.6rem; }
.stat-num { font-family: var(--font-display); font-size: clamp(3rem, 5.5vw, 4.5rem); font-weight: 400; line-height: 1; letter-spacing: -0.01em; }
.stat-num em { font-style: italic; color: var(--accent); font-weight: 400; }
.stat-label { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(250,247,240,0.6); }

/* APPROACH */
.approach { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
@media (max-width: 880px) { .approach { grid-template-columns: 1fr; } }
.approach-list { list-style: none; counter-reset: step; }
.approach-step { display: grid; grid-template-columns: 60px 1fr; gap: 1.25rem; padding: 1.75rem 0; border-bottom: 1px solid var(--paper-line); counter-increment: step; }
.approach-step:first-child { padding-top: 0; }
.approach-step:last-child { border-bottom: none; }
.approach-step::before { content: counter(step, decimal-leading-zero); font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent); padding-top: 0.3rem; }
.approach-step h4 { font-size: 1.6rem; margin-bottom: 0.5rem; font-weight: 500; }
.approach-step p { color: var(--ink-mute); font-size: 0.97rem; line-height: 1.65; }

/* CTA BANNER */
.cta-banner { padding: clamp(4rem, 8vw, 7rem) 0; background: var(--paper-warm); border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); position: relative; overflow: hidden; }
.cta-banner-inner { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; align-items: center; }
@media (max-width: 800px) { .cta-banner-inner { grid-template-columns: 1fr; gap: 2rem; } }
.cta-banner h2 { max-width: 18ch; }

/* PAGE HEADER (subpages) */
.page-head { padding: clamp(3rem, 7vw, 6rem) 0 clamp(2rem, 4vw, 4rem); }
.page-head-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4rem; align-items: end; }
@media (max-width: 800px) { .page-head-grid { grid-template-columns: 1fr; gap: 1.5rem; } }
.crumbs { font-family: var(--font-mono); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-mute); margin-bottom: 1.5rem; }
.crumbs a:hover { color: var(--accent); }
.crumbs span { color: var(--accent); margin: 0 0.6rem; }

/* DETAIL CARDS */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 2px; background: var(--paper-line); border: 1px solid var(--paper-line); }
.detail-card { background: var(--paper); padding: 2.5rem 2.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.detail-card-head { display: flex; align-items: flex-start; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--paper-line); }
.detail-card-head .service-icon { width: 52px; height: 52px; }
.detail-card-head .head-text h3 { font-size: 1.7rem; font-weight: 500; line-height: 1.12; }
.detail-card-head .head-text p { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute); margin-top: 4px; }
.detail-card ul { list-style: none; }
.detail-card li { padding: 0.6rem 0; padding-left: 1.5rem; position: relative; color: var(--ink-soft); font-size: 0.97rem; border-bottom: 1px dashed var(--paper-line); line-height: 1.55; }
.detail-card li:last-child { border-bottom: none; }
.detail-card li::before { content: "→"; position: absolute; left: 0; color: var(--accent); font-weight: 500; }

/* CAPABILITY ROWS */
.cap-row { display: grid; grid-template-columns: 200px 1fr; gap: 3rem; padding: 2.5rem 0; border-bottom: 1px solid var(--paper-line); align-items: start; }
@media (max-width: 800px) { .cap-row { grid-template-columns: 1fr; gap: 1rem; } }
.cap-row:last-child { border-bottom: none; }
.cap-num { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.18em; color: var(--accent); text-transform: uppercase; }
.cap-row h3 { font-size: 2rem; margin-bottom: 1rem; font-weight: 500; letter-spacing: -0.01em; }
.cap-row p { color: var(--ink-mute); margin-bottom: 1.25rem; max-width: 65ch; line-height: 1.65; }
.cap-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cap-pill { font-family: var(--font-mono); font-size: 0.72rem; padding: 0.35rem 0.75rem; background: var(--paper-warm); border: 1px solid var(--paper-line); border-radius: 4px; color: var(--ink-soft); }

/* FAQ */
.faq-list { border-top: 1px solid var(--paper-line); }
.faq-item { border-bottom: 1px solid var(--paper-line); }
.faq-q { width: 100%; padding: 1.5rem 0; text-align: left; display: flex; justify-content: space-between; align-items: center; gap: 2rem; font-family: var(--font-display); font-size: 1.45rem; font-weight: 500; color: var(--ink); line-height: 1.2; }
.faq-q .plus { width: 18px; height: 18px; flex-shrink: 0; position: relative; transition: transform 0.3s var(--ease); }
.faq-q .plus::before, .faq-q .plus::after { content: ""; position: absolute; background: var(--ink); }
.faq-q .plus::before { left: 0; right: 0; top: 50%; height: 1.5px; transform: translateY(-50%); }
.faq-q .plus::after { top: 0; bottom: 0; left: 50%; width: 1.5px; transform: translateX(-50%); transition: transform 0.3s var(--ease); }
.faq-item.open .faq-q .plus::after { transform: translateX(-50%) scaleY(0); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.4s var(--ease); }
.faq-a-inner { padding: 0 0 1.75rem 0; color: var(--ink-mute); max-width: 70ch; }
.faq-item.open .faq-a { max-height: 600px; }

/* CONTACT FORM */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2.5rem, 5vw, 5rem); align-items: start; }
@media (max-width: 800px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-info { display: flex; flex-direction: column; gap: 2rem; }
.contact-info-block h4 { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; color: var(--accent); margin-bottom: 0.5rem; }
.contact-info-block p { font-size: 1.05rem; color: var(--ink); }
.contact-info-block a:hover { color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
.form-field { display: flex; flex-direction: column; gap: 0.4rem; }
.form-field label { font-family: var(--font-mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ink-mute); }
.form-field input, .form-field select, .form-field textarea { font: inherit; font-size: 1rem; padding: 0.85rem 1rem; background: var(--paper); border: 1px solid var(--paper-line); border-radius: 6px; color: var(--ink); transition: border-color 0.2s var(--ease); font-family: var(--font-body); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--accent); }
.form-field textarea { resize: vertical; min-height: 140px; }

/* TESTIMONIAL */
.testimonial { padding: clamp(4rem, 8vw, 6rem) 0; }
.testimonial blockquote { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.75rem, 3.5vw, 2.75rem); line-height: 1.2; letter-spacing: -0.01em; max-width: 24ch; margin-bottom: 2rem; }
.testimonial blockquote em { font-style: italic; color: var(--accent); }
.testimonial-cite { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-mute); }

/* TWO-COL */
.two-col { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.two-col h2 { margin-bottom: 1.25rem; }

/* FEATURE LIST */
.feat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--paper-line); border-left: 1px solid var(--paper-line); }
@media (max-width: 700px) { .feat-list { grid-template-columns: 1fr; } }
.feat { padding: 2rem; border-right: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); }
.feat-num { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.16em; color: var(--accent); margin-bottom: 1rem; display: block; }
.feat h4 { font-size: 1.45rem; font-weight: 500; margin-bottom: 0.5rem; }
.feat p { color: var(--ink-mute); font-size: 0.97rem; line-height: 1.65; }

/* FOOTER */
footer { background: var(--ink); color: var(--paper); padding: clamp(4rem, 8vw, 6rem) 0 2rem; position: relative; z-index: 2; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 3rem; margin-bottom: 4rem; }
@media (max-width: 800px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 2.5rem; } }
@media (max-width: 500px) { .foot-grid { grid-template-columns: 1fr; } }
.foot-brand { max-width: 32ch; }
.foot-brand-logo { height: 56px; width: auto; display: block; margin-bottom: 1.25rem; }
.foot-brand p.tag { font-family: var(--font-display); font-style: italic; font-size: 1.15rem; color: var(--accent); margin-bottom: 1.5rem; font-weight: 400; }
.foot-brand p { color: rgba(250,247,240,0.65); font-size: 0.92rem; line-height: 1.55; }
.foot-col h5 { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.18em; color: rgba(250,247,240,0.5); margin-bottom: 1rem; font-weight: 500; }
.foot-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.foot-col a { font-size: 0.92rem; color: rgba(250,247,240,0.85); transition: color 0.2s var(--ease); }
.foot-col a:hover { color: var(--accent); }
.foot-bottom { display: flex; justify-content: space-between; align-items: center; padding-top: 2rem; border-top: 1px solid rgba(250,247,240,0.1); flex-wrap: wrap; gap: 1rem; }
.foot-bottom p, .foot-bottom a { font-family: var(--font-mono); font-size: 0.72rem; color: rgba(250,247,240,0.5); }
.foot-bottom-links { display: flex; gap: 1.5rem; }

/* REVEAL */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-stagger > * { opacity: 0; transform: translateY(20px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.05s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.12s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.19s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.26s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.33s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.40s; }
.reveal-stagger.visible > *:nth-child(7) { transition-delay: 0.47s; }
.reveal-stagger.visible > *:nth-child(8) { transition-delay: 0.54s; }
.reveal-stagger.visible > * { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   DROPDOWN MEGA-MENU
   ============================================================ */

.main-nav { display: flex; align-items: center; }

.nav-links li { position: relative; }

/* Top-level link arrow chevron */
.nav-chevron { font-size: 0.9rem; margin-left: 0.3rem; display: inline-block; transition: transform 0.25s var(--ease); vertical-align: middle; }
/* Only rotate on true hover (mouse), not on touch where :hover sticks after tap */
@media (hover: hover) {
  .has-dropdown:hover .nav-chevron { transform: rotate(180deg); }
}

/* Base dropdown panel */
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(11,26,45,0.18);
  border: 1px solid var(--paper-line);
  padding: 1.25rem 0;
  min-width: 220px;
  z-index: 200;
  animation: dropFade 0.2s var(--ease);
}

@keyframes dropFade {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Only show on true hover (mouse) — prevents sticky :hover on touch devices
   from showing the desktop dropdown after the accordion closes on mobile */
@media (hover: hover) {
  .has-dropdown:hover .dropdown { display: flex; }
}

/* Invisible hover bridge: fills the gap between the menu item and the
   dropdown panel so the cursor never leaves the :hover chain when moving
   down into a sub-item. Without this, the dropdown closes mid-traverse. */
.dropdown::before {
  content: '';
  position: absolute;
  top: -14px;          /* slightly more than the 10px gap, for safety */
  left: 0;
  right: 0;
  height: 14px;
  background: transparent;
}

/* Simple dropdown list */
.dropdown > ul { list-style: none; display: flex; flex-direction: column; padding: 0 0.5rem; width: 100%; }
.dropdown > ul li a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.dropdown > ul li a:hover { background: var(--paper-warm); color: var(--accent); }

/* Mega dropdown */
.mega-dropdown {
  left: 50%;
  transform: translateX(-50%);
  min-width: 860px;
  padding: 2rem;
  flex-direction: row;
  gap: 0;
  top: calc(100% + 10px);
}

/* Keep mega visible on hover without transform flicker — mouse only */
@media (hover: hover) {
  .has-dropdown:hover .mega-dropdown { display: flex; transform: translateX(-50%); }
}

.mega-col {
  flex: 1;
  padding: 0 1.25rem;
  border-right: 1px solid var(--paper-line);
}
.mega-col:last-child { border-right: none; }

.mega-heading {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--paper-line);
}

.mega-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.1rem; }
.mega-col ul li a {
  display: block;
  padding: 0.45rem 0.6rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.mega-col ul li a:hover { background: var(--paper-warm); color: var(--accent); }

/* Mobile: hide dropdowns, show as flat list */
@media (max-width: 980px) {

  /* --- Mobile menu panel --- */
  body.menu-open .nav-links {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: flex-start;
    background: #0B1A2D; padding: 1.5rem var(--gutter) 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.1); gap: 0;
    max-height: 80vh; overflow-y: auto;
  }
  body.menu-open .nav-links li { width: 100%; border-bottom: 1px solid rgba(255,255,255,0.06); }
  body.menu-open .nav-links li:last-child { border-bottom: none; }

  /* Top-level links */
  body.menu-open .nav-links > li > a {
    color: rgba(250,247,240,0.9);
    padding: 0.85rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1rem;
    font-weight: 500;
  }

  /* Chevron visible on mobile as accordion indicator */
  body.menu-open .nav-chevron {
    display: inline-block;
    font-size: 1rem;
    transition: transform 0.25s ease;
    transform: rotate(0deg); /* explicitly reset — overrides any sticky :hover */
  }
  body.menu-open .has-dropdown.mobile-open > a .nav-chevron {
    transform: rotate(180deg); /* rotate when accordion is open */
  }

  /* Hide dropdowns by default on mobile */
  .dropdown, .mega-dropdown {
    display: none;
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    padding: 0 0 0.5rem 1rem;
    background: transparent;
    width: 100%;
    min-width: 0;
  }

  /* Show accordion when .mobile-open is set */
  .has-dropdown.mobile-open > .dropdown,
  .has-dropdown.mobile-open > .mega-dropdown {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    width: 100% !important;
    position: static !important;
    transform: none !important;
    left: auto !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 0 0.75rem 0.75rem !important;
    gap: 0 !important;
  }

  /* Stack every mega-col as a full-width block */
  .has-dropdown.mobile-open .mega-col {
    flex: none !important;
    width: 100% !important;
    padding: 0 !important;
    border-right: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .has-dropdown.mobile-open .mega-col:last-child { border-bottom: none; }

  /* Sub-item links */
  .dropdown ul li a,
  .mega-dropdown ul li a {
    color: rgba(250,247,240,0.7);
    padding: 0.45rem 0;
    font-size: 0.9rem;
    display: block;
  }
  .dropdown ul li a:hover,
  .mega-dropdown ul li a:hover {
    color: var(--accent);
    background: transparent;
  }

  /* Mega headings on mobile */
  .mega-heading {
    color: rgba(250,247,240,0.4);
    margin-top: 0.75rem;
    margin-bottom: 0.35rem;
    font-size: 0.7rem;
  }

  /* Simple dropdown list */
  .dropdown > ul { padding: 0; }

}
