/* ==========================================================
   Simpson Accountants — one-page site
   Palette carries meaning: debit red = your load, credit green = ours.
   ========================================================== */

:root {
  --ink:        #16262A;   /* deep petrol slate — primary */
  --ink-soft:   #33474C;
  --muted:      #6B7B7E;
  --paper:      #F3F5F3;   /* cool off-white */
  --paper-warm: #E9EDEA;
  --rule:       #D3DAD6;
  --credit:     #2E7D63;   /* in the black */
  --debit:      #A8442F;   /* on your desk */
  --white:      #FFFFFF;

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body:    "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shell: 1180px;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --radius: 4px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 92px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.04; margin: 0; }
p { margin: 0 0 1.1em; }
ul { list-style: none; margin: 0; padding: 0; }

a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 0.5rem; top: -100px; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 0.7rem 1rem;
  border-radius: var(--radius); font: 500 0.85rem/1 var(--mono);
  transition: top 0.15s ease;
}
.skip:focus { top: 0.5rem; }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--credit);
  outline-offset: 3px;
  border-radius: 2px;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gut);
}

/* ---------- Eyebrow + section heads ---------- */

.eyebrow {
  font: 500 0.72rem/1.4 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.1rem;
}

.band-title {
  font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem);
  letter-spacing: -0.025em;
  max-width: 18ch;
}

.band-head { margin-bottom: clamp(2.5rem, 5vw, 4rem); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--body);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 0.7rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease,
              border-color 0.18s ease, transform 0.18s ease;
}
.btn:active { transform: translateY(1px); }

.btn-lg { padding: 0.95rem 1.6rem; font-size: 1rem; }

.btn-book {
  background: var(--credit);
  color: var(--white);
}
.btn-book:hover { background: #256953; }

.btn-invert {
  background: var(--paper);
  color: var(--ink);
}
.btn-invert:hover { background: var(--white); }

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-quiet:hover { border-color: var(--ink); background: rgba(22, 38, 42, 0.04); }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--credit);
}
.link-btn:hover { color: #7FC9AE; }

/* ---------- Masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(243, 245, 243, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 72px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  margin-right: auto;
}

.wordmark-mark { width: 30px; height: 30px; flex: none; }
.wordmark-mark rect:first-child { fill: var(--ink); }
.wordmark-mark .rule-a { fill: var(--paper); }
.wordmark-mark .rule-b { fill: var(--credit); }

.wordmark-text {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
  font-variation-settings: "wdth" 88;
}
.wordmark-text em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.35em;
}

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

.site-nav ul { display: flex; align-items: center; gap: 1.55rem; }

.masthead-cta { flex: none; }
.masthead-cta .cta-short { display: none; }

.site-nav a {
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-soft);
  padding-block: 0.35rem;
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--credit); }

.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  position: absolute;
  left: 50%;
  width: 17px; height: 1.8px;
  background: var(--ink);
  transform: translateX(-50%);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-bars { top: 50%; margin-top: -0.9px; }
.nav-toggle-bars::before { content: ""; top: -6px; }
.nav-toggle-bars::after  { content: ""; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateX(-50%) translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after  { transform: translateX(-50%) translateY(-6px) rotate(-45deg); }

/* ---------- Bands ---------- */

.band { padding-block: clamp(4rem, 8vw, 7rem); }

/* ---------- Hero ---------- */

.hero {
  padding-top: clamp(3rem, 6vw, 5.5rem);
  padding-bottom: clamp(4rem, 8vw, 7rem);
  background:
    linear-gradient(180deg, var(--paper-warm) 0%, var(--paper) 62%);
  border-bottom: 1px solid var(--rule);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}

.hero-title {
  font-size: clamp(2.35rem, 1.5rem + 3vw, 3.6rem);
  letter-spacing: -0.035em;
  font-variation-settings: "wdth" 90;
  margin-bottom: 1.5rem;
  max-width: 13ch;
  text-wrap: balance;
}
.hero-title-accent {
  display: block;
  color: var(--credit);
  font-weight: 400;
  font-variation-settings: "wdth" 100;
  margin-top: 0.14em;
}

.lede {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  color: var(--ink-soft);
  max-width: 46ch;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; }

.hero-note {
  margin: 1.15rem 0 0;
  font: 400 0.8rem/1.5 var(--mono);
  color: var(--muted);
}

/* ---------- Signature: the balancing ledger ---------- */

.ledger {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: clamp(1.4rem, 2.5vw, 2rem);
  box-shadow: 0 1px 0 rgba(22, 38, 42, 0.04),
              0 18px 40px -28px rgba(22, 38, 42, 0.45);
}

.ledger-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--ink);
}
.ledger-title {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.ledger-sub {
  margin: 0;
  font: 400 0.74rem/1.4 var(--mono);
  color: var(--muted);
}

.ledger-cols { display: block; }

.ledger-colhead,
.ledger-row,
.ledger-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.6rem 4.6rem;
  align-items: baseline;
  gap: 0.5rem;
}

.ledger-colhead {
  padding-block: 0.85rem 0.65rem;
  font: 500 0.66rem/1.3 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.ledger-colhead .col-task  { color: transparent; }
.ledger-colhead .col-debit  { color: var(--debit);  text-align: right; }
.ledger-colhead .col-credit { color: var(--credit); text-align: right; }

.ledger-row {
  padding-block: 0.68rem;
  border-top: 1px solid var(--rule);
}

.row-item { font-size: 0.93rem; color: var(--ink-soft); }
.row-debit,
.row-credit {
  font: 500 0.93rem/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.row-debit  { color: var(--debit); }
.row-credit { color: var(--credit); }

.ledger-total {
  margin-top: 0.3rem;
  padding-top: 0.9rem;
  border-top: 2px solid var(--ink);
}
.ledger-total .row-item { font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.ledger-total .row-debit,
.ledger-total .row-credit { font-size: 1.15rem; font-weight: 600; }

.ledger-foot {
  margin: 1.1rem 0 0;
  font: 500 0.8rem/1.5 var(--mono);
  color: var(--credit);
}
.ledger-foot span { margin-right: 0.4em; opacity: 0.6; }

/* entrance choreography */
.ledger-row,
.ledger-total,
.ledger-foot {
  opacity: 0;
  transform: translateY(8px);
}
.ledger.is-live .ledger-row {
  animation: settle 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  animation-delay: calc(0.09s * var(--i) + 0.12s);
}
.ledger.is-live .ledger-total {
  animation: settle 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) 0.66s forwards;
}
.ledger.is-live .ledger-foot {
  animation: settle 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) 1.35s forwards;
}

@keyframes settle {
  to { opacity: 1; transform: none; }
}

/* ---------- Why choose us ---------- */

.why { background: var(--paper); }

.reasons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}

.reason {
  background: var(--paper);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  transition: background-color 0.25s ease;
}
.reason:hover { background: var(--white); }

.reason-tag {
  font: 500 0.68rem/1.3 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--credit);
  margin: 0 0 0.9rem;
}

.reason-title {
  font-size: clamp(1.2rem, 1rem + 0.7vw, 1.5rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.6rem;
  max-width: 20ch;
}

.reason-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.97rem;
  max-width: 42ch;
}

/* ---------- About ---------- */

.about {
  background: var(--paper-warm);
  border-block: 1px solid var(--rule);
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
  gap: clamp(2.5rem, 5vw, 5rem);
  align-items: start;
}

.about-copy p {
  color: var(--ink-soft);
  max-width: 58ch;
}
.about-copy .band-title { margin-bottom: 1.4rem; }
.about-copy .btn { margin-top: 0.9rem; }

.about-facts {
  border-top: 2px solid var(--ink);
  padding-top: 1.1rem;
}
.about-facts dl { margin: 0; }
.about-facts div {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--rule);
}
.about-facts dt {
  font: 500 0.7rem/1.6 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.about-facts dd {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink);
}

/* ---------- Closing CTA ---------- */

.closer {
  background: var(--ink);
  color: var(--paper);
  text-align: center;
}

.closer-inner { max-width: 60ch; margin-inline: auto; }

.closer-title {
  font-size: clamp(1.7rem, 1.1rem + 2.6vw, 2.8rem);
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.closer-sub {
  color: #A9B8B6;
  margin-bottom: 2rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink);
  color: #C3CFCC;
  padding-block: clamp(3rem, 5vw, 4.5rem) 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  padding-bottom: 2.75rem;
}

.footer-brand p {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  max-width: 30ch;
  color: #8DA09C;
}
.footer-word { color: var(--paper); font-size: 1.12rem; }
.footer-word em { color: #8DA09C; }

.footer-col h3 {
  font: 500 0.68rem/1.3 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #7F938F;
  margin-bottom: 1rem;
}
.footer-col li { margin-bottom: 0.55rem; font-size: 0.9rem; }
.footer-col a {
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-col a:hover { color: var(--paper); }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.footer-base p {
  margin: 0;
  font: 400 0.74rem/1.6 var(--mono);
  color: #758884;
}

/* ==========================================================
   Calendly popup
   Calendly injects this overlay into our page, so its chrome —
   backdrop, card, close button, spinner — is ours to style.
   The booking form itself lives in a cross-origin iframe and is
   themed with the colour params in script.js instead.
   Loaded after widget.css, so equal-specificity overrides win.

   RULE: never set position/transform/top/left/width/height on
   .calendly-popup. Calendly centres that element with left:50% +
   translate(-50%,-50%), so overriding either one throws it off-centre.
   `display:flex` on it is safe — it lays out the children, not the box.
   ========================================================== */

html.is-booking,
html.is-booking body { overflow: hidden; }

body .calendly-overlay {
  background-color: rgba(13, 24, 27, 0.62);
  backdrop-filter: blur(4px);
  animation: sa-overlay-in 0.24s ease forwards;
}

body .calendly-overlay .calendly-popup {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(22, 38, 42, 0.6),
    0 40px 80px -30px rgba(0, 0, 0, 0.65);
}

/* The iframe gives up whatever height the header takes. Specificity has to
   clear Calendly's own `.calendly-overlay .calendly-popup .calendly-popup-content
   { height: 100% }` (0,3,0), hence the extra element selector → (0,3,1). */
body .calendly-overlay .calendly-popup .calendly-popup-content {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  background-color: var(--white);
}

/* Our own header band, injected by script.js above Calendly's iframe.
   Carries the ledger-green top edge that echoes the hero panel's rules. */
.calendly-overlay .sa-popup-head {
  flex: 0 0 auto;
  background: var(--ink);
  border-top: 3px solid var(--credit);
  padding: 1.05rem clamp(1.15rem, 4vw, 1.9rem);
  padding-right: 4.5rem; /* keep clear of the close chip */
}

.calendly-overlay .sa-popup-head .sa-popup-title {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.35rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.calendly-overlay .sa-popup-head .sa-popup-sub {
  margin: 0;
  font-family: var(--body);
  font-size: 0.875rem;
  line-height: 1.45;
  color: #A9B8B6;
  max-width: 62ch;
}

/* Close button: their 19px icon becomes a chip that reads as a control.
   Safe to resize — Calendly positions it from the overlay corner, not
   from the popup, so it carries no centring duty. */
body .calendly-overlay .calendly-popup-close {
  width: 40px;
  height: 40px;
  top: 20px;
  right: 20px;
  border-radius: 50%;
  background-color: rgba(243, 245, 243, 0.14);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F3F5F3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 17px 17px;
  border: 1px solid rgba(243, 245, 243, 0.28);
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
body .calendly-overlay .calendly-popup-close:hover {
  background-color: rgba(243, 245, 243, 0.26);
  border-color: rgba(243, 245, 243, 0.55);
}
body .calendly-overlay .calendly-popup-close:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

body .calendly-overlay .calendly-spinner > div { background-color: var(--credit); }

/* Fade only. A scale would mean rewriting the popup's transform, which is
   what holds it in the centre of the screen. */
@keyframes sa-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Below Calendly's own breakpoint the popup goes full-bleed white, so the
   close chip has to flip to dark-on-light or it vanishes into the card. */
@media (max-width: 975px) {
  body .calendly-overlay .calendly-popup { border-radius: 0; }

  body .calendly-overlay .calendly-popup-close {
    top: 14px;
    right: 14px;
    background-color: rgba(22, 38, 42, 0.06);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316262A' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
    border-color: rgba(22, 38, 42, 0.18);
  }
  body .calendly-overlay .calendly-popup-close:hover {
    background-color: rgba(22, 38, 42, 0.12);
    border-color: rgba(22, 38, 42, 0.4);
  }
  body .calendly-overlay .calendly-popup-close:focus-visible {
    outline-color: var(--ink);
  }
}

/* Docked state: script.js moves the close button into the popup so the X sits
   in the card's own top-right corner rather than stranded on the backdrop.
   It now lands on the ink header band, so it stays light-on-dark at every
   width. The extra class also buys the specificity to beat the rules above,
   so source order here doesn't matter. */
body .calendly-overlay .calendly-popup-close.sa-close-docked {
  top: 14px;
  right: 14px;
  z-index: 3;
  background-color: rgba(243, 245, 243, 0.12);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F3F5F3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  border-color: rgba(243, 245, 243, 0.3);
  box-shadow: none;
}
body .calendly-overlay .calendly-popup-close.sa-close-docked:hover {
  background-color: rgba(243, 245, 243, 0.24);
  border-color: rgba(243, 245, 243, 0.6);
}
body .calendly-overlay .calendly-popup-close.sa-close-docked:focus-visible {
  outline-color: var(--paper);
}

@media (prefers-reduced-motion: reduce) {
  body .calendly-overlay { animation: none; opacity: 1; }
}

/* ---------- Responsive ---------- */

@media (max-width: 940px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .masthead-inner { gap: 0.65rem; }
  .nav-toggle { display: block; }

  .site-nav {
    position: absolute;
    inset: 100% 0 auto;
    display: none;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 0.25rem var(--gut) 1.25rem;
    box-shadow: 0 18px 30px -24px rgba(22, 38, 42, 0.5);
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
  .site-nav li { border-bottom: 1px solid var(--rule); }
  .site-nav a { display: block; padding-block: 0.9rem; font-size: 1rem; }
  .site-nav a:hover { border-bottom-color: transparent; }

  .masthead-cta { padding: 0.62rem 0.95rem; font-size: 0.88rem; }
  .masthead-cta .cta-long { display: none; }
  .masthead-cta .cta-short { display: inline; }
}

@media (max-width: 700px) {
  .reasons { grid-template-columns: minmax(0, 1fr); }
  .ledger-colhead,
  .ledger-row,
  .ledger-total { grid-template-columns: minmax(0, 1fr) 3.6rem 3.6rem; }
  .hero-actions .btn { flex: 1 1 100%; }
}

@media (max-width: 378px) {
  .wordmark-text em { display: none; }
}

@media (max-width: 520px) {
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .about-facts div { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ledger-row,
  .ledger-total,
  .ledger-foot { opacity: 1; transform: none; }
  .ledger.is-live .ledger-row,
  .ledger.is-live .ledger-total,
  .ledger.is-live .ledger-foot { animation: none; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
