/* Law Student Toolkit — Petrol & Citron
   Tokens first; components take every colour from them, so dark mode is one block. */

:root {
  color-scheme: light;

  --paper:      #F2F5F4;
  --surface:    #FFFFFF;
  --surface-2:  #E9EEEC;
  --ink:        #0E2F35;   /* deep petrol: header, primary buttons, headings */
  --ink-2:      #15464D;
  --text:       #17242A;
  --muted:      #596C72;
  --line:       #D9E2E0;
  --line-2:     #C3D0CD;
  --accent:     #C98A12;   /* citron: one accent, used sparingly */
  --accent-soft:#F6EBD2;
  --sage:       #6FA598;
  --shadow:     0 1px 2px rgba(14, 47, 53, .05), 0 8px 24px -16px rgba(14, 47, 53, .35);
  --shadow-lift:0 2px 6px rgba(14, 47, 53, .07), 0 18px 40px -22px rgba(14, 47, 53, .45);

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --wrap: 68rem;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper:      #0A1517;
    --surface:    #0F2126;
    --surface-2:  #163137;
    --ink:        #CFE3DF;
    --ink-2:      #A9CCC6;
    --text:       #E5EDEB;
    --muted:      #9AB0B3;
    --line:       #1D383E;
    --line-2:     #2A4A51;
    --accent:     #E8B54A;
    --accent-soft:#25313A;
    --sage:       #77B0A2;
    --shadow:     0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -20px rgba(0, 0, 0, .8);
    --shadow-lift:0 2px 8px rgba(0, 0, 0, .5), 0 20px 46px -24px rgba(0, 0, 0, .9);
  }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--body);
  font-synthesis-weight: none;
}

img { max-width: 100%; height: auto; }

a { color: var(--ink-2); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  text-wrap: balance;
  margin: 2.2rem 0 .6rem;
}
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); margin-top: 0; letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 1.2rem + .9vw, 1.85rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; font-family: var(--body); font-weight: 700; letter-spacing: .01em; }
p, ul, ol, table { margin: 0 0 1rem; }
li { margin-bottom: .35rem; }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.eyebrow {
  font: 500 .72rem/1.4 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .5rem;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 1.2rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand .mark { flex: none; }
.brand b { font: 600 1.06rem/1 var(--display); letter-spacing: .01em; }
.brand span { display: block; font: 500 .68rem/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; gap: .3rem; align-items: center; }
.nav a {
  padding: .45rem .7rem;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: "";
  display: block;
  height: 2px;
  margin-top: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.nav-toggle { display: none; }

@media (max-width: 640px) {
  .site-header .wrap { flex-wrap: wrap; min-height: 56px; padding-block: 8px; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 6px; padding: .4rem .6rem; color: var(--ink);
    font: 500 .8rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
  }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
  .nav.open { display: flex; }
  .nav a { padding: .6rem .5rem; }
  .nav a[aria-current="page"]::after { display: none; }
  .nav a[aria-current="page"] { background: var(--surface-2); }
}

/* ---------- hero ---------- */
.hero { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem) 1rem; }
.hero h1 { max-width: 22ch; }
.hero .lede {
  font-size: clamp(1.05rem, 1rem + .4vw, 1.3rem);
  color: var(--muted);
  max-width: 58ch;
  margin-bottom: 1.6rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; }

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: .97rem;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { color: var(--paper); box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { color: var(--ink); background: var(--surface); }

/* ---------- cards ---------- */
.section { padding-block: 1.5rem 2.5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .92rem; font-weight: 500; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.card h3 { margin: 0; font-size: 1.3rem; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card p { margin: 0; color: var(--muted); }
/* footnote-style marker, the way a citation numbers its sources */
.card .marker {
  position: absolute;
  top: .9rem; right: 1.1rem;
  font: 500 .78rem/1 var(--mono);
  color: var(--accent);
}
.card .marker::before { content: "["; opacity: .5; }
.card .marker::after { content: "]"; opacity: .5; }
.card .card-meta { margin-top: auto; padding-top: .9rem; font: 500 .74rem/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card ul { margin: .2rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: .96rem; }
.card .links { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .4rem; font-weight: 500; }

/* ---------- page + article ---------- */
.page { padding-block: 2.5rem 3.5rem; }
.page-head { margin-bottom: 1.8rem; }
.page-head h1 { margin-bottom: .4rem; }
.page-head .lede { color: var(--muted); max-width: 62ch; font-size: 1.08rem; margin: 0; }
.prose { max-width: 42rem; }
.prose > h2 { padding-top: .6rem; border-top: 1px solid var(--line); }
.prose > h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.prose table th, .prose table td { padding: .6rem .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose table th { background: var(--surface-2); font: 600 .82rem/1.4 var(--body); letter-spacing: .02em; color: var(--ink); }
.prose table tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; margin-bottom: 1.2rem; }
.prose blockquote {
  margin: 1.4rem 0;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--sage);
  border-radius: var(--radius);
  color: var(--text);
}
.prose blockquote.callout { border-left-color: var(--accent); background: var(--accent-soft); }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.meta { display: block; margin-top: .3rem; font: 500 .74rem/1.5 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* download / read links under a guide */
.filelinks { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0 0; }

/* ---------- guide layout with contents ---------- */
.guide { display: grid; gap: 2.5rem; grid-template-columns: minmax(0, 1fr); padding-block: 2.5rem 4rem; }
@media (min-width: 62rem) {
  .guide { grid-template-columns: 15rem minmax(0, 1fr); gap: 3rem; align-items: start; }
  .toc { position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow-y: auto; }
}
.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.toc h2 { font: 500 .72rem/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 0 0 .6rem; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: .32rem 0 .32rem .9rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
  text-decoration: none;
}
.toc a:hover { color: var(--ink); border-left-color: var(--line-2); }
.toc a.active { color: var(--ink); border-left-color: var(--accent); font-weight: 500; }
/* Desktop: a plain sticky list. Narrow: the same list, collapsible. */
@media (min-width: 62rem) {
  .toc summary { display: none; }
}
@media (max-width: 61.99rem) {
  .toc h2 { display: none; }
  .toc details { margin: 0; }
  .toc summary {
    cursor: pointer;
    font: 500 .78rem/1.4 var(--mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .toc details[open] summary { margin-bottom: .6rem; }
  .toc ol { max-height: 50vh; overflow-y: auto; }
}
.guide .prose h2 { scroll-margin-top: 84px; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: 2rem 2.5rem;
  margin-top: 2rem;
  color: var(--muted);
  font-size: .93rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.site-footer p { margin: 0; max-width: 46ch; }
.site-footer .foot-links { display: flex; gap: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
html { scroll-behavior: smooth; }

/* ---------- embedded LinkedIn posts ---------- */
.embeds {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  margin: 1.2rem 0 1.5rem;
}
.li-embed {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.li-embed iframe {
  display: block;
  width: 100%;
  height: 34rem;
  border: 0;
  background: var(--surface);
}
.li-embed figcaption {
  padding: .8rem 1rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.5;
}
/* The About page runs wider than a reading column so three posts sit side by side. */
.page.about .prose { max-width: 58rem; }
