/* ============================================================
   Service file pages — "the adviser's working paper"
   Extends site.css. Identity unchanged: warm paper, navy acts,
   gold accents, Schibsted Grotesk display, Figtree reading.
   ============================================================ */

/* ---------- Document bar (breadcrumb as a file header rule) ---------- */
.file-bar {
  border-bottom: 1px solid var(--hairline);
  background: var(--ground);
}
.file-bar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  flex-wrap: wrap;
}
.file-ref {
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-ink);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.file-ref .sep { width: 22px; height: 1px; background: var(--clay); opacity: .5; }
.file-ref .of { color: var(--neutral); font-weight: 500; letter-spacing: .12em; }
.file-back {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.file-back svg { transition: transform .3s var(--ease); }
.file-back:hover { color: var(--ink); }
.file-back:hover svg { transform: translateX(-3px); }
@media (prefers-reduced-motion: reduce) { .file-back:hover svg { transform: none; } }

/* ---------- Photographic plate ---------- */
.file-plate {
  position: relative;
  /* reset the UA <figure> margin so the plate fills the container gutter-to-gutter */
  margin: clamp(20px, 3vw, 34px) 0 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--ground-2);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  aspect-ratio: 21 / 9;
}
.file-plate img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.file-plate::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,21,34,0) 46%, rgba(16,21,34,.72) 100%);
  pointer-events: none;
}
.plate-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 40px 22px 16px;
  color: rgba(246,240,232,.9);
  font-size: 13px;
  line-height: 1.45;
  max-width: 62ch;
}
@media (max-width: 760px) { .file-plate { aspect-ratio: 3 / 2; } }

/* ---------- Two-column file body ---------- */
.file-body { padding-block: 0 clamp(50px, 7vw, 88px); }
.file-grid {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

/* ---------- Contents rail ---------- */
.file-index { position: sticky; top: 94px; }
.file-index h2 {
  font-family: "Figtree", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--neutral);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}
.file-index ol { list-style: none; margin: 0; padding: 0; counter-reset: idx; }
.file-index li { counter-increment: idx; }
.file-index ol a {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 11px 0 11px 12px;
  margin-left: -12px;
  border-left: 2px solid transparent;
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--neutral);
  transition: color .25s var(--ease), border-color .25s var(--ease);
}
.file-index ol a::before {
  content: "0" counter(idx);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .06em;
  color: color-mix(in srgb, var(--neutral) 78%, transparent);
  transition: color .25s var(--ease);
}
.file-index ol a:hover { color: var(--ink); }
.file-index ol a.is-current { color: var(--ink); border-left-color: var(--clay); font-weight: 600; }
.file-index ol a.is-current::before { color: var(--gold-ink); }
.file-index .idx-foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--neutral);
  line-height: 1.5;
}
.file-index .idx-foot .btn { width: 100%; margin-top: 12px; font-size: 14px; padding: 12px 18px; }

/* ---------- Masthead (full container width, above the file grid) ---------- */
/* padding-block only — a `padding` shorthand here would wipe .wrap's gutter */
.file-mast { padding-block: clamp(34px, 5vw, 56px) clamp(6px, 1vw, 12px); }
.file-mast h1 {
  font-size: clamp(40px, 6.4vw, 74px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.06;
  margin-bottom: 22px;
  max-width: 17ch;
}
.file-lede {
  font-size: clamp(17px, 1.5vw, 19px);
  color: var(--ink-soft);
  max-width: 54ch;
  margin-bottom: 30px;
}
.file-meta {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px 40px;
  padding: 20px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 28px;
}
.file-meta div { padding: 4px 0; }
.file-meta dt {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--neutral);
  margin-bottom: 3px;
}
.file-meta dd { margin: 0; font-size: 15px; font-weight: 500; }
.file-actions { display: flex; flex-wrap: wrap; gap: 13px; }

/* Service pages pushed the viewport 9px sideways at 320px, and had done since
   before the #24-#28 batch. `.file-actions` already wraps, so the row was never
   the problem: a single button was. `.btn` in site.css is `white-space: nowrap`
   with 24px of side padding, so "Speak to us about wealth planning" measured
   309px against a 280px content box (320px less two 20px gutters) and simply
   stuck out. Padding alone cannot recover 29px — dropping it to 10px still
   leaves the button over — so the label has to be allowed to wrap.

   Below 400px the two buttons stack and each takes the full column, which is
   the honest amount of room they have. `white-space: normal` is what actually
   fixes the overflow; `line-height` is raised from the base 1 because a wrapped
   label at line-height 1 sets solid. Measured after: 0px overflow at 320, 360
   and 390 on all six service pages. */
@media (max-width: 400px) {
  .file-actions { flex-direction: column; align-items: stretch; }
  .file-actions .btn {
    width: 100%;
    white-space: normal;
    line-height: 1.25;
    padding-inline: 16px;
  }
}

/* ---------- Clauses ---------- */
/* No scroll-margin-top here. The sticky header is cleared once, globally, by
   `scroll-padding-top: var(--header-h)` on the root in site.css; a per-element
   margin on top of that would push a clause anchor twice the header down. */
.clause { padding-top: clamp(38px, 5vw, 58px); }
.clause:first-child { padding-top: 0; }
.clause + .clause { border-top: 1px solid var(--hairline); }
.clause-num {
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.clause-num::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.clause h2 {
  font-size: clamp(28px, 3.6vw, 42px);
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  max-width: 22ch;
}
.clause > p, .clause .prose p { color: var(--ink-soft); max-width: 62ch; margin-bottom: 16px; }
.clause > p:last-child { margin-bottom: 0; }
.clause strong { color: var(--ink); font-weight: 600; }
.clause a:not(.btn) {
  color: var(--navy); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}

/* ---------- The schedule (ledger-set) ---------- */
.schedule { margin: 26px 0 8px; }
.schedule dl { margin: 0; display: grid; grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1.28fr); }
.schedule dt, .schedule dd {
  border-top: 1px solid var(--hairline);
  padding: 16px 0;
  margin: 0;
}
.schedule dt {
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 600;
  font-size: 15.5px;
  padding-right: 24px;
  color: var(--ink);
}
.schedule dd { font-size: 15px; color: var(--ink-soft); }
.schedule dd:last-of-type, .schedule dt:last-of-type { border-bottom: 1px solid var(--hairline); }
.schedule .fig {
  /* Proportional lining figures: these sit inside sentences, and tabular
     figures open a full digit-width gap after the comma in "£125,000". */
  font-variant-numeric: lining-nums proportional-nums;
  font-feature-settings: "tnum" 0, "lnum" 1;
  font-weight: 600;
  color: var(--ink);
}
@media (max-width: 620px) {
  .schedule dl { grid-template-columns: 1fr; }
  .schedule dt { padding-bottom: 4px; }
  .schedule dd { border-top: 0; padding-top: 0; }
  .schedule dt:last-of-type { border-bottom: 0; }
}

/* ---------- Method clauses ---------- */
.method { list-style: none; margin: 24px 0 0; padding: 0; counter-reset: step; }
.method li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 20px;
  padding: 22px 0;
  border-top: 1px solid var(--hairline);
}
.method li:last-child { border-bottom: 1px solid var(--hairline); }
.method li::before {
  content: counter(step, decimal-leading-zero);
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 700;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--clay) 76%, var(--ink));
  line-height: 1.2;
}
.method h3 { font-size: 19px; margin-bottom: 7px; }
.method p { color: var(--ink-soft); font-size: 15.5px; max-width: 58ch; }
@media (max-width: 520px) {
  .method li { grid-template-columns: 1fr; gap: 6px; }
}

/* ---------- Worked example ---------- */
.worked {
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: clamp(24px, 3vw, 34px);
  margin-top: 26px;
}
.worked-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-ink);
  background: var(--clay-tint);
  border: 1px solid color-mix(in srgb, var(--clay) 24%, var(--hairline));
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 18px;
}
.worked h3 { font-size: 22px; margin-bottom: 12px; }
.worked p { color: var(--ink-soft); font-size: 15.5px; margin-bottom: 14px; max-width: 60ch; }
.worked-figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 4px 24px;
  margin: 22px 0 4px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}
.worked-figs div { padding: 6px 0; }
.worked-figs .k { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--neutral); margin-bottom: 4px; }
.worked-figs .v {
  font-family: "Schibsted Grotesk", sans-serif;
  font-weight: 700;
  font-size: 22px;
  text-wrap: balance;
  letter-spacing: -0.02em;
  color: var(--clay-deep);
  font-variant-numeric: lining-nums proportional-nums;
  font-feature-settings: "tnum" 0, "lnum" 1;
}

/* ---------- Appendix: risks, fees, disclosure ---------- */
.appendix {
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--navy);
  border-radius: var(--r-lg);
  padding: clamp(24px, 3vw, 32px);
  margin-top: 26px;
}
.appendix h3 { font-size: 17px; margin-bottom: 10px; }
.appendix h3 + p { margin-bottom: 22px; }
.appendix p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.62; max-width: 68ch; }
.appendix > div + div { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.appendix .todo {
  border: 1px dashed color-mix(in srgb, var(--clay) 46%, var(--hairline));
  border-radius: var(--r-sm);
  padding: 14px 16px;
  background: color-mix(in srgb, var(--clay-tint) 44%, transparent);
}
.appendix .todo strong { color: var(--gold-ink); }
.sign {
  display: flex; align-items: center; gap: 14px;
  margin-top: 26px; padding-top: 22px;
  border-top: 1px solid var(--hairline);
}
.sign img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; object-position: center 18%; flex: none; border: 1px solid var(--hairline); }
.sign .who { font-family: "Schibsted Grotesk", sans-serif; font-weight: 600; font-size: 15px; }
.sign .who span { display: block; font-family: "Figtree", sans-serif; font-weight: 500; font-size: 13px; color: var(--neutral); }

/* ---------- Related files ---------- */
.files-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.file-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 210px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--navy-deep);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), border-color .4s var(--ease);
}
.file-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.file-card::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,21,34,0) 30%, rgba(15,20,34,.88) 100%);
}
.file-card .fc-body { position: relative; z-index: 2; margin-top: auto; padding: 20px; }
.file-card .fc-name { font-family: "Schibsted Grotesk", sans-serif; font-weight: 600; font-size: 19px; color: #F6F2E9; letter-spacing: -0.01em; }
.file-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--clay) 34%, var(--hairline)); }
.file-card:hover img { transform: scale(1.05); }
@media (prefers-reduced-motion: reduce) {
  .file-card:hover { transform: none; }
  .file-card:hover img { transform: none; }
}

/* ---------- Closing call to action ---------- */
.file-cta .wrap { max-width: 760px; text-align: center; }
.file-cta h2 { font-size: clamp(28px, 3.6vw, 42px); margin-bottom: 16px; }
.file-cta p { color: var(--ink-soft); margin-bottom: 28px; }
.file-cta .file-actions { justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .file-grid { grid-template-columns: 1fr; gap: 0; }
  .file-index {
    position: static;
    margin-bottom: 34px;
    padding-bottom: 6px;
  }
  .file-index ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0 8px;
  }
  .file-index ol a {
    padding: 9px 14px;
    margin-left: 0;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: var(--raised);
    grid-template-columns: auto auto;
    gap: 8px;
    align-items: center;
  }
  .file-index ol a.is-current { border-color: color-mix(in srgb, var(--clay) 46%, var(--hairline)); background: var(--clay-tint); }
  .file-index .idx-foot { display: none; }
}
@media (max-width: 760px) {
  .files-grid { grid-template-columns: 1fr; }
  .file-meta { gap: 0 24px; }
}

@media (max-width: 760px) {
  .file-meta { grid-template-columns: 1fr; gap: 14px; }
}
