/* ==========================================================================
   marinedieselengine.com.au — design system

   Character: a well-made technical handbook, not a brochure. The reader is
   frequently on a phone at a marina trying to decide whether to keep going,
   so legibility, scan-ability and a clear safety hierarchy outrank decoration.
   ========================================================================== */

/* --- tokens: light is the base; dark redefines only what changes ---------- */
:root {
  color-scheme: light dark;

  --paper:      #f6f4ef;   /* warm off-white ground */
  --surface:    #fffefb;   /* cards, raised areas */
  --surface-2:  #efece5;   /* wells, table headers */
  --ink:        #14232e;   /* body text */
  --ink-strong: #0a161f;   /* headings */
  --muted:      #5b6b76;
  --rule:       #ddd8cd;
  --rule-soft:  #e8e4db;

  --accent:     #0d6273;   /* marine petrol — links, structure */
  --accent-2:   #0a4c5a;   /* hover */
  --accent-wash:#e4eef0;
  --brass:      #9a6b1f;   /* editorial accent, draft state */
  --brass-wash: #f6efdf;
  --danger:     #97271f;   /* safety callouts only */
  --danger-wash:#fbeae8;

  --measure: 38rem;        /* body copy line length */
  --gutter: clamp(1.15rem, 4vw, 2rem);
  --radius: 10px;
  --shadow: 0 1px 2px rgb(20 35 46 / .05), 0 6px 20px -10px rgb(20 35 46 / .18);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0a141b;
    --surface:    #101d26;
    --surface-2:  #16262f;
    --ink:        #dde5e9;
    --ink-strong: #f2f6f8;
    --muted:      #93a5b0;
    --rule:       #23353f;
    --rule-soft:  #1a2b34;

    --accent:     #5cb8c9;
    --accent-2:   #85d0dd;
    --accent-wash:#122b32;
    --brass:      #d6a24e;
    --brass-wash: #2b2113;
    --danger:     #e8837a;
    --danger-wash:#2c1512;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px -10px rgb(0 0 0 / .6);
  }
}
:root[data-theme="dark"] {
  --paper:#0a141b; --surface:#101d26; --surface-2:#16262f;
  --ink:#dde5e9; --ink-strong:#f2f6f8; --muted:#93a5b0;
  --rule:#23353f; --rule-soft:#1a2b34;
  --accent:#5cb8c9; --accent-2:#85d0dd; --accent-wash:#122b32;
  --brass:#d6a24e; --brass-wash:#2b2113;
  --danger:#e8837a; --danger-wash:#2c1512;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px -10px rgb(0 0 0 / .6);
}

/* --- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.68;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 50;
  background: var(--surface); color: var(--ink);
  padding: .7rem 1.1rem; border: 1px solid var(--rule); border-radius: var(--radius);
}
.skip:focus { left: 1rem; top: 1rem; }

/* --- header -------------------------------------------------------------- */
header.site {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.75rem;
  padding: .7rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--display); font-weight: 700; font-size: 1.06rem;
  letter-spacing: -.015em; color: var(--ink-strong); text-decoration: none;
  margin-right: auto;
}
.brand svg { flex: none; color: var(--accent); }
header.site nav { display: flex; flex-wrap: wrap; gap: .25rem .35rem; }
header.site nav a {
  color: var(--muted); text-decoration: none; font-size: .875rem; font-weight: 500;
  padding: .34rem .6rem; border-radius: 7px; white-space: nowrap;
}
header.site nav a:hover { color: var(--ink-strong); background: var(--surface-2); }

/* On a phone the nav must not wrap to a second row and push the page down —
   readers arrive on a specific page, not to browse the menu. One row that
   scrolls sideways keeps the content above the fold. */
@media (max-width: 44rem) {
  header.site { flex-wrap: nowrap; gap: .75rem; padding-inline: 0; }
  .brand { font-size: .98rem; padding-left: var(--gutter); }
  header.site nav {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    padding-right: var(--gutter); -webkit-overflow-scrolling: touch;
  }
  header.site nav::-webkit-scrollbar { display: none; }
  header.site nav a { font-size: .82rem; padding: .3rem .5rem; }
}
@media (max-width: 26rem) {
  /* Very narrow: the wordmark alone would crowd the nav out. */
  .brand { font-size: .9rem; }
}

/* --- page shell ---------------------------------------------------------- */
main { padding: 0 var(--gutter) 4rem; }
.wrap { max-width: 74rem; margin: 0 auto; }

/* Article + sidebar on wide screens; single column below. The article column is
   pinned to the measure so full-bleed elements line up with body copy instead
   of floating in dead space beside it. */
.layout { display: grid; gap: 2.5rem; max-width: 74rem; margin: 0 auto; }
@media (min-width: 62rem) {
  .layout {
    grid-template-columns: minmax(0, var(--measure)) 15rem;
    justify-content: center; gap: 4rem; align-items: start;
  }
}

.breadcrumb {
  max-width: 74rem; margin: 0 auto; padding: 1.1rem var(--gutter) .35rem;
  font-size: .8rem; color: var(--muted);
}
@media (min-width: 62rem) {
  /* Match the centred article column so the crumb sits over the h1. */
  .breadcrumb { max-width: calc(var(--measure) + 15rem + 4rem); padding-inline: 0; }
}
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; }
.breadcrumb li:not(:last-child)::after { content: "/"; margin-left: .3rem; color: var(--rule); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

/* --- prose --------------------------------------------------------------- */
.prose { min-width: 0; }
.prose > * { max-width: var(--measure); }
.prose > h1, .prose > h2 { max-width: 22ch; }

.prose h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.85rem, 1.35rem + 1.9vw, 2.6rem); line-height: 1.1;
  letter-spacing: -.025em; color: var(--ink-strong);
  margin: .6rem 0 1.1rem;
  font-variation-settings: "opsz" 120;
}
.prose h2 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.35rem, 1.1rem + .9vw, 1.7rem); line-height: 1.2;
  letter-spacing: -.015em; color: var(--ink-strong);
  margin: 3rem 0 .85rem; padding-top: 1.1rem;
  border-top: 1px solid var(--rule-soft);
}
.prose h2:first-of-type { border-top: 0; padding-top: 0; }
.prose h3 {
  font-family: var(--sans); font-weight: 650; font-size: 1.055rem;
  letter-spacing: -.005em; color: var(--ink-strong); margin: 2rem 0 .4rem;
}
.prose p { margin: 0 0 1.1rem; }
.prose strong { font-weight: 650; color: var(--ink-strong); }

/* Opening paragraph of an article gets a touch more presence. */
.prose > h1 + p { font-size: 1.16rem; line-height: 1.6; color: var(--muted); }

.prose ul, .prose ol { margin: 0 0 1.2rem; padding-left: 1.15rem; }
.prose li { margin: .38rem 0; padding-left: .15rem; }
.prose li::marker { color: var(--accent); }

/* Blockquote = editorial note. */
.prose blockquote {
  margin: 1.6rem 0; padding: .95rem 1.15rem;
  background: var(--brass-wash); border: 1px solid color-mix(in srgb, var(--brass) 28%, transparent);
  border-left: 3px solid var(--brass); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .95rem;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* Tables scroll inside their own box; the page never scrolls sideways. */
.prose .table-scroll { max-width: none; overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.prose table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.prose thead th {
  background: var(--surface-2); color: var(--muted);
  font-family: var(--sans); font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
}
.prose th, .prose td { padding: .62rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-soft); }
.prose tbody tr:last-child td { border-bottom: 0; }

.prose code {
  font-size: .88em; background: var(--surface-2); padding: .12em .38em;
  border-radius: 4px; border: 1px solid var(--rule-soft);
}
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; }
.prose img { max-width: 100%; height: auto; border-radius: var(--radius); }

/* A paragraph that is only "→ link · link" becomes a related-links row. */
.prose p.linkrow {
  max-width: none; display: flex; flex-wrap: wrap; gap: .4rem;
  margin: -.35rem 0 1.35rem; font-size: .875rem;
}
.prose p.linkrow a {
  display: inline-block; text-decoration: none; font-weight: 500;
  padding: .3rem .68rem; border-radius: 100px;
  background: var(--accent-wash); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.prose p.linkrow a:hover { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.prose p.linkrow > br { display: none; }

/* A section whose data is not collected yet. Stated plainly rather than left
   as an unexplained gap where a reader expected listings. */
.prose .pending-note {
  max-width: none; margin: 1.4rem 0; padding: .9rem 1.1rem;
  background: var(--surface); border: 1px dashed var(--rule);
  border-radius: var(--radius); font-size: .92rem; color: var(--muted);
}
.prose .pending-note strong { color: var(--ink-strong); }

/* --- safety callout ------------------------------------------------------ */
/* Applied to the "shut down now / stop driving" sections, which must not read
   like ordinary body copy. */
.prose .safety {
  max-width: none; margin: 1.6rem 0; padding: 1.05rem 1.2rem;
  background: var(--danger-wash);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-left: 4px solid var(--danger); border-radius: 0 var(--radius) var(--radius) 0;
}
.prose .safety > :first-child { margin-top: 0; }
.prose .safety > :last-child { margin-bottom: 0; }
.prose .safety h2 { border: 0; padding-top: 0; margin-top: 0; color: var(--danger); font-size: 1.2rem; }
.prose .safety li::marker { color: var(--danger); }
.prose .safety a { text-decoration-thickness: 1px; font-weight: 600; }

/* --- sidebar / table of contents ----------------------------------------- */
.side { display: none; }
@media (min-width: 62rem) {
  .side { display: block; position: sticky; top: 4.6rem; font-size: .85rem; }
}
.toc-title {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin: 0 0 .6rem;
}
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.toc li { margin: 0; }
.toc a {
  display: block; padding: .28rem 0 .28rem .8rem; margin-left: -2px;
  border-left: 2px solid transparent; color: var(--muted); text-decoration: none;
  line-height: 1.4;
}
.toc a:hover { color: var(--accent); border-left-color: var(--accent); }

/* --- cards & grids ------------------------------------------------------- */
.cards { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .8rem; max-width: none; }
@media (min-width: 34rem) { .cards { grid-template-columns: repeat(2, 1fr); } }
.cards li { margin: 0; }
.card {
  display: block; height: 100%; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius); text-decoration: none; color: inherit;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .t { display: block; font-family: var(--display); font-weight: 600; font-size: 1.06rem; color: var(--ink-strong); letter-spacing: -.01em; }
.card .d { display: block; margin-top: .25rem; font-size: .875rem; color: var(--muted); line-height: 1.5; }

/* Dense link grids for service and location indexes. */
.chips { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .4rem; max-width: none; }
@media (min-width: 30rem) { .chips { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 52rem) { .chips { grid-template-columns: repeat(3, 1fr); } }
.chips li { margin: 0; }
.chips a {
  display: block; padding: .5rem .75rem; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--rule-soft);
  border-radius: 8px; text-decoration: none; color: var(--ink);
}
.chips a:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }

/* --- hero ---------------------------------------------------------------- */
.hero { max-width: 74rem; margin: 0 auto; padding: clamp(2.5rem, 7vw, 4.5rem) 0 1rem; }
.hero .eyebrow {
  display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
  background: var(--accent-wash); padding: .3rem .65rem; border-radius: 100px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.hero h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2.2rem, 1.2rem + 4.4vw, 4rem); line-height: 1.02;
  letter-spacing: -.03em; color: var(--ink-strong);
  margin: 1rem 0 0; max-width: 16ch;
  font-variation-settings: "opsz" 144;
}
.hero p { max-width: 40rem; font-size: clamp(1.05rem, 1rem + .35vw, 1.24rem); color: var(--muted); margin: 1rem 0 0; }
.hero .note { font-size: .92rem; margin-top: .8rem; }

.section-head {
  max-width: 74rem; margin: 3.5rem auto .25rem;
  font-family: var(--display); font-weight: 600; letter-spacing: -.015em;
  font-size: clamp(1.3rem, 1.1rem + .7vw, 1.6rem); color: var(--ink-strong);
}
.section-sub { max-width: 46rem; margin: .35rem auto 0; color: var(--muted); font-size: .95rem; }

/* --- banners ------------------------------------------------------------- */
.draft-banner {
  max-width: 74rem; margin: 1.1rem auto 0;
  margin-inline: auto; padding: .85rem 1.05rem;
  background: var(--brass-wash); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--brass) 35%, transparent);
  border-radius: var(--radius); font-size: .85rem; line-height: 1.55;
}
.draft-banner strong { color: var(--brass); }
.draft-banner ul { margin: .45rem 0 0; padding-left: 1.05rem; }
.draft-banner code { font-size: .9em; background: color-mix(in srgb, var(--brass) 12%, transparent); padding: .05em .3em; border-radius: 3px; }

/* --- byline & footer ----------------------------------------------------- */
.byline {
  max-width: var(--measure); margin: 3rem 0 0; padding-top: 1.1rem;
  border-top: 1px solid var(--rule); font-size: .85rem; color: var(--muted);
}
.byline p { margin: .2rem 0; }

footer.site {
  border-top: 1px solid var(--rule); background: var(--surface);
  padding: 2.5rem var(--gutter) 3rem; font-size: .875rem; color: var(--muted);
}
.footer-inner { max-width: 74rem; margin: 0 auto; display: grid; gap: 1.5rem; }
@media (min-width: 44rem) { .footer-inner { grid-template-columns: 1.4fr 1fr; } }
footer.site strong { color: var(--ink-strong); }
footer.site p { margin: .45rem 0; max-width: 42rem; }
footer.site nav { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; }
footer.site nav a { color: var(--muted); text-decoration: none; }
footer.site nav a:hover { color: var(--accent); text-decoration: underline; }
.muted { color: var(--muted); }
