/* =========================================================
   Essex Psychological Services
   Shared stylesheet
   Palette: warm cream + grounded sage, clay accent
   Type: Fraunces (display) + Hanken Grotesk (body)
   ========================================================= */

:root {
  --bg:        #FBF7F1;
  --surface:   #FFFFFF;
  --surface-2: #F4EDE2;
  --ink:       #2B2823;
  --ink-soft:  #5C564C;
  --line:      #E6DDCF;
  --primary:   #4F6F5E;
  --primary-d: #3C5749;
  --accent:    #B26C4A;
  --footer-bg: #2E3A33;
  --footer-fg: #E9E2D5;

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  --wrap: 1120px;
  --measure: 68ch;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -24px rgba(43, 40, 35, 0.45);
  --shadow-sm: 0 8px 22px -16px rgba(43, 40, 35, 0.5);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--primary-d); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 460;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.35rem); font-weight: 480; }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.25rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1.1em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- accessibility ---------- */
.skip {
  position: absolute; left: -999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-body); font-weight: 600; font-size: 1rem;
  padding: .85rem 1.5rem; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .15s ease, background .2s ease, color .2s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); color: #fff; transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--primary-d); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.btn-light { background: var(--footer-fg); color: var(--footer-bg); }
.btn-light:hover { background: #fff; color: var(--footer-bg); transform: translateY(-2px); }

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(251, 247, 241, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; flex-direction: column; line-height: 1.05; text-decoration: none; }
.brand-name { font-family: var(--font-display); font-weight: 520; font-size: 1.18rem; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: .15rem; }
.brand:hover .brand-name { color: var(--primary-d); }

.primary-nav { display: flex; align-items: center; gap: 1.4rem; }
.primary-nav a { text-decoration: none; color: var(--ink); font-weight: 500; font-size: .98rem; }
.primary-nav a:hover { color: var(--primary-d); }
.primary-nav a[aria-current="page"] { color: var(--primary-d); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.nav-cta { background: var(--primary); color: #fff !important; padding: .5rem 1.05rem; border-radius: 999px; }
.nav-cta:hover { background: var(--primary-d); }

.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: .4rem; }
.nav-toggle span { display: block; width: 25px; height: 2px; background: var(--ink); margin: 5px 0; transition: .25s; }

@media (max-width: 940px) {
  .nav-toggle { display: block; }
  .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: .5rem 1.5rem 1.2rem; box-shadow: var(--shadow-sm);
    display: none;
  }
  .primary-nav.open { display: flex; }
  .primary-nav a { padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .primary-nav a[aria-current="page"] { border-bottom: 1px solid var(--line); }
  .nav-cta { text-align: center; margin-top: .8rem; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ---------- sections / layout ---------- */
section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-tight { padding: clamp(2rem, 4vw, 3rem) 0; }
.lead { font-size: 1.2rem; color: var(--ink-soft); }
.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--ink); }
.eyebrow {
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin: 0 0 .9rem;
}
.muted { color: var(--ink-soft); }
.center { text-align: center; }
.alt-bg { background: var(--surface-2); }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 7vw, 6rem) 0 clamp(2.5rem, 5vw, 4rem); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 55% at 85% 8%, rgba(79,111,94,.14), transparent 70%),
    radial-gradient(50% 45% at 8% 92%, rgba(178,108,74,.10), transparent 70%);
}
.hero .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero .lead { max-width: 46ch; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.hero-portrait {
  aspect-ratio: 4/5; border-radius: var(--radius); background: var(--surface-2);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--ink-soft); padding: 1.5rem; position: relative; overflow: hidden;
}
.hero-portrait span { font-size: .82rem; letter-spacing: .06em; }
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { max-width: 340px; order: -1; }
}

/* staggered entrance */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); animation: rise .7s ease forwards; }
  .reveal-1 { animation-delay: .05s; }
  .reveal-2 { animation-delay: .18s; }
  .reveal-3 { animation-delay: .31s; }
  .reveal-4 { animation-delay: .44s; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}

/* ---------- trust strip ---------- */
.trust {
  display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem;
  padding: 1.1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-top: 2.5rem;
}
.trust .badge {
  display: inline-flex; align-items: center; gap: .55rem;
  font-size: .9rem; color: var(--ink-soft);
}
.trust .chip {
  font-weight: 700; color: var(--primary-d);
  border: 1px dashed var(--primary); border-radius: 7px; padding: .25rem .55rem; font-size: .8rem;
  letter-spacing: .03em;
}
.trust .reg { margin-left: auto; font-size: .85rem; color: var(--ink-soft); }

/* ---------- card grids ---------- */
.grid { display: grid; gap: 1.5rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.7rem; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .2s ease; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p { color: var(--ink-soft); margin-bottom: 1.1em; }
.card .card-link { margin-top: auto; font-weight: 600; text-decoration: none; }
.card .card-link::after { content: " \2192"; }

/* numbered marker for service cards */
.card .num {
  font-family: var(--font-display); font-size: 1rem; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; width: 2rem; height: 2rem;
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 1rem;
}

/* ---------- generic page header ---------- */
.page-head { padding: clamp(2.8rem, 6vw, 4.5rem) 0 clamp(1.5rem, 3vw, 2.5rem); }
.page-head .wrap { max-width: 820px; }
.page-head h1 { margin-bottom: .3em; }
.locations { font-size: .98rem; color: var(--ink-soft); margin-top: .6em; }
.locations strong { color: var(--ink); font-weight: 600; }

/* ---------- prose helpers ---------- */
.prose h2 { margin-top: 2.2rem; }
.prose h3 { margin-top: 1.6rem; }
.list-clean { list-style: none; padding: 0; margin: 0 0 1.3em; }
.list-clean li { position: relative; padding-left: 1.5rem; margin-bottom: .7rem; }
.list-clean li::before {
  content: ""; position: absolute; left: 0; top: .62em; width: .5rem; height: .5rem;
  background: var(--primary); border-radius: 50%;
}
.lead-list li b, .lead-list li strong { color: var(--ink); }

/* ---------- CTA band ---------- */
.cta-band { background: var(--surface-2); border-top: 1px solid var(--line); }
.cta-band .wrap { text-align: center; max-width: 760px; }
.cta-band h2 { margin-bottom: .4em; }
.cta-band p { color: var(--ink-soft); margin-bottom: 1.5rem; }

/* ---------- fees ---------- */
.fee-rows { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); margin: 1.5rem 0; }
.fee-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.fee-row:last-child { border-bottom: 0; }
.fee-row .label { font-weight: 600; }
.fee-row .price { font-family: var(--font-display); font-size: 1.35rem; color: var(--primary-d); white-space: nowrap; }
.note-box { background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 1rem 1.2rem; color: var(--ink-soft); font-size: .95rem; }

/* ---------- publications ---------- */
.refs { list-style: none; counter-reset: ref; padding: 0; margin: 1.2rem 0; }
.refs li { counter-increment: ref; position: relative; padding-left: 2.4rem; margin-bottom: 1.1rem; color: var(--ink); }
.refs li::before {
  content: counter(ref); position: absolute; left: 0; top: 0;
  font-family: var(--font-display); color: var(--accent); font-size: .95rem; font-weight: 600;
  border: 1px solid var(--line); border-radius: 7px; width: 1.7rem; height: 1.7rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.refs a { word-break: break-word; }

/* ---------- team ---------- */
.team-card { display: grid; grid-template-columns: 150px 1fr; gap: 1.6rem; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow-sm); }
.team-photo { aspect-ratio: 1; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; text-align: center; color: var(--ink-soft); font-size: .75rem; padding: .6rem; }
@media (max-width: 620px) { .team-card { grid-template-columns: 1fr; } .team-photo { max-width: 150px; } }

/* ---------- placeholder note (visible to site owner) ---------- */
.placeholder {
  background: #FCEFE6; border: 1px dashed var(--accent); color: #7a3f23;
  border-radius: var(--radius-sm); padding: .8rem 1rem; font-size: .9rem; margin: 1rem 0;
}
.placeholder code { background: rgba(0,0,0,.06); padding: .1rem .35rem; border-radius: 4px; }

/* ---------- policies ---------- */
.policy h2 { display: flex; gap: .7rem; align-items: baseline; margin-top: 2.6rem; }
.policy h2 .pn { font-size: 1rem; color: var(--accent); font-family: var(--font-body); font-weight: 700; }
.policy .crisis-list { font-weight: 500; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.5rem; margin: 1.5rem 0 2rem; }
.toc ol { margin: .4rem 0 0; padding-left: 1.2rem; columns: 2; }
.toc li { margin-bottom: .3rem; }
.toc a { text-decoration: none; }
@media (max-width: 620px) { .toc ol { columns: 1; } }

/* ---------- footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-fg); margin-top: 0; }
.site-footer a { color: var(--footer-fg); }
.site-footer a:hover { color: #fff; }
.crisis {
  background: rgba(255,255,255,.06); border-bottom: 1px solid rgba(255,255,255,.12);
  font-size: .95rem; padding: 1rem 0;
}
.crisis .wrap { display: block; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; padding: 3rem 0 1.5rem; }
.footer-brand { font-family: var(--font-display); font-size: 1.15rem; color: #fff; margin-bottom: .5rem; }
.site-footer p { margin: 0 0 .5rem; font-size: .92rem; color: var(--footer-fg); opacity: .92; }
.footer-nav { display: flex; flex-direction: column; gap: .5rem; }
.footer-nav a { text-decoration: none; font-size: .95rem; }
.footer-creds .logo-placeholders { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: .8rem; }
.logo-box {
  border: 1px dashed rgba(255,255,255,.4); border-radius: 8px; padding: .5rem .7rem;
  font-size: .72rem; line-height: 1.2; text-align: center; color: var(--footer-fg); min-width: 86px;
}
.logo-box b { display: block; font-size: .8rem; }
.footer-creds .reg { font-size: .82rem; opacity: .85; }
.copyright { border-top: 1px solid rgba(255,255,255,.12); padding: 1.2rem 0; font-size: .85rem; opacity: .8; margin: 0; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 1.6rem; } }

/* =========================================================
   Additions: dropdown nav, credential logos, photos
   ========================================================= */

/* ---- dropdown in primary nav ---- */
.has-dropdown { position: relative; display: inline-flex; align-items: center; }
.nav-parent { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; color: var(--ink); font-weight: 500; font-size: .98rem; }
.nav-parent:hover { color: var(--primary-d); }
.nav-parent.current { color: var(--primary-d); border-bottom: 2px solid var(--accent); padding-bottom: 2px; }
.caret { width: .42em; height: .42em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -.18em; transition: transform .2s ease; }
.dropdown { list-style: none; margin: 0; padding: 0; }

@media (min-width: 941px) {
  .dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 256px;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow-sm); padding: .4rem; z-index: 120;
    display: none;
  }
  .has-dropdown:hover .dropdown,
  .has-dropdown:focus-within .dropdown { display: block; }
  .has-dropdown:hover .caret,
  .has-dropdown:focus-within .caret { transform: rotate(225deg); margin-top: .12em; }
  .dropdown a { display: block; padding: .6rem .75rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; white-space: nowrap; }
  .dropdown a:hover { background: var(--surface-2); color: var(--primary-d); }
  .dropdown a[aria-current="page"] { color: var(--primary-d); font-weight: 600; }
}

@media (max-width: 940px) {
  .has-dropdown { display: block; }
  .nav-parent { display: block; padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .caret { display: none; }
  .dropdown { padding: 0 0 .5rem .9rem; }
  .dropdown a { display: block; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .95rem; color: var(--ink); text-decoration: none; }
  .dropdown a[aria-current="page"] { color: var(--primary-d); font-weight: 600; }
}

/* ---- footer credential logos ---- */
.footer-creds .logo-placeholders { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.cred-logo { background: #fff; border-radius: 9px; padding: .5rem; height: 66px; width: auto; display: block; box-shadow: 0 4px 14px -8px rgba(0,0,0,.5); }

/* ---- hero portrait photo ---- */
.hero-portrait { padding: 0; }
.hero-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; border-radius: var(--radius); }

/* ---- team card photo ---- */
.team-photo { padding: 0; overflow: hidden; }
.team-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }

/* =========================================================
   V2: FAQ, about-photo, service banners
   ========================================================= */

/* ---- FAQ page ---- */
.faq-list { max-width: var(--measure); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary {
  font-family: var(--font-display); font-weight: 460; font-size: 1.12rem;
  padding: 1.1rem 0; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  color: var(--ink);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: "+"; font-size: 1.3rem; color: var(--primary); flex-shrink: 0;
  font-weight: 600; transition: transform .2s;
}
.faq-list details[open] summary::after { content: "\2212"; }
.faq-list details[open] summary { color: var(--primary-d); }
.faq-list .answer { padding: 0 0 1.3rem; color: var(--ink); }
.faq-list .answer p { margin-bottom: .7em; }

/* ---- about inline photo ---- */
.about-photo {
  float: right; margin: 0 0 1.2rem 1.8rem; width: 210px;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.about-photo img { width: 100%; height: auto; display: block; }
@media (max-width: 620px) {
  .about-photo { float: none; margin: 0 auto 1.5rem; width: 180px; }
}

/* ---- service page banner ---- */
.page-banner {
  aspect-ratio: 21/7; background: var(--surface-2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: .82rem; overflow: hidden; position: relative;
}
.page-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* =========================================================
   V3: Logo in header/footer, trust strip Option C,
       page banner images
   ========================================================= */

/* ---- header logo ---- */
.brand { display: flex; align-items: center; text-decoration: none; }
.brand-logo { height: 56px; width: auto; display: block; }

/* ---- footer logo ---- */
.footer-logo { height: 52px; width: auto; display: block; margin-bottom: .7rem; }

/* ---- trust strip Option C: single unified line ---- */
.trust .trust-line {
  font-size: .92rem; color: var(--ink-soft); font-weight: 500;
}
.trust .chip { display: none; }
.trust .badge { display: none; }

/* ---- page banner: images fill properly ---- */
.page-banner img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}

/* =========================================================
   V4: Hero logo, dropdown hover fix, header text brand restored
   ========================================================= */

/* ---- header: restore text brand ---- */
.brand { display: flex; flex-direction: column; line-height: 1.05; text-decoration: none; }
.brand-name { font-family: var(--font-display); font-weight: 520; font-size: 1.18rem; color: var(--ink); letter-spacing: -0.01em; }
.brand-sub { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-top: .15rem; }
.brand:hover .brand-name { color: var(--primary-d); }

/* ---- hero logo: full logo prominent in hero ---- */
.hero-logo {
  margin-bottom: 1.4rem;
}
.hero-logo img {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
}

/* ---- footer logo: snipped icon only ---- */
.footer-logo {
  height: 44px;
  width: auto;
  display: block;
  margin-bottom: .8rem;
}

/* ---- dropdown hover: fix gap so cursor can travel down without dismissal ---- */
.has-dropdown {
  position: relative;
}
/* Invisible bridge between trigger and dropdown panel */
.has-dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 12px; /* matches or exceeds any gap */
  background: transparent;
}
.has-dropdown .dropdown {
  /* short delay before hiding so cursor can reach the panel */
  transition: opacity .15s ease, visibility .15s ease;
}
.has-dropdown:not(:hover) .dropdown {
  transition-delay: 0.08s;
}
