/* ============================================================
   Tradoing - editorial monograph styles for the generated
   static blog + careers pages. Mirrors src/index.css:
   warm paper, ink, emerald accent, oxblood, Newsreader +
   JetBrains Mono, hairline rules, sharp corners (3-5px),
   hung section numbers, dropcap lede, mono uppercase labels.

   This stylesheet is the styling half of a matched pair with
   scripts/lib/templates.mjs (blog) and the careers templates:
   both use exactly the class names in shell-vocab.md.
   ============================================================ */

:root {
  --paper: #faf9f6;
  --ink: #141312;
  --muted: #6b6b63;
  --hair: rgba(20, 19, 18, 0.14);
  --accent: #0f6b3b;
  --accent-d: #0b5028;
  --oxblood: #7a1f1f;

  --panel: #fffefa;
  --soft-shadow: 0 1px 0 rgba(20, 19, 18, 0.03);

  --font-serif: 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --wrap: 948px;
  --measure: 662px;
  --gutter: clamp(1.4rem, 5vw, 26px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.64;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(15, 107, 59, 0.16); color: var(--ink); }

/* ── Mono uppercase micro-label (site signature) ─────────── */
.mg-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}
.mg-eyebrow--muted { color: var(--muted); }

/* ── Masthead - mirrors the landing .brand / .brandmark ──── */
.mg-nav {
  background: var(--paper);
  border-bottom: 0;
}
.mg-nav__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 22px var(--gutter) 0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.mg-nav__brand {
  display: flex;
  align-items: baseline;
  gap: clamp(9px, 1.2vw, 13px);
  flex-shrink: 0;
}
.mg-nav__logo {
  display: block;
  width: auto;
  height: clamp(30px, 4vw, 38px);
  align-self: center;
  flex: 0 0 auto;
}
.mg-nav__word {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(24px, 3.4vw, 30px);
  letter-spacing: -0.025em;
  line-height: 0.96;
  color: var(--ink);
}
.mg-nav__links {
  display: flex;
  align-items: baseline;
  gap: clamp(16px, 2.4vw, 26px);
  margin-left: auto;
}
.mg-nav__link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.15s ease;
}
.mg-nav__link:hover { color: var(--accent-d); }
.mg-nav__link[aria-current="page"] {
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

/* Mobile burger - hidden on desktop */
.mg-nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 30px;
  margin-left: auto;
  padding: 6px;
  background: none;
  border: 0;
  cursor: pointer;
}
.mg-nav__burger span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.mg-nav__burger.is-open span:first-child { transform: translateY(6.5px) rotate(45deg); }
.mg-nav__burger.is-open span:nth-child(2) { opacity: 0; }
.mg-nav__burger.is-open span:last-child { transform: translateY(-6.5px) rotate(-45deg); }

/* Hairline rule under the masthead */
.mg-nav__rule {
  border: 0;
  border-top: 1px solid var(--ink);
  max-width: var(--wrap);
  margin: 14px auto 0;
  opacity: 0.85;
}

/* Full-screen paper drawer */
.mg-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 0 var(--gutter);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.mg-drawer.is-open { opacity: 1; pointer-events: auto; }
.mg-drawer nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
}
.mg-drawer__link {
  display: block;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  color: var(--ink);
  padding: 8px 0;
  transition: color 0.15s ease;
}
/* Secondary (legal) links read quieter than the primary destinations. */
.mg-drawer__link--sub {
  font-size: clamp(15px, 4.4vw, 19px);
  font-weight: 500;
  color: var(--muted);
}
/* Breathing room between the primary destinations and the legal links. */
.mg-drawer nav a:nth-child(4) { margin-top: 26px; }
.mg-drawer__link:hover { color: var(--accent); }
.mg-drawer__close {
  position: absolute;
  top: 20px;
  right: var(--gutter);
  width: 34px;
  height: 34px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}
.mg-drawer__close span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: background 0.15s ease;
}
.mg-drawer__close span:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.mg-drawer__close span:last-child { transform: translate(-50%, -50%) rotate(-45deg); }
.mg-drawer__close:hover span { background: var(--accent); }

/* ── Colophon footer - mirrors landing .colophon ─────────── */
.mg-colophon {
  max-width: var(--measure);
  margin: 48px auto 0;
  padding: 22px var(--gutter) 60px;
  border-top: 1px solid var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  align-items: baseline;
}
.mg-colophon__mark {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}
.mg-colophon__links { display: flex; flex-wrap: wrap; gap: 16px; }
.mg-colophon__link {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: color 0.15s ease;
}
.mg-colophon__link:hover { color: var(--accent-d); text-decoration: underline; }
.mg-colophon__disclaim {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--oxblood);
}
.mg-colophon__line {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  flex-basis: 100%;
}

/* ── Page shells ─────────────────────────────────────────── */
.mg-wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 60px) var(--gutter) 0;
}

/* Lede block for index / careers landing */
.mg-lede {
  max-width: var(--measure);
  border-bottom: 1px solid var(--hair);
  padding-bottom: clamp(1.75rem, 4vw, 2.75rem);
}
.mg-lede__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(42px, 8vw, 72px);
  line-height: 0.96;
  letter-spacing: -0.025em;
  margin: 6px 0 0;
}
.mg-lede__sub {
  max-width: 46ch;
  margin-top: 18px;
  color: var(--muted);
  font-size: clamp(18px, 1.9vw, 21px);
  line-height: 1.5;
}

/* ── Search - thin underline field, no boxy input ────────── */
.mg-search {
  width: 100%;
  max-width: 30rem;
  margin-top: 26px;
  padding: 10px 2px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease;
}
.mg-search::placeholder { color: var(--muted); }
.mg-search:focus { outline: none; border-color: var(--accent); }

/* ── Index list - numbered, ruled, editorial (not cards) ─── */
.mg-index { list-style: none; }
.mg-entry { border-bottom: 1px solid var(--hair); }
.mg-entry__link {
  display: grid;
  grid-template-columns: 3rem 1fr minmax(120px, 220px);
  gap: clamp(1rem, 3vw, 2.4rem);
  align-items: start;
  padding: clamp(1.5rem, 3.5vw, 34px) 0;
  transition: background 0.2s ease;
}
.mg-entry__link:hover { background: linear-gradient(90deg, rgba(15, 107, 59, 0.04), transparent 70%); }
.mg-entry__no {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.1;
  color: var(--accent);
  letter-spacing: -0.012em;
  font-variant-numeric: tabular-nums;
}
.mg-entry__body { min-width: 0; }
.mg-entry__meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.mg-entry__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.012em;
  transition: color 0.15s ease;
}
.mg-entry__link:hover .mg-entry__title { color: var(--accent-d); }
.mg-entry__excerpt {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.5;
  max-width: 54ch;
}
.mg-entry__aside { display: flex; flex-direction: column; gap: 12px; align-items: flex-end; }
.mg-entry__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--hair);
  border-radius: 5px;
  box-shadow: var(--soft-shadow);
}
.mg-entry__date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mg-empty {
  padding: 3rem 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

/* ── Article ─────────────────────────────────────────────── */
.mg-article {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 60px) var(--gutter) 0;
}
.mg-article__head { max-width: var(--measure); }
.mg-article__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.022em;
  margin: 14px 0 0;
}
.mg-article__byline {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.mg-article__byline time { color: var(--ink); }

/* Generic flex header row (careers detail, etc.) */
.mg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.mg-hero {
  max-width: 884px;
  margin: clamp(1.75rem, 5vw, 34px) 0 38px;
}
.mg-hero img {
  width: 100%;
  max-height: 62vh;
  object-fit: cover;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}
.mg-hero figcaption {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-top: 12px;
}
.mg-hero figcaption a { color: var(--accent); border-bottom: 1px solid rgba(15, 107, 59, 0.4); }
.mg-hero figcaption a:hover { color: var(--accent-d); }

.mg-video { max-width: 884px; margin: clamp(1.75rem, 5vw, 34px) 0; }
.mg-video video {
  width: 100%;
  border: 1px solid var(--hair);
  border-radius: 12px;
  background: #000;
}

/* ── Prose - editorial body with dropcap lede ────────────── */
.mg-prose {
  max-width: var(--measure);
  font-size: clamp(17.5px, 1.45vw, 19.5px);
  line-height: 1.64;
  text-wrap: pretty;
  color: var(--ink);
}
.mg-prose > * + * { margin-top: 1.05em; }
.mg-prose > p:first-of-type::first-letter {
  float: left;
  font-weight: 600;
  font-size: 3.5em;
  line-height: 0.78;
  padding: 7px 10px 0 0;
  color: var(--ink);
}
.mg-prose h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.12;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin-top: 1.9em;
  padding-top: 0.8em;
  border-top: 1px solid var(--hair);
}
.mg-prose h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 1.5em;
}
.mg-prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  transition: color 0.15s ease;
}
.mg-prose a:hover { color: var(--accent-d); }
.mg-prose em { font-style: italic; }
.mg-prose strong { font-weight: 600; }
.mg-prose ul, .mg-prose ol { padding-left: 1.3rem; }
.mg-prose li { margin-top: 0.5em; }
.mg-prose li::marker { color: var(--accent); }
.mg-prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 15px;
  margin-left: 0;
  color: var(--muted);
  font-style: italic;
}
.mg-prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: rgba(20, 19, 18, 0.05);
  border: 1px solid var(--hair);
  border-radius: 3px;
  padding: 0.12em 0.4em;
}
.mg-prose img {
  border: 1px solid var(--hair);
  border-radius: 5px;
  margin: 1.6em 0;
  box-shadow: var(--soft-shadow);
}
.mg-prose hr { border: 0; border-top: 1px solid var(--hair); margin: 2.2em 0; }

.mg-article__foot {
  max-width: var(--measure);
  margin-top: 3rem;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
}
.mg-tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.mg-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--hair);
  border-radius: 3px;
}
.mg-back {
  display: inline-block;
  margin-top: 26px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid rgba(15, 107, 59, 0.4);
  padding-bottom: 2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.mg-back:hover { color: var(--accent-d); border-color: var(--accent-d); }
.mg-back--top { margin-top: 0; margin-bottom: 26px; }

/* ── Careers ─────────────────────────────────────────────── */
.mg-dept { padding: clamp(1.5rem, 3vw, 34px) 0; border-bottom: 1px solid var(--hair); }
.mg-dept__label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.mg-roles { list-style: none; }
.mg-role {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 15px 0;
  border-top: 1px solid var(--hair);
  transition: padding-left 0.2s ease;
}
.mg-role:first-child { border-top: 0; }
.mg-role:hover { padding-left: 10px; }
.mg-role__title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(18px, 1.6vw, 22px);
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}
.mg-role:hover .mg-role__title { color: var(--accent-d); }
.mg-role__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mg-role__arrow { color: var(--accent); transition: transform 0.2s ease; }
.mg-role:hover .mg-role__arrow { transform: translateX(4px); }

/* Application form - hairline fields, emerald accents */
.mg-apply {
  max-width: var(--measure);
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--ink);
}
.mg-apply__title {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2rem;
}
.mg-form { display: grid; gap: 20px; max-width: 34rem; }
.mg-field { display: grid; gap: 6px; }
.mg-field label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.mg-field input {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid rgba(20, 19, 18, 0.26);
  border-radius: 3px;
  padding: 11px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mg-field input::placeholder { color: #9a968c; }
.mg-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 107, 59, 0.16);
}
.mg-field input[type="file"] {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 6px 0;
}
.mg-field input[type="file"]::file-selector-button {
  margin-right: 14px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid rgba(20, 19, 18, 0.26);
  border-radius: 3px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.mg-field input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent-d);
}
.mg-submit {
  justify-self: start;
  margin-top: 6px;
  padding: 13px 26px;
  background: var(--accent);
  color: var(--paper);
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
}
.mg-submit:hover { background: var(--accent-d); }
.mg-submit:disabled { opacity: 0.55; cursor: default; }
.mg-error {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--oxblood);
}
.mg-pdf { margin-top: 26px; }
.mg-pdf a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid rgba(15, 107, 59, 0.4);
  padding-bottom: 2px;
}
.mg-pdf a:hover { color: var(--accent-d); }

/* Confirmation */
.mg-confirm { max-width: var(--measure); padding: 1rem 0; }
.mg-confirm h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.mg-confirm p {
  margin-top: 18px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
}
.mg-linkedin-embed { margin: 26px 0 6px; }
.mg-btn-linkedin {
  display: inline-block;
  margin: 20px 0;
  padding: 13px 22px;
  background: #0a66c2;
  color: #fff;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  transition: background 0.15s ease;
}
.mg-btn-linkedin:hover { background: #084f97; }

/* Visible follow block on the careers detail page (not gated behind apply). */
.mg-follow {
  max-width: var(--measure);
  margin-top: clamp(2rem, 5vw, 3rem);
  padding-top: clamp(1.6rem, 4vw, 2.2rem);
  border-top: 1px solid var(--hair);
}
.mg-follow__label {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 720px) {
  .mg-nav__links { display: none; }
  .mg-nav__burger { display: flex; }
  .mg-entry__link { grid-template-columns: 2.25rem 1fr; }
  .mg-entry__aside {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
  }
  .mg-entry__thumb { width: 40%; max-width: 180px; }
  .mg-role { grid-template-columns: 1fr auto; }
  .mg-role__meta { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .mg-head { flex-direction: column; gap: 10px; align-items: flex-start; }
  .mg-entry__aside { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mg-drawer,
  .mg-nav__burger span,
  .mg-entry__link,
  .mg-role,
  .mg-role__arrow,
  .mg-nav__link,
  .mg-back,
  .mg-submit,
  .mg-prose a { transition: none; }
}
