/* =========================================================================
   DMly Home — shared site stylesheet
   Design tokens + global reset + shared component styles (nav, mega-menu,
   footer, buttons). Page-specific rules stay inline in each page's <head>
   (kept verbatim from the prototype for pixel fidelity).
   ========================================================================= */

:root {
  /* Brand */
  --dmly-green:        #12715B;   /* primary */
  --dmly-green-hover:  #0F5E4B;   /* primary hover / link hover */
  --dmly-green-soft:   #8FE3C6;   /* accent mint */

  /* Ink & text */
  --dmly-ink:          #211E18;   /* headings / strong text */
  --dmly-text:         #5F5947;   /* body / nav links */
  --dmly-text-2:       #3A352B;   /* feature list text */
  --dmly-muted:        #7A7360;   /* secondary copy */
  --dmly-muted-2:      #8A8070;   /* captions */
  --dmly-mono-muted:   #A99E84;   /* mono eyebrow labels */
  --dmly-copyright:    #9A8E6E;

  /* Surfaces */
  --dmly-paper:        #FAF9F5;   /* page background */
  --dmly-paper-2:      #F6F3EC;   /* footer / soft panels */
  --dmly-paper-3:      #FBFAF6;   /* card washes */
  --dmly-dot:          #F2EEE6;   /* radial dot texture */

  /* Lines */
  --dmly-border:       #EFEAE1;
  --dmly-border-2:     #E7E1D4;
  --dmly-border-hover: #D8CBB2;

  /* Type */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-sans:  'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'Spline Sans Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* --------------------------------------------------------------- Reset --- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--dmly-paper);
  font-family: var(--font-sans);
  color: var(--dmly-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--dmly-green); text-decoration: none; }
a:hover { color: var(--dmly-green-hover); }

img { max-width: 100%; }

/* ---------------------------------------------------------- Page frame ---
   Box every page's content to match the Home layout: the paper root <div>
   (every page has one — it carries `min-height:100vh`) stays full-width so the
   dotted background bleeds edge-to-edge, while its top-level children (nav,
   sections, footer) are centred in a 1320px column. Home already wraps its
   content in a 1320px <section>; this brings the inner pages in line. */
body > div[style*="min-height:100vh"] > *,
.dmly-root > * {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------------------------------------------- Shared button hovers --- */
.btn-green { transition: background .18s ease; }
.btn-green:hover { background: var(--dmly-green-hover) !important; }

.btn-ghost { transition: border-color .18s ease, color .18s ease; }
.btn-ghost:hover { border-color: var(--dmly-border-hover) !important; color: var(--dmly-green) !important; }

/* ----------------------------------------------------- Footer links --- */
.foot-link { transition: color .15s ease; }
.foot-link:hover { color: var(--dmly-ink) !important; }
.foot-link-d:hover { color: #F3EFE6 !important; }

/* ------------------------------------------------ Accordion (FAQ) hooks --- */
[data-acc-body] {
  max-height: 0; opacity: 0; overflow: hidden; margin-top: 0;
  transition: max-height .3s ease, opacity .22s ease, margin-top .3s ease;
}
[data-acc-item].acc-open [data-acc-body] { max-height: var(--acc-max, 340px); opacity: 1; margin-top: 14px; }
[data-acc-chev] { transition: transform .22s ease; }
[data-acc-item].acc-open [data-acc-chev] { transform: rotate(180deg); }

/* --------------------------------------------- Billing toggle (Pricing) --- */
[data-bill] {
  font-size: 14px; font-weight: 600; color: var(--dmly-text);
  border-radius: 999px; padding: 9px 20px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; font-family: inherit;
}
[data-bill].bill-active { color: #fff; background: var(--dmly-green); }

/* ------------------------------------------- Filter buttons (Blog etc.) --- */
[data-filter-btn] { cursor: pointer; font-family: inherit; }

/* =======================================================================
   NAVIGATION  (shared partial: partials/nav.html)
   The <nav> container keeps the prototype's inline layout verbatim; these
   rules only add interaction hooks + a mobile fallback.
   ======================================================================= */
.navlink { transition: color .15s ease; }
.navlink:hover { color: var(--dmly-green) !important; }

/* Mega-menu.
   NOTE: do NOT set `position` on .megawrap globally. The Channels & Resources
   wraps carry inline `position:relative` (their panels anchor to the trigger via
   left:0 / right:0), while the Solutions wrap intentionally has NO positioning so
   its full-width panel (left:56px; right:56px) anchors to the <nav> instead.
   A global `.megawrap{position:relative}` breaks the Solutions dropdown. */
.megawrap:hover .mega-trigger { color: var(--dmly-green) !important; }
.mega-trigger { transition: color .15s ease; }

.megapanel { display: none; }
.megawrap.open > .megapanel { display: block; animation: mega-in .16s ease both; }

@keyframes mega-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.megarow { transition: background .12s ease; }
.megarow:hover { background: var(--dmly-paper-2) !important; }

/* Hamburger (mobile only) — not part of the desktop prototype, added so the
   preview is usable on narrow screens. In WordPress, Astra's header replaces
   this nav entirely. */
.nav-toggle { display: none; }

@media (max-width: 980px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border: 1px solid var(--dmly-border-2);
    border-radius: 10px; background: #fff; cursor: pointer; color: var(--dmly-ink);
  }
  .nav-links-wrap, .nav-actions {
    display: none !important;
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column !important; align-items: stretch !important; gap: 4px !important;
    background: #fff; border-bottom: 1px solid var(--dmly-border);
    padding: 14px 22px; box-shadow: 0 24px 48px -30px rgba(40,36,28,.4);
  }
  .site-nav.nav-open .nav-links-wrap { display: flex !important; z-index: 130; }
  .site-nav.nav-open .nav-actions   { display: flex !important; top: auto; box-shadow: none; border: 0; padding-top: 0; }
  .nav-links-wrap .navlink, .nav-links-wrap .mega-trigger { padding: 10px 4px; }
  /* On mobile, mega panels expand inline rather than as floating cards */
  .megawrap { align-self: stretch; }
  .megawrap.open > .megapanel {
    position: static !important; width: auto !important;
    margin-top: 6px !important; box-shadow: none !important;
    border-radius: 12px !important; animation: none;
  }
  /* Collapse the mega-menu's multi-column grids when it's inline on mobile */
  .megapanel [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* =======================================================================
   RESPONSIVE CONTENT LAYER
   The prototype is a desktop design built from inline styles, so these rules
   retrofit a mobile layout by matching the recurring inline-style patterns and
   overriding them (inline styles require !important). Two breakpoints:
   ≤900px (tablet: stack rows, 2-col grids, smaller type) and ≤560px (phone:
   single column). Keeps the desktop design pixel-exact above 900px.
   ======================================================================= */
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }

  /* Stack the two-column layout rows (hero, feature bands, footer, newsletter) */
  [style*="display:flex"][style*="gap:64px"],
  [style*="display:flex"][style*="gap:56px"],
  [style*="display:flex"][style*="gap:52px"],
  [style*="display:flex"][style*="gap:48px"],
  [style*="display:flex"][style*="gap:44px"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 34px !important;
  }

  /* Fixed-width media / mockup columns become full width */
  [style*="flex:0 0 512px"], [style*="flex:0 0 470px"], [style*="flex:0 0 460px"],
  [style*="flex:0 0 440px"], [style*="flex:0 0 420px"], [style*="flex:0 0 400px"],
  [style*="flex:0 0 380px"], [style*="flex:0 0 360px"], [style*="flex:0 0 340px"] {
    flex: 1 1 auto !important; width: 100% !important; max-width: 100% !important; min-width: 0 !important;
  }

  /* Grids: fewer columns */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(5,1fr)"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr 1fr !important;
  }
  [style*="grid-template-columns:repeat(7,1fr)"] { grid-template-columns: repeat(4, 1fr) !important; }

  /* Heading type scale */
  [style*="font-size:68px"] { font-size: 42px !important; }
  [style*="font-size:62px"] { font-size: 40px !important; }
  [style*="font-size:60px"] { font-size: 39px !important; }
  [style*="font-size:58px"] { font-size: 38px !important; }
  [style*="font-size:52px"] { font-size: 36px !important; }
  [style*="font-size:46px"] { font-size: 33px !important; }
  [style*="font-size:44px"] { font-size: 32px !important; }
  [style*="font-size:42px"] { font-size: 31px !important; }
  [style*="font-size:40px"] { font-size: 30px !important; }
  [style*="font-size:38px"] { font-size: 29px !important; }

  /* Side padding: inner pages use <section>; the Home page uses <div> bands (56px). */
  section { padding-left: 24px !important; padding-right: 24px !important; }
  [style*="padding:84px 56px"], [style*="padding:90px 56px"], [style*="padding:88px 56px"],
  [style*="padding:8px 56px"], [style*="padding:0 56px"], [style*="padding:20px 56px"],
  [style*="padding:72px 56px"] { padding-left: 24px !important; padding-right: 24px !important; }

  /* Big "CTA" boxes: trim oversized padding */
  [style*="padding:64px 48px"], [style*="padding:72px 56px"], [style*="padding:60px 48px"],
  [style*="padding:64px 40px"], [style*="padding:60px 40px"] {
    padding-left: 26px !important; padding-right: 26px !important;
    padding-top: 44px !important; padding-bottom: 44px !important;
  }

  /* Pricing comparison table: tighten row padding */
  [style*="padding:16px 22px"], [style*="padding:15px 22px"] {
    padding-left: 13px !important; padding-right: 13px !important;
  }
}

@media (max-width: 560px) {
  /* Single column for most grids (the pricing 2fr/1fr/1fr/1fr table is left intact) */
  [style*="grid-template-columns:repeat(3,1fr)"],
  [style*="grid-template-columns:repeat(2,1fr)"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr;"] {
    grid-template-columns: 1fr !important;
  }
  /* Dense icon/stat rows stay at 2–3 cols so they aren't absurdly tall */
  [style*="grid-template-columns:repeat(5,1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns:repeat(7,1fr)"] { grid-template-columns: repeat(3, 1fr) !important; }

  /* A card that spanned 2 columns can't span a now-single-column grid */
  [style*="grid-column:span 2"] { grid-column: auto !important; }

  /* Slightly smaller big headings on phones */
  [style*="font-size:68px"], [style*="font-size:62px"], [style*="font-size:60px"],
  [style*="font-size:58px"] { font-size: 33px !important; }

  /* Hero decorative clusters are absolutely-positioned at fixed sizes (Home,
     Platforms) — hide them on phones rather than let their children clip. */
  [style*="width:470px; position:relative; height:452px"],
  [style*="width:440px; position:relative; height:420px"] { display: none !important; }
}
