/* Visilogia blog stylesheet. One token set, two typefaces (serif body, mono for labels and code),
   light and dark via prefers-color-scheme. No JavaScript. */

:root {
  --ground:      #F5F7F9;
  --surface:     #FFFFFF;
  --surface-alt: #EDF0F4;
  --ink:         #151A21;
  --ink-soft:    #3D4854;
  --muted:       #64707F;
  --rule:        #D9DFE6;
  --rule-soft:   #E7EBF0;
  --accent:      #9A5F26;
  --accent-dim:  #B98E5E;
  --held:        #35705F;   /* semantic: "what we do" labels only */
  --drifted:     #A2413A;   /* semantic: "what it looks like" labels only */
  --code-bg:     #ECEFF3;

  --f-body: Charter, "Bitstream Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 68ch;
  --s1: .35rem; --s2: .7rem; --s3: 1.1rem; --s4: 1.8rem;
  --s5: 2.8rem; --s6: 4.2rem; --s7: 6rem;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:      #0E1218;
    --surface:     #151A22;
    --surface-alt: #1B222C;
    --ink:         #E3E8EE;
    --ink-soft:    #BAC4D0;
    --muted:       #8492A2;
    --rule:        #262F3B;
    --rule-soft:   #1E2630;
    --accent:      #D69A5C;
    --accent-dim:  #8A6740;
    --held:        #5FA891;
    --drifted:     #DE8478;
    --code-bg:     #1B222C;
  }
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0 var(--s3) var(--s7);
}

/* ---- site chrome ---- */
.site-header {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-family: var(--f-mono);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--accent); }

.site-footer {
  max-width: var(--measure);
  margin: var(--s7) auto 0;
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: .74rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }

.wrap { max-width: var(--measure); margin: 0 auto; padding-top: var(--s5); }

/* ---- cover ---- */
.cover { margin: 0 0 var(--s5); }
.cover svg, .cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}
.cover svg {
  --cv-surface: var(--surface);
  --cv-ink:     var(--ink);
  --cv-rule:    var(--rule);
  --cv-trunk:   var(--muted);
  --cv-spec:    var(--ink-soft);
  --cv-code:    var(--accent);
  --cv-muted:   var(--muted);
}

/* ---- inline figures ---- */
.figure { margin: var(--s4) 0; }
.figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.figure figcaption {
  font-family: var(--f-mono);
  font-size: .74rem;
  color: var(--muted);
  margin-top: var(--s2);
}

/* ---- masthead ---- */
.masthead { margin-bottom: var(--s6); }

.kicker {
  font-family: var(--f-mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 var(--s3);
}

h1 {
  font-weight: 700;
  font-size: clamp(2.3rem, 7vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -.02em;
  text-wrap: balance;
  margin: 0 0 var(--s3);
}

.standfirst {
  font-size: clamp(1.15rem, 2.6vw, 1.35rem);
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 var(--s4);
  text-wrap: pretty;
}

.byline {
  font-family: var(--f-mono);
  font-size: .74rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: var(--s3);
  margin: 0;
}

/* ---- article structure ---- */
h2 {
  font-weight: 700;
  font-size: clamp(1.55rem, 4vw, 1.95rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  text-wrap: balance;
  margin: var(--s6) 0 var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 2px solid var(--rule);
}

h3 {
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.35;
  margin: var(--s4) 0 var(--s2);
  text-wrap: balance;
}
h3 .type-name { color: var(--accent); }

p { margin: 0 0 var(--s3); text-wrap: pretty; }

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

code {
  font-family: var(--f-mono);
  font-size: .855em;
  background: var(--code-bg);
  padding: .1em .34em;
  border-radius: 2px;
}

pre {
  font-family: var(--f-mono);
  font-size: .86rem;
  line-height: 1.9;
  background: var(--surface-alt);
  border-radius: var(--radius);
  padding: var(--s3);
  margin: 0 0 var(--s3);
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }

strong { font-weight: 700; }

ul, ol { margin: 0 0 var(--s3); padding-left: 1.15rem; }
li { margin-bottom: var(--s2); }
li::marker { color: var(--accent-dim); }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--s6) 0 var(--s3);
}
hr + p { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); }

blockquote {
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: var(--s3) 0;
  margin: var(--s4) 0;
}
blockquote p {
  font-size: 1.22rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
}

/* ---- drift cards: symptom and cause side by side, remedy below ---- */
.drift {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--s4);
  margin: var(--s4) 0;
}
.drift h3 { margin: 0; }
.drift p:last-child { margin-bottom: 0; }

.split { display: flex; flex-direction: column; gap: var(--s3); }
@media (min-width: 720px) {
  .split { flex-direction: row; gap: var(--s4); }
  .split > div { flex: 1; }
}

.remedy { border-top: 1px solid var(--rule-soft); padding-top: var(--s3); }

.lbl {
  display: block;
  font-family: var(--f-mono);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s1);
}
.lbl-looks { color: var(--drifted); }
.lbl-do    { color: var(--held); }

.split p, .remedy p { font-size: .97rem; margin: 0; color: var(--ink-soft); }
.remedy p { color: var(--ink); }
.remedy ul { margin: var(--s2) 0 0; padding-left: 1.05rem; }
.remedy li { font-size: .94rem; line-height: 1.55; color: var(--ink-soft); margin-bottom: var(--s1); }
.remedy li:last-child { margin-bottom: 0; }

/* content that follows the remedy inside a card: a code block, a table, more prose */
.extra { border-top: 1px solid var(--rule-soft); padding-top: var(--s3); }
.extra p { font-size: .97rem; color: var(--ink-soft); margin: 0 0 var(--s2); }
.extra p:last-child, .extra pre:last-child, .extra .scroll:last-child { margin-bottom: 0; }
.extra .scroll { margin: var(--s2) 0 0; }

/* ---- tables ---- */
.scroll { overflow-x: auto; margin: 0 0 var(--s4); }

table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td {
  text-align: left;
  padding: var(--s2) var(--s3) var(--s2) 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
th {
  font-family: var(--f-mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  border-bottom-color: var(--rule);
}
td:first-child { white-space: nowrap; }
td:first-child strong { color: var(--accent); }
td:last-child { color: var(--ink-soft); }

/* ---- home page list ---- */
.list-title {
  font-size: clamp(1.55rem, 4vw, 1.95rem);
  line-height: 1.15;
  margin: 0 0 var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 2px solid var(--rule);
}
.posts { list-style: none; padding: 0; margin: 0; }
.posts li { padding: var(--s3) 0; border-bottom: 1px solid var(--rule-soft); margin: 0; }
.posts h3 { margin: 0 0 var(--s1); }
.posts h3 a { color: var(--ink); text-decoration: none; }
.posts h3 a:hover { color: var(--accent); text-decoration: underline; }
.posts p { margin: 0 0 var(--s1); color: var(--ink-soft); }
.posts .meta { font-family: var(--f-mono); font-size: .74rem; color: var(--muted); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
