/* ---------------------------------------------------------------
   mundayadan.com
   Direction: Blueprint. A technical, monospaced document set on a
   faint drafting grid. The dark theme is the same layout in the
   warm terminal palette.
   One stylesheet. No frameworks, no build step, no webfonts.
   --------------------------------------------------------------- */

/* ---------- tokens: light, the Blueprint palette ---------- */

:root {
  --bg:      #f3f6f8;
  --panel:   #e8eef2;
  --ink:     #12232e;
  --ink-2:   #3c525f;
  --ink-3:   #63788a;
  --rule:    #cbd8e0;
  --rule-2:  #dde7ed;
  --chip:    #cbd8e0;
  --accent:  #1d6fa5;
  --marker:  #a5b8c4;
  --grid:    rgba(29, 111, 165, .07);
  --panel-glass: rgba(255, 255, 255, .6);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
          "Liberation Mono", "Courier New", monospace;

  --measure: 74ch;
  --page:    58rem;
}

/* ---------- tokens: dark, the terminal palette ---------- */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:      #0e100f;
    --panel:   #131614;
    --ink:     #eef2ec;
    --ink-2:   #a8b0a6;
    --ink-3:   #7f877d;
    --rule:    #232724;
    --rule-2:  #1c201d;
    --chip:    #2c312c;
    --accent:  #e0a458;
    --marker:  #4e554d;
    --grid:    rgba(224, 164, 88, .045);
    --panel-glass: rgba(255, 255, 255, .03);
  }
}

:root[data-theme="dark"] {
  --bg:      #0e100f;
  --panel:   #131614;
  --ink:     #eef2ec;
  --ink-2:   #a8b0a6;
  --ink-3:   #7f877d;
  --rule:    #232724;
  --rule-2:  #1c201d;
  --chip:    #2c312c;
  --accent:  #e0a458;
  --marker:  #4e554d;
  --grid:    rgba(224, 164, 88, .045);
  --panel-glass: rgba(255, 255, 255, .03);
}

/* ---------- reset ---------- */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(0deg,  var(--grid) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, var(--grid) 0 1px, transparent 1px 28px);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- layout ---------- */

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 1.8rem 5rem;
}

@media (max-width: 46rem) {
  .page { padding: 0 1.3rem 3.5rem; }
}

section { scroll-margin-top: 3rem; }

/* ---------- typography ---------- */

h1, h2, h3 {
  font-weight: 400;
  margin: 0;
  letter-spacing: -.01em;
  color: var(--ink);
  text-wrap: balance;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--chip);
  transition: border-color .16s ease, color .16s ease;
}

a:hover { border-bottom-color: var(--accent); }

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

::selection { background: var(--accent); color: var(--bg); }

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--rule);
}

.masthead .mark {
  font-size: 12.5px;
  color: var(--ink);
  border-bottom: 0;
  letter-spacing: .02em;
}

.masthead .mark::before { content: "~/ "; color: var(--accent); }
.masthead .mark:hover { color: var(--accent); }

.masthead nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.masthead nav a {
  font-size: 12.5px;
  color: var(--ink-3);
  border-bottom: 0;
}

.masthead nav a::before { content: "\00b7 "; color: var(--marker); }
.masthead nav a:hover { color: var(--accent); }

/* theme toggle, drawn as a small technical switch */
.toggle {
  appearance: none;
  background: none;
  border: 1px solid var(--chip);
  border-radius: 3px;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  cursor: pointer;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  transition: border-color .16s ease, color .16s ease;
}

.toggle:hover { color: var(--accent); border-color: var(--accent); }
.toggle svg { width: .8rem; height: .8rem; display: block; }

/* ---------- opening ---------- */

.opening {
  padding: 5rem 0 3.5rem;
  border-bottom: 1px solid var(--rule);
}

@media (max-width: 46rem) {
  .opening { padding: 3rem 0 2.5rem; }
}

.opening h1 {
  font-size: clamp(2.1rem, 6.2vw, 3.7rem);
  line-height: 1.08;
  letter-spacing: -.03em;
  margin-bottom: 1.8rem;
}

.opening h1 .given { display: block; }
.opening h1 .given::before { content: "> "; color: var(--accent); }
.opening h1 .family { display: block; color: var(--ink-3); padding-left: 1.2ch; }

.standfirst {
  max-width: 62ch;
  color: var(--ink-2);
  margin-bottom: 2rem;
}

.standfirst strong { font-weight: 400; color: var(--accent); }

.whereabouts {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 0;
}

.label {
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-3);
  border: 1px solid var(--chip);
  background: var(--panel-glass);
  padding: .2rem .6rem;
  border-radius: 3px;
}

/* ---------- section headings ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: 3.6rem 0 1.4rem;
}

.section-head h2 { font-size: 1.15rem; }
.section-head h2::before { content: "## "; color: var(--marker); }

/* ---------- prose ---------- */

.prose {
  max-width: var(--measure);
  color: var(--ink-2);
}

/* ---------- the role panel ---------- */

.entry {
  position: relative;
  margin-top: 2rem;
  padding: 1.4rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
}

/* corner ticks, the drafting detail */
.entry::before,
.entry::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid var(--accent);
}

.entry::before { top: -4px; right: -4px; }
.entry::after  { bottom: -4px; right: -4px; }

.entry .years {
  font-size: 12px;
  color: var(--accent);
  letter-spacing: .04em;
  margin-bottom: .5rem;
}

.entry .years::before { content: "["; }
.entry .years::after  { content: "]"; }

.entry h3 { font-size: 1.05rem; margin-bottom: .1rem; }

.entry .org {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: .9rem;
}

.entry p { max-width: var(--measure); color: var(--ink-2); }

/* ---------- key and value rows ---------- */

.rows {
  margin-top: 1.6rem;
  border-top: 1px solid var(--rule);
}

.row {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--rule-2);
}

.row .k {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .04em;
}

.row .v { color: var(--ink); }
.row .v small { color: var(--ink-3); }

@media (max-width: 46rem) {
  .row { grid-template-columns: 1fr; gap: .2rem; }
}

/* ---------- writing index ---------- */

.posts { border-top: 1px solid var(--rule); }

.post-link {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 0 1.5rem;
  padding: 1.3rem 1rem;
  margin: 0 -1rem;
  border-bottom: 1px solid var(--rule-2);
  border-left: 0;
  color: inherit;
  transition: background-color .18s ease;
}

.post-link:hover { background: var(--panel); border-bottom-color: var(--rule-2); }
.post-link:hover h3 { color: var(--accent); }

.post-link time {
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  padding-top: .18em;
}

.post-link time::before { content: "["; }
.post-link time::after  { content: "]"; }

.post-link h3 { font-size: 1.02rem; margin-bottom: .2rem; transition: color .16s ease; }
.post-link p { color: var(--ink-3); font-size: 13px; margin: 0; max-width: var(--measure); }

@media (max-width: 46rem) {
  .post-link { grid-template-columns: 1fr; gap: .3rem; }
  .post-link time { padding-top: 0; }
}

/* ---------- article ---------- */

.article { padding: 4rem 0 0; }

.article > header {
  padding-bottom: 2.2rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--rule);
}

.article h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -.02em;
  max-width: 32ch;
  margin-bottom: .9rem;
}

.article h1::before { content: "# "; color: var(--marker); }

.article .meta {
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .04em;
  margin: 0;
}

.article .content {
  max-width: var(--measure);
  line-height: 1.85;
}

.article .content p { margin-bottom: 1.35em; }

.article .content h2 {
  font-size: 1.05rem;
  margin: 2.6rem 0 1rem;
}

.article .content h2::before { content: "## "; color: var(--marker); }

.article .content blockquote {
  position: relative;
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
}

.article .footer-link {
  margin-top: 3.2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  font-size: 12.5px;
}

/* ---------- footer ---------- */

.colophon {
  margin-top: 4rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-3);
}

.colophon a { border-bottom-color: var(--rule); }

/* ---------- motion ---------- */

.rise {
  opacity: 0;
  transform: translateY(10px);
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) forwards;
}

.rise:nth-child(1) { animation-delay: .04s; }
.rise:nth-child(2) { animation-delay: .14s; }
.rise:nth-child(3) { animation-delay: .24s; }

@keyframes rise { to { opacity: 1; transform: none; } }

/* hidden only when JavaScript is present to bring it back */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
}

.js .reveal.seen { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .rise, .js .reveal {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- print ---------- */

@media print {
  :root {
    --bg: #fff; --panel: #fff; --ink: #000; --ink-2: #222;
    --ink-3: #555; --rule: #bbb; --rule-2: #ddd; --accent: #000; --grid: transparent;
  }
  body { background-image: none; }
  .toggle, .masthead nav { display: none; }
  .opening { padding: 0 0 2rem; }
  .entry::before, .entry::after { display: none; }
  a { border-bottom: 0; }
}
