/* ════════════════════════════════════════════════════════════════
   WRENBI homepage — component styles
   ----------------------------------------------------------------
   Layout, chrome, and the reveal/motion grammar for the firm site.
   Shared design tokens + @font-face live in tokens.css (linked first);
   this file consumes them. The :root below holds only HOMEPAGE-SPECIFIC
   tuning knobs (hero-meta optics, the word-cloud, the motion curve) —
   deliberately NOT in the canonical token layer the blog imports.
   ════════════════════════════════════════════════════════════════ */

  :root {
    /* ── Hero meta — individual optical controls (tweak these) ── */
    --meta-gap: 10px;           /* space BETWEEN the three columns */
    --meta-col-1: 11rem;        /* width of col 1 — Based in */
    --meta-col-2: 14rem;        /* width of col 2 — Standards */
    --meta-col-3: 14rem;        /* width of col 3 — Contact */
    --meta-pad-top: 24px;       /* gap below the hairline, above the row */
    --meta-label-gap: 4px;      /* gap between a label and its value */
    --meta-value-size: 13px;    /* value text size */
    --meta-label-size: 12px;    /* label text size */
    --meta-label-track: 0.08em; /* label letter-spacing */

    /* ── Word-cloud animation ── */
    --cloud-stroke: #C2BEB7;        /* ghost outline colour (light, soft) */
    --cloud-accent: var(--accent);  /* every Nth word picks this up */

    /* ── Work list spacing (tweak these two) ── */
    --list-edge-space: 24px;   /* breathing room above first item & below last item (pushes the dark rules away) */
    --work-bottom-pad: 48px;   /* gap between the list's bottom rule and the About section */

    /* ── Motion tokens (one curve, reused everywhere) ──
       TUNE FEEL HERE. Two main knobs:
         --dur-reveal : how long each element takes to fade + rise in.
         --stagger    : the gap between consecutive items in a group.
       Bigger = slower / more relaxed. Smaller = quicker / tighter.
       Per-element delays are all calc(var(--stagger) * N), so changing
       --stagger rescales the whole choreography at once. */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dur-reveal: 1100ms;  /* entrance & scroll reveal duration */
    --stagger: 150ms;      /* gap between staggered items */
    --rise: 16px;          /* fade-up travel distance */
    --dur-micro: 240ms;    /* nav underline wipe */
  }

  *, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
  html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
  body { font-family: var(--font); background: var(--white); color: var(--black); line-height: 1.6; }

  .page { max-width: calc(var(--page-max) + var(--page-pad) * 2); margin: 0 auto; padding: 0 var(--page-pad); }

  /* ── NAV ── */
  .nav {
    position: sticky; top: 0; z-index: 50;
    background: rgba(245, 242, 238, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--grey-200);
  }
  .nav-inner {
    max-width: calc(var(--page-max) + var(--page-pad) * 2);
    margin: 0 auto; padding: 18px var(--page-pad);
    display: flex; align-items: baseline; justify-content: space-between;
  }
  .wordmark { font-size: 18px; font-weight: 900; letter-spacing: -0.04em; }
  .wordmark .dot { color: var(--accent); }
  .nav-links { display: flex; gap: 32px; }
  .nav-links a {
    font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--grey-500); text-decoration: none; transition: color 0.15s ease;
  }
  .nav-links a:hover { color: var(--black); }
  @media (max-width: 640px) { .nav-links { gap: 18px; } .nav-links a { font-size: 11px; } }

  /* ── HERO ── */
  .hero {
    min-height: calc(100vh - 61px);
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 80px 0;
    border-bottom: 2px solid var(--black);
  }
  .eyebrow {
    font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--grey-500); margin-bottom: var(--s-lg);
  }
  .eyebrow .sep { color: var(--grey-300); margin: 0 8px; }
  /* Tighten the eyebrow on very narrow screens so the separators don't overflow (≤320px). */
  @media (max-width: 380px) { .eyebrow { letter-spacing: 0.1em; } .eyebrow .sep { margin: 0 5px; } }
  .hero h1 {
    font-size: clamp(44px, 6.2vw, 84px);
    font-weight: 900; line-height: 1.0; letter-spacing: -0.045em;
    max-width: 24ch; margin-bottom: var(--s-xl);
  }
  /* Controlled rag: each phrase is its own line → "Assurance / for regulated /
     financial services." On very narrow screens a phrase may wrap within itself
     (graceful), but the phrase grouping holds the shape everywhere else. */
  .hero h1 .ph { display: block; }
  /* Hero "services." — V3 "Lift" gradient: lighter top, slightly deeper base.
     Subtle depth, not a visible gradient. Stops are hand-derived from --accent;
     if --accent ever changes, RECOMPUTE these two (see handoff). text-fill
     fallback keeps the word visible if background-clip:text is unsupported. */
  .hero h1 .accent {
    color: var(--accent);   /* fallback */
    background-image: linear-gradient(180deg, #EF5C50 0%, #E0382A 100%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .hero-sub {
    font-size: clamp(17px, 1.8vw, 21px); line-height: 1.55; color: var(--grey-700);
    max-width: var(--measure-lede); font-weight: 400;
  }
  .hero-meta {
    width: 100%; margin-top: 0; padding-top: var(--meta-pad-top);
    border-top: 1px solid var(--grey-200);
    display: flex; gap: var(--meta-gap); flex-wrap: wrap;
    font-size: var(--meta-value-size); color: var(--grey-500);
  }
  .hero-meta span { flex: 0 0 var(--meta-col-1); }            /* col 1 */
  .hero-meta span:nth-child(2) { flex-basis: var(--meta-col-2); }  /* col 2 */
  .hero-meta span:nth-child(3) { flex-basis: var(--meta-col-3); }  /* col 3 */
  .hero-meta .more { color: #6B6B6B; }     /* dimmed but AA-passing on paper (was --grey-300 #B5B1AB, ~1.9:1 — failed) */
  .hero-meta span strong { color: var(--black); font-weight: 700; display: block; font-size: var(--meta-label-size); letter-spacing: var(--meta-label-track); text-transform: uppercase; margin-bottom: var(--meta-label-gap); }

  /* ── WORD-CLOUD (behind hero copy) ── */
  .hero { position: relative; isolation: isolate; }
  /* keep the actual copy above the animation */
  .hero > .eyebrow,
  .hero > h1,
  .hero > .hero-sub { position: relative; z-index: 1; }

  .hero__cloud {
    position: absolute; inset: 0; z-index: 0;
    overflow: hidden; pointer-events: none;

    /* Feathered ellipse that protects the copy. Tune these four to move/resize
       the protected zone; --m-protect is the inner opacity (0 = fully hidden
       behind the text, ~0.12 = a faint hint bleeds through). */
    --m-cx: 26%;  --m-cy: 50%;   /* ellipse centre, over the headline block */
    --m-rx: 40%;  --m-ry: 50%;   /* ellipse radii */
    --m-protect: 0.06;           /* inner opacity inside the protected zone */
    --m-inner: 28%;              /* solid-protection radius before feathering */
    --m-outer: 80%;              /* where the feather reaches full visibility */

    -webkit-mask-image: radial-gradient(ellipse var(--m-rx) var(--m-ry) at var(--m-cx) var(--m-cy),
      rgba(0,0,0,var(--m-protect)) 0%, rgba(0,0,0,var(--m-protect)) var(--m-inner), rgba(0,0,0,1) var(--m-outer));
            mask-image: radial-gradient(ellipse var(--m-rx) var(--m-ry) at var(--m-cx) var(--m-cy),
      rgba(0,0,0,var(--m-protect)) 0%, rgba(0,0,0,var(--m-protect)) var(--m-inner), rgba(0,0,0,1) var(--m-outer));
  }
  .hero__cloud .term {
    position: absolute; opacity: 0;
    will-change: opacity, transform;
  }
  .hero__cloud .term svg { display: block; overflow: visible; }
  .hero__cloud .term svg path {
    fill: none;
    stroke: var(--cloud-stroke);
    stroke-linejoin: round; stroke-linecap: round;
    vector-effect: non-scaling-stroke;   /* stroke stays ~constant as words scale */
  }
  .hero__cloud .term.is-accent svg path { stroke: var(--cloud-accent); }
  /* On small screens the copy stacks toward the top-left and fills more width,
     so widen the protected ellipse and lift it slightly. */
  @media (max-width: 700px) {
    .hero__cloud { --m-cx: 50%; --m-cy: 44%; --m-rx: 66%; --m-ry: 42%; --m-protect: 0.04; }
  }

  /* ── SECTION ── */
  .section { padding: 96px 0; }
  .section--work { padding-bottom: 0; }   /* heavy #about rule now terminates the list at list-frame spacing */
  /* heavier rules BETWEEN major sections; hero keeps its light header rule */
  #about, #contact { border-top: 2px solid var(--black); }
  .section-label {
    font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--accent-text); margin-bottom: var(--s-lg);
  }
  .section h2 {
    font-size: clamp(30px, 4vw, 48px); font-weight: 900; line-height: 1.1; letter-spacing: -0.03em;
    max-width: 20ch; margin-bottom: var(--s-xl);
  }
  .section h2 .accent { color: var(--accent); }
  .lede { font-size: clamp(17px, 1.8vw, 20px); line-height: 1.6; color: var(--grey-700); max-width: var(--measure-lede); }

  /* practice areas — quiet list, hairline rules */
  .practice { margin-top: 64px; border-top: 1px solid var(--black); }
  .practice-row {
    display: grid; grid-template-columns: 84px 1fr 2fr; gap: 32px;
    padding: 32px 0; border-bottom: 1px solid var(--grey-200); align-items: center;
  }
  .practice-row:first-child { padding-top: calc(32px + var(--list-edge-space)); }
  .practice-row:last-child { border-bottom: none; padding-bottom: calc(32px + var(--list-edge-space)); }
  .practice-row .pr-num { font-size: 48px; font-weight: 900; letter-spacing: -0.04em; color: var(--black); line-height: 1; font-variant-numeric: tabular-nums; }
  .practice-row h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
  .practice-row p { font-size: 15px; color: var(--grey-700); line-height: 1.6; max-width: var(--measure-body); }
  @media (max-width: 700px) {
    .practice-row { grid-template-columns: 1fr; gap: 8px; }
    .practice-row .pr-num { font-size: 38px; }
  }

  /* about */
  .about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; margin-top: 56px; }
  .about-block {                              /* CB — accent left-bar, now a completed frame */
    padding: 26px 28px 28px 24px;
    border: 1px solid var(--black);
    border-left: 3px solid var(--accent);
  }
  .about-block h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--grey-500); margin-bottom: 16px; }
  .about-block p { font-size: 16px; line-height: 1.7; color: var(--grey-700); max-width: var(--measure-body); }
  .about-block p + p { margin-top: 1em; }
  .about-block .name { color: var(--black); font-weight: 700; }
  @media (max-width: 760px) { .about-grid { grid-template-columns: 1fr; gap: 40px; } }

  /* contact */
  .contact { padding: var(--s-5xl) 0; text-align: left; }
  .contact .section-label { color: var(--accent-text); }
  .contact h2 { font-size: clamp(32px, 5vw, 56px); font-weight: 900; letter-spacing: -0.04em; line-height: 1.0; margin-bottom: 32px; }
  .contact a.email {
    font-size: clamp(22px, 3vw, 32px); font-weight: 700; color: var(--black); text-decoration: none;
    border-bottom: 2px solid var(--accent); padding-bottom: 4px; letter-spacing: -0.02em;
    transition: color 0.15s ease;
  }
  .contact a.email:hover { color: var(--accent); }
  .contact .note { font-size: 16px; color: var(--grey-500); margin-top: 28px; }

  /* footer — full-bleed black cap, light text */
  .footer { background: var(--black); color: var(--white); }
  .footer-inner {
    max-width: calc(var(--page-max) + var(--page-pad) * 2);
    margin: 0 auto; padding: 0 var(--page-pad);
  }
  .footer-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: var(--s-2xl); flex-wrap: wrap; padding-top: var(--s-4xl); padding-bottom: var(--s-2xl);
  }
  .footer .wordmark { color: var(--white); font-size: 22px; }
  .footer .wordmark .dot { color: var(--accent); }
  .footer-nav { display: flex; gap: var(--s-xl); flex-wrap: wrap; }
  .footer-nav a {
    font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: rgba(245, 242, 238, 0.6); text-decoration: none; transition: color 0.15s ease;
  }
  .footer-nav a:hover { color: var(--white); }
  .footer-base {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s-md);
    padding-top: var(--s-lg); padding-bottom: var(--s-4xl);
    border-top: 1px solid rgba(245, 242, 238, 0.12);
  }
  .footer-base p { font-size: 12px; color: rgba(245, 242, 238, 0.62); letter-spacing: 0.04em; }   /* 0.45 -> 0.62 for AA on black */

  /* ════════════════════════════════════════════════════════════════
     MOTION — one reveal grammar, one curve. Vermillion as punctuation.
     Fail-safe: hidden states apply ONLY under .js-reveal (added by JS),
     so with no JS / a script error, all content shows at full state.
     ════════════════════════════════════════════════════════════════ */

  /* Reveal grammar: fade + small rise, fired once on enter. */
  .js-reveal .reveal {
    opacity: 0;
    transform: translateY(var(--rise));
    transition: opacity var(--dur-reveal) var(--ease),
                transform var(--dur-reveal) var(--ease);
    transition-delay: var(--d, 0ms);   /* per-element stagger via inline --d */
    will-change: opacity, transform;
  }
  .js-reveal .reveal.is-in { opacity: 1; transform: none; }

  /* Nav link — vermillion underline wipes in from the left. */
  .nav-links a, .footer-nav a { position: relative; }
  .nav-links a::after, .footer-nav a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
    background: var(--accent); transform: scaleX(0); transform-origin: left;
    transition: transform var(--dur-micro) var(--ease);
  }
  .nav-links a:hover::after, .footer-nav a:hover::after { transform: scaleX(1); }

  /* Wordmark dot — a single, unhurried pulse on load, then it behaves.
     --dot-pulse-dur / --dot-pulse-delay let you tune the timing. */
  :root { --dot-pulse-dur: 1100ms; --dot-pulse-delay: 500ms; }
  @keyframes dot-pulse {
    0% { transform: scale(1); } 40% { transform: scale(1.5); } 100% { transform: scale(1); }
  }
  .nav .wordmark .dot { display: inline-block; transform-origin: center 80%; animation: dot-pulse var(--dot-pulse-dur) var(--ease) var(--dot-pulse-delay) 1 both; }

  /* ── A11Y — skip link, keyboard focus, sticky-nav anchor offset ── */
  .skip-link {
    position: absolute; left: 8px; top: -52px; z-index: 100;
    background: var(--black); color: var(--white);
    padding: 10px 16px; font-size: 14px; font-weight: 700; border-radius: 2px;
    text-decoration: none; transition: top var(--dur-micro) var(--ease);
  }
  .skip-link:focus { top: 8px; }
  /* Visible focus ring for keyboard users on every interactive element. */
  a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
  .nav-links a:focus-visible::after, .footer-nav a:focus-visible::after { transform: scaleX(1); }
  main:focus { outline: none; }
  /* Keep anchored section headings clear of the sticky nav (~61px tall). */
  #work, #about, #contact { scroll-margin-top: 76px; }

  /* Reduced motion: show everything at rest, no transitions or pulses. */
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }   /* honour reduced-motion for anchor navigation too */
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js-reveal .reveal { opacity: 1 !important; transform: none !important; }
  }
