/* ============================================================================
   Matterly — marketing site.

   Deliberately NOT the default SaaS arrangement. Each section commits to one
   idea rather than reaching for the nearest pattern:

     hero     photograph, full-bleed, panel notched into the empty corner
     proof    one typographic statement, not a row of stat boxes
     docket   the product's core act, full width, on its own dark field
     index    a numbered schedule of contents, not a grid of icon cards
     fees     a scale of fees in rows, not three cards with a ringed middle
     close    photograph again

   Legibility carried over from the previous build: body 17/1.7 at ~10:1,
   nothing under 12px, no light weights for prose, no grey-on-grey.
   ========================================================================= */

/* ---------- tokens ------------------------------------------------------- */

:root {
  --paper:   #fffefc;
  --surface: #f6f4f0;
  --surface-2: #edeae4;

  --ink:   #17150f;
  --ink-2: #423e37;
  --ink-3: #6b665e;

  --line:   rgba(23, 21, 15, .14);
  --line-2: rgba(23, 21, 15, .24);

  --teal:     #14586a;
  --teal-700: #0e4150;
  --teal-300: #7fb3c2;
  --teal-50:  #eef5f7;
  --on-teal:  #ffffff;

  --copper: #96522f;

  --night:   #10161a;   /* the dark field — fixed, never token-flipped */
  --night-2: #182126;
  --on-night: #f2efe9;

  --sans:  "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", ui-serif, Georgia, "Times New Roman", serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --page: 1240px;
  --gutter: clamp(18px, 4vw, 44px);
  --inset: clamp(10px, 1.4vw, 20px);   /* the margin the hero image sits in */
  --r: 10px;
  --r-lg: 22px;

  --ease: cubic-bezier(.2, .75, .3, 1);
}

/* ---------- reset -------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  background: var(--paper); color: var(--ink-2);
  font-family: var(--sans); font-size: 17px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none; overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button { background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--teal-50); color: var(--ink); }

h1, h2, h3, h4 { color: var(--ink); font-weight: 600; }
.wrap { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }

/* Display type — a grotesk, set very tight and heavy, like the reference.
   The serif is reserved for the statement band and the fee scale. */
.dsp {
  font-weight: 600; letter-spacing: -.035em; line-height: .98;
  color: var(--ink); text-wrap: balance;
}
.lede { font-size: clamp(1.05rem, 1.2vw, 1.18rem); line-height: 1.65; color: var(--ink-2); text-wrap: pretty; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Arrow link — the reference's CTA treatment, used instead of a button pair. */
.alink {
  display: inline-flex; align-items: center; gap: .6em;
  font-size: clamp(1.02rem, 1.15vw, 1.18rem); font-weight: 600; color: var(--ink);
  padding-block: 4px;
}
.alink svg { transition: transform .25s var(--ease); flex: none; }
.alink:hover svg { transform: translateX(6px); }
.alink--light { color: var(--on-night); }
.alink--teal { color: var(--teal); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  height: 46px; padding-inline: 22px; border-radius: 999px;
  font-size: .97rem; font-weight: 600; white-space: nowrap;
  background: var(--ink); color: var(--paper);
  transition: background .18s var(--ease), transform .18s var(--ease);
}
.btn:hover { background: var(--teal); transform: translateY(-1px); }
.btn--onphoto { background: var(--paper); color: var(--ink); }
.btn--onphoto:hover { background: var(--teal); color: #fff; }

/* ---------- nav ---------------------------------------------------------- */

.skip { position: fixed; top: 8px; left: 8px; z-index: 200; background: var(--ink); color: var(--paper);
        padding: 10px 16px; border-radius: 8px; font-weight: 600; transform: translateY(-200%); }
.skip:focus { transform: none; }

.nav {
  position: fixed; z-index: 80;
  top: var(--inset); left: var(--inset); right: var(--inset);
  height: 76px; display: flex; align-items: center; gap: 16px;
  padding-inline: clamp(16px, 2.4vw, 34px);
  color: var(--on-night);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  transition: background .3s var(--ease), color .3s var(--ease), height .3s var(--ease),
              backdrop-filter .3s var(--ease), border-color .3s var(--ease);
  border-bottom: 1px solid transparent;
}
.nav.solid {
  top: 0; left: 0; right: 0; height: 64px; border-radius: 0;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--line);
}
.nav__brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.16rem; font-weight: 700; letter-spacing: -.03em; }
.nav__links { display: flex; align-items: center; gap: clamp(14px, 2vw, 30px); margin-left: clamp(18px, 3vw, 44px); }
.nav__links a { font-size: .98rem; font-weight: 500; opacity: .92; }
.nav__links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 5px; }
.nav__sp { flex: 1; }
.nav .btn { height: 42px; }
.nav__burger { display: none; }

.drawer {
  position: fixed; inset: 0; z-index: 90; background: var(--paper);
  padding: 22px var(--gutter); display: none; flex-direction: column; gap: 2px; overflow-y: auto;
}
.drawer[data-open="true"] { display: flex; }
.drawer__top { display: flex; align-items: center; height: 56px; margin-bottom: 12px; }
.drawer a.dl { padding: 15px 2px; border-bottom: 1px solid var(--line); font-size: 1.3rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }

/* ---------- 1. hero ------------------------------------------------------ */

.hero { padding: var(--inset); }
.hero__frame {
  position: relative; overflow: hidden;
  /* Bottom-left is SQUARE: the white panel sits in that corner, and matching two
     rounded curves pixel-for-pixel is fragile — a square corner under a square
     panel corner cannot leak. It is invisible anyway: white panel, white page. */
  border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 0;
  min-height: min(86vh, 780px);
  background: var(--ink);
  display: flex; align-items: flex-end;
}
.hero__img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 72% 50%;
}
/* Keeps the white nav readable over a bright photograph without dimming the
   whole image the way a flat overlay would. */
.hero__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(16,22,26,.55) 0%, rgba(16,22,26,.12) 22%, rgba(16,22,26,0) 42%);
}

/* The panel notches into the empty lower-left of the photograph. */
.hero__panel {
  position: relative;
  background: var(--paper);
  /* bottom-left must follow the frame’s corner, or a sliver of photo shows through */
  border-radius: 0 var(--r-lg) 0 0;   /* bottom-left square, matching the frame */
  /* no negative margin: the panel corner must stay exactly coincident with the
     frame corner, otherwise the two curves diverge and expose a sliver */
  padding: clamp(28px, 3.6vw, 54px) clamp(28px, 4vw, 64px) clamp(26px, 3.4vw, 46px) clamp(24px, 3.6vw, 56px);
  max-width: min(660px, 86%);
  display: grid; gap: clamp(18px, 2vw, 26px);
}
.hero__panel h1 { font-size: clamp(2.15rem, 4.6vw, 3.75rem); }
.hero__links { display: grid; gap: 6px; justify-items: start; }

.hero__meta {
  position: absolute; right: clamp(20px, 3vw, 44px); bottom: clamp(20px, 3vw, 40px);
  z-index: 2; text-align: right; color: var(--on-night);
  font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  text-shadow: 0 1px 12px rgba(0,0,0,.6);
}

/* ---------- 2. statement ------------------------------------------------- */

.statement { padding-block: clamp(56px, 8vw, 116px); }
.statement p {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.55rem, 3.3vw, 2.65rem); line-height: 1.28; letter-spacing: -.015em;
  color: var(--ink); max-width: 22ch;
}
.statement b { font-weight: 400; color: var(--teal); font-variant-numeric: tabular-nums; }
.statement__grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: clamp(28px, 5vw, 80px); align-items: end; }
.statement__aside { display: grid; gap: 20px; padding-bottom: 6px; }
.statement__aside p { font-family: var(--sans); font-size: 1rem; line-height: 1.7; color: var(--ink-2); max-width: 42ch; }

/* ---------- 3. docket (dark field) --------------------------------------- */

.field { background: var(--night); color: var(--on-night); padding-block: clamp(64px, 9vw, 130px); }
.field h2 { color: var(--on-night); }
.field .kicker { color: var(--teal-300); }
.kicker { font-family: var(--mono); font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--teal); }

.field__head { display: grid; gap: 18px; max-width: 44ch; margin-bottom: clamp(34px, 4vw, 56px); }
.field__head h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.04; }
.field__head p { color: rgba(242,239,233,.72); font-size: 1.05rem; }

.sched { border-top: 1px solid rgba(242,239,233,.18); }
.sched__row {
  display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1.5fr) auto;
  gap: 10px clamp(16px, 3vw, 48px); align-items: baseline;
  padding-block: clamp(18px, 2.2vw, 26px);
  border-bottom: 1px solid rgba(242,239,233,.14);
}
.sched__row--trigger { border-bottom-color: rgba(242,239,233,.4); }
.sched__what { font-size: clamp(1.05rem, 1.5vw, 1.32rem); font-weight: 600; color: var(--on-night); letter-spacing: -.02em; }
.sched__rule { font-family: var(--mono); font-size: .82rem; color: rgba(242,239,233,.6); }
.sched__date {
  font-family: var(--mono); font-size: clamp(1rem, 1.5vw, 1.3rem);
  color: var(--on-night); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
}
.sched__row--trigger .sched__date { color: var(--teal-300); }
.sched__row--hot .sched__date { color: var(--teal-300); }

/* the schedule computes itself when it comes into view */
.sched__row:not(.sched__row--trigger) { opacity: 0; transform: translateY(8px); }
.is-live .sched__row:not(.sched__row--trigger) { animation: computeIn .55s var(--ease) forwards; }
.is-live .sched__row:nth-child(2) { animation-delay: .25s }
.is-live .sched__row:nth-child(3) { animation-delay: .5s }
.is-live .sched__row:nth-child(4) { animation-delay: .75s }
.is-live .sched__row:nth-child(5) { animation-delay: 1s }
@keyframes computeIn { to { opacity: 1; transform: none } }

.field__foot { margin-top: clamp(28px, 3.5vw, 44px); display: flex; gap: 26px; flex-wrap: wrap; align-items: center; }
.field__note { color: rgba(242,239,233,.6); font-size: .95rem; }

/* ---------- 4. index ----------------------------------------------------- */

.idx { padding-block: clamp(64px, 8vw, 120px); }
.idx__head { display: grid; gap: 16px; max-width: 40ch; margin-bottom: clamp(34px, 4vw, 54px); }
.idx__head h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); letter-spacing: -.035em; line-height: 1.04; }

.idx__list { border-top: 1px solid var(--line); }
.idx__item {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 8px clamp(16px, 3vw, 44px); align-items: baseline;
  padding-block: clamp(20px, 2.4vw, 30px);
  border-bottom: 1px solid var(--line);
  transition: background .2s var(--ease);
}
.idx__item:hover { background: var(--surface); }
.idx__n { font-family: var(--mono); font-size: .82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.idx__t { font-size: clamp(1.12rem, 1.6vw, 1.4rem); font-weight: 600; color: var(--ink); letter-spacing: -.025em; }
.idx__d { color: var(--ink-2); font-size: 1rem; }

/* ---------- 5. scale of fees --------------------------------------------- */

.fees { padding-block: clamp(64px, 8vw, 120px); }
.fees__head { display: grid; gap: 16px; max-width: 46ch; margin-bottom: clamp(30px, 3.5vw, 48px); }
.fees__head h2 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); letter-spacing: -.035em; line-height: 1.04; }

.scale { border-top: 2px solid var(--ink); }
.scale__row {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr) auto auto;
  gap: 10px clamp(16px, 3vw, 40px); align-items: center;
  padding-block: clamp(22px, 2.6vw, 30px);
  border-bottom: 1px solid var(--line);
}
.scale__name { font-family: var(--serif); font-size: clamp(1.4rem, 2.2vw, 1.85rem); color: var(--ink); letter-spacing: -.02em; }
.scale__who { color: var(--ink-2); font-size: .99rem; }
.scale__amt {
  font-family: var(--mono); font-size: clamp(1.05rem, 1.6vw, 1.35rem); color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
}
.scale__amt small { display: block; font-family: var(--sans); font-size: .8rem; color: var(--ink-3); letter-spacing: 0; margin-top: 3px; }
.scale__cta { text-align: right; }
.scale__row--pick { background: var(--teal-50); }
.scale__row--pick .scale__name { color: var(--teal); }

.fees__note { margin-top: 26px; color: var(--ink-3); font-size: .97rem; max-width: 72ch; }

/* ---------- 6. questions ------------------------------------------------- */

.qs { padding-block: clamp(56px, 7vw, 104px); }
.qs__grid { display: grid; grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.qs h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.035em; line-height: 1.05; }
.qs details { border-bottom: 1px solid var(--line); }
.qs details:first-of-type { border-top: 1px solid var(--line); }
.qs summary { list-style: none; cursor: pointer; position: relative; padding: 22px 44px 22px 0;
              font-size: 1.08rem; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.qs summary::-webkit-details-marker { display: none; }
.qs summary:hover { color: var(--teal); }
.qs summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; margin-top: -5px; width: 11px; height: 11px;
  background: linear-gradient(var(--ink-3), var(--ink-3)) center/11px 1.5px no-repeat,
              linear-gradient(var(--ink-3), var(--ink-3)) center/1.5px 11px no-repeat;
  transition: transform .25s var(--ease);
}
.qs details[open] summary::after { transform: rotate(45deg); }
.qs__a { padding-bottom: 24px; max-width: 66ch; }

/* ---------- 7. close ----------------------------------------------------- */

.close { padding: var(--inset); }
.close__frame {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  min-height: min(62vh, 560px); display: flex; align-items: flex-end;
  background: var(--night);
}
.close__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.close__scrim { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,14,17,.92) 8%, rgba(10,14,17,.55) 48%, rgba(10,14,17,.25) 100%); }
.close__body { position: relative; padding: clamp(30px, 4vw, 60px); display: grid; gap: 20px; max-width: 46ch; }
.close__body h2 { color: var(--on-night); font-size: clamp(1.9rem, 3.6vw, 3rem); letter-spacing: -.035em; line-height: 1.04; }
.close__body p { color: rgba(242,239,233,.78); }

/* ---------- footer ------------------------------------------------------- */

.foot { padding: clamp(40px, 5vw, 64px) 0 34px; }
.foot__grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 30px 24px; }
.foot h5 { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin-bottom: 12px; }
.foot li + li { margin-top: 9px; }
.foot a { font-size: .96rem; color: var(--ink-2); }
.foot a:hover { color: var(--teal); }
.foot__bar { margin-top: clamp(32px, 4vw, 52px); padding-top: 20px; border-top: 1px solid var(--line);
             display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: var(--ink-3); }

/* ---------- reveal ------------------------------------------------------- */

.rv { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 1000px) {
  .statement__grid { grid-template-columns: 1fr; align-items: start; }
  .statement p { max-width: none; }
  .qs__grid { grid-template-columns: 1fr; }
  .idx__item { grid-template-columns: 2.6rem 1fr; }
  .idx__d { grid-column: 2; }
  .scale__row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .scale__who { grid-column: 1 / -1; order: 3; }
  .scale__cta { grid-column: 1 / -1; order: 4; text-align: left; }
  .foot__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 780px) {
  .nav__links { display: none; }
  .nav__burger { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; }
  .hero__panel { max-width: 100%; border-radius: 0; }
  .hero__frame { border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .hero__frame { min-height: min(90vh, 700px); }
  .hero__meta { display: none; }
  .sched__row { grid-template-columns: 1fr auto; }
  .sched__rule { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  body { font-size: 16.5px; }
  .foot__grid { grid-template-columns: 1fr; }
  .hero__img { object-position: 66% 50%; }
}

/* ---------- motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .rv { opacity: 1; transform: none; }
  .sched__row { opacity: 1 !important; transform: none !important; }
}

/* ---------- comparison (pricing page) ------------------------------------ */
.cmp-wrap { overflow-x: auto; }
.cmp { min-width: 700px; border-top: 2px solid var(--ink); }
.cmp__r { display: grid; grid-template-columns: minmax(0,1.6fr) repeat(4, minmax(0,1fr));
          gap: 10px clamp(14px,2.5vw,32px); align-items: center;
          padding-block: 16px; border-bottom: 1px solid var(--line); }
.cmp__r--h > * { font-weight: 600; color: var(--ink); }
.cmp__c { font-size: .97rem; }
.cmp__c:not(:first-child) { text-align: center; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .92rem; }
.cmp__k { color: var(--ink-2); font-family: var(--sans) !important; text-align: left !important; }
.cmp__y { color: var(--teal); }
.cmp__n { color: var(--ink-3); }
.page-head { padding-block: clamp(96px, 11vw, 150px) clamp(28px, 3.5vw, 48px); display: grid; gap: 16px; max-width: 46ch; }
.page-head h1 { font-size: clamp(2.1rem, 4.2vw, 3.2rem); letter-spacing: -.035em; line-height: 1.02; }
