/* ===========================================================
   James Chan & Co — stylesheet
   A "chambers on Fleet Street" system: ink navy, gilt gold,
   paper white, set in an editorial serif/sans pairing.
   =========================================================== */

:root {
  /* colour */
  --ink:        #141a2b;   /* near-black navy — header, footer, body text */
  --ink-soft:   #2c3550;   /* sub-headings, secondary text on paper */
  --paper:      #fbfaf7;   /* page background */
  --paper-alt:  #f1efe6;   /* card / callout background */
  --gold:       #d09c57;   /* headings — matches the logo gilt */
  --gold-deep:  #93692f;   /* accessible gold for text links */
  --oxblood:    #6e2430;   /* callout border, small accents */
  --line:       #ded8c8;   /* hairline rules */
  --text:       #23283a;
  --text-muted: #5b6072;
  --focus:      #2c6e8f;

  /* type */
  --font-display: "Spectral", "Iowan Old Style", Georgia, serif;
  --font-body:    "IBM Plex Sans", -apple-system, "Segoe UI", Arial, sans-serif;
  --font-mono:    "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* layout */
  --content-max: 42rem;
  --page-max: 78rem;
  --radius: 3px;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a {
  color: var(--gold-deep);
  text-decoration-color: currentColor;
  text-underline-offset: 0.15em;
}
a:hover { color: var(--oxblood); }
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--gold);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.6em;
}

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

.container {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* skip link */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--gold);
  color: var(--ink);
  padding: 0.6em 1em;
  z-index: 200;
  font-family: var(--font-body);
  font-weight: 600;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- utility bar ---------- */
.utility-bar {
  background: var(--ink);
  color: #cfd3de;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--gold);
}
.utility-bar .container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  justify-content: space-between;
  padding-block: 0.45rem;
}
.utility-bar a { color: #e7d9c2; }
.utility-bar a:hover { color: var(--gold); }
#clock { color: #e7d9c2; }

/* ---------- masthead ---------- */
.masthead {
  background: var(--ink);
  color: var(--paper);
  padding-block: 1.75rem;
}
.masthead .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem 2.5rem;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  flex: 1 1 380px;
  max-width: 520px;
}
.brand .estd {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.brand h1 {
  margin: 0;
  line-height: 1;
  width: 100%;
}
.logo-wordmark {
  display: block;
  width: 100%;
  max-width: clamp(220px, 34vw, 460px);
  height: auto;
}
.brand .tagline {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: #c7cbd8;
  margin-top: 0.1rem;
}

.masthead-contact {
  font-size: 0.92rem;
  color: #dfe2ea;
  line-height: 1.5;
}
.masthead-contact .address { display: block; }
.masthead-contact .phone {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 1.05rem;
}
.masthead-contact .phone a { color: var(--gold); }
.masthead-contact .details-link { font-size: 0.85rem; }

/* ---------- primary nav ---------- */
.primary-nav {
  background: #1b2338;
  border-top: 1px solid rgba(208,156,87,0.25);
}
.nav-toggle {
  display: none;
}
.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.25rem;
}
.primary-nav .container { padding-block: 0.4rem; }
.primary-nav a {
  display: inline-block;
  color: #dfe2ea;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
}
.primary-nav a:hover,
.primary-nav a:focus-visible {
  background: rgba(208,156,87,0.15);
  color: var(--gold);
}

/* ---------- layout: sidebar toc + content ---------- */
.page-body {
  display: block;
}
.page-grid {
  max-width: var(--page-max);
  margin-inline: auto;
  padding: 2rem 1.25rem 3rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.toc {
  border: 1px solid var(--line);
  background: var(--paper-alt);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.toc h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  margin-bottom: 0.6rem;
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.toc a {
  display: block;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  border-left: 3px solid transparent;
}
.toc a:hover,
.toc a:focus-visible { color: var(--oxblood); background: #fff; }
.toc a.is-active {
  border-left-color: var(--gold);
  color: var(--oxblood);
  background: #fff;
}

@media (min-width: 900px) {
  .page-grid {
    grid-template-columns: 240px minmax(0, 1fr);
    align-items: start;
  }
  .toc {
    position: sticky;
    top: 1.25rem;
  }
}

/* ---------- article content ---------- */
main {
  min-width: 0;
}
.law-section {
  max-width: var(--content-max);
  margin: 0 0 3.5rem;
  scroll-margin-top: 1rem;
}
.law-section:last-child { margin-bottom: 0; }

.law-section > h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--gold);
  margin-bottom: 1.5rem;
}

.law-section h3 {
  font-size: 1.2rem;
  color: var(--ink-soft);
  margin-top: 2.2rem;
  scroll-margin-top: 1rem;
}
.law-section h3:first-of-type { margin-top: 0; }

.law-section h4 {
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--oxblood);
  text-transform: none;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold-deep);
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.1rem 0.45rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* statutory duties list */
.duties-list {
  list-style: none;
  margin: 1.5rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.duties-list li {
  border-left: 3px solid var(--gold);
  background: var(--paper-alt);
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.duties-list h4 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 1.02rem;
}
.duties-list p { margin: 0; font-size: 0.97rem; color: var(--text-muted); }

/* recurring "how we help clients" callout */
.callout {
  background: var(--ink);
  color: #e7e9f0;
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  margin: 1.75rem 0;
  border-left: 4px solid var(--gold);
}
.callout h4 {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--gold);
  margin: 0 0 0.6rem;
}
.callout p { margin: 0; font-size: 0.97rem; }
.callout a { color: var(--gold); font-weight: 600; }
.callout a:hover { color: #fff; }

/* back to top */
.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.75rem 0 2.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem 0.35rem 0.6rem;
}
.back-to-top::before { content: "↑"; color: var(--gold-deep); font-size: 0.95em; }
.back-to-top:hover {
  border-color: var(--gold-deep);
  color: var(--oxblood);
  background: var(--paper-alt);
}

.back-home {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem 0.35rem 0.6rem;
}
.back-home::before { content: "\2190"; color: var(--gold-deep); font-size: 0.95em; }
.back-home:hover {
  border-color: var(--gold-deep);
  color: var(--oxblood);
  background: var(--paper-alt);
}

/* penalty table */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.penalties {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  font-size: 0.92rem;
}
table.penalties caption {
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.75rem 0.9rem 0.4rem;
}
table.penalties th, table.penalties td {
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.penalties thead th {
  background: var(--ink);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
table.penalties tbody tr:nth-child(even) { background: var(--paper-alt); }

/* legislative block-quote style lines (numbered provisos) */
.provisos {
  margin: 1rem 0 1.5rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--line);
}
.provisos p { margin-bottom: 0.6em; font-size: 0.97rem; color: var(--text-muted); }

/* ---------- footer ---------- */
.site-footer {
  background: var(--ink);
  color: #cdd1dd;
  padding-block: 2.75rem 1.5rem;
  margin-top: 2rem;
}
.site-footer .container {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) {
  .site-footer .container {
    grid-template-columns: 1.1fr 1fr 1fr;
  }
}
.footer-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0.6rem; }
.footer-brand h2 { margin: 0; line-height: 1; }
.footer-brand .logo-wordmark { display: block; width: 100%; max-width: 240px; height: auto; }
.footer-brand .estd {
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  color: var(--gold); text-transform: uppercase; display: block;
}
.footer-brand .front-door {
  width: 150px;
  height: 200px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius);
  border: 1px solid rgba(208,156,87,0.4);
  margin-top: 0.2rem;
}

.footer-nav h3, .footer-contact h3 {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.footer-nav a { color: #dfe2ea; text-decoration: none; font-size: 0.92rem; }
.footer-nav a:hover { color: var(--gold); }

.footer-contact p { font-size: 0.9rem; margin: 0 0 0.6rem; color: #cdd1dd; }
.footer-contact a { color: var(--gold); }

.sra-badge-wrap {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(208,156,87,0.25);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  font-size: 0.85rem;
  color: #a9adc0;
}
.sra-badge-wrap .badge-frame {
  flex-shrink: 0;
  width: 170px;
  aspect-ratio: 275 / 163;
}
.sra-badge-wrap iframe {
  border: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}
.legal-line {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  color: #8b8fa3;
  border-top: 1px solid rgba(208,156,87,0.15);
  padding-top: 1rem;
}
.legal-line a { color: #a9adc0; }

/* ---------- mobile nav ---------- */
@media (max-width: 720px) {
  .primary-nav .container { padding-block: 0; }
  .nav-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: 0;
    color: var(--gold);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.25rem;
    cursor: pointer;
  }
  .nav-toggle .chevron { transition: transform 0.2s ease; margin-left: auto; }
  .nav-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }
  .primary-nav ul {
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .primary-nav ul.is-open { max-height: 480px; padding-bottom: 0.6rem; }
  .primary-nav a { display: block; padding: 0.65rem 0.5rem; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .logo-wordmark { max-width: 260px; }
}
