/* 강남 성형 지도책: a navy road-name plate and the index pages of a city street atlas. See DESIGN.md.
   Colours: Sanzo Wada #60 (Dark Tyrian Blue, Pale Lemon Yellow), lightness moves only. */
:root {
  --ground: #12354e;      /* Dark Tyrian Blue: the whole page, the plate */
  --ink: #ffefae;         /* Pale Lemon Yellow: all text, plate lines (11.07:1 on ground) */
  --dim: #d8c98a;         /* Pale Lemon Yellow L81: secondary text (7.68:1 on ground, 6.03:1 on plate) */
  --plate: #25455f;       /* Dark Tyrian Blue L28: plate face (ink on it 8.69:1) */
  --rule: #93874b;        /* Pale Lemon Yellow L56: leaders, dividers, dashed boxes (3.53:1), never text */
  --rule-faint: #73692f;  /* Pale Lemon Yellow L44: table row lines, never text */
  --band: #ffefae;        /* the reversed plate: footer band, table heads */
  --on-band: #12354e;     /* 11.07:1 on band */
  --on-band-dim: #34536e; /* Dark Tyrian Blue L34: 6.98:1 on band */

  --font-display: "Hahmlet", "Noto Serif KR", "Nanum Myeongjo", AppleMyungjo, Batang, serif;
  --font-text: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-ui: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;

  /* One spacing ladder. */
  --s1: 0.375rem;
  --s2: 0.75rem;
  --s3: 1.25rem;
  --s4: 2rem;
  --s5: 3.25rem;
  --s6: 5.25rem;

  /* A sign's type ladder: close steps for reading, one loud step on the front plate. */
  --t-tag: 0.8125rem;
  --t-index: 0.9375rem;
  --t-body: clamp(1.0625rem, 1rem + 0.25vw, 1.125rem);
  --t-lead: clamp(1.125rem, 1.05rem + 0.4vw, 1.25rem);
  --t-section: clamp(1.3125rem, 1.2rem + 0.5vw, 1.5rem);
  --t-title: clamp(1.875rem, 1.35rem + 2.2vw, 2.875rem);
  --t-front: clamp(2.5rem, 1.45rem + 4.4vw, 4.25rem);

  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --page: 76rem;
  --measure: 64ch;
  --index-width: 60rem;
  --plate-inset: 0.375rem;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: var(--s3); }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 400 var(--t-body)/1.85 var(--font-text);
  word-break: keep-all;
  overflow-wrap: break-word;
  font-kerning: normal;
}
::selection { background: var(--ink); color: var(--ground); }

a { color: inherit; text-decoration-line: underline; text-decoration-color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 0.24em; }
a:hover { background: var(--ink); color: var(--ground); text-decoration-color: transparent; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
time, .row-meta, .dateline { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- the road plate
   A plate face one step lighter than the ground, a line set in from its edge, as on a road-name sign. */
.plate { position: relative; background: var(--plate); border-radius: 7px; }
.plate::before {
  content: "";
  position: absolute;
  inset: var(--plate-inset);
  border: 2px solid var(--ink);
  border-radius: 4px;
  pointer-events: none;
}

/* Site head: after <main> in the document, first on screen. Name panel | places panel, as a plate's name and number panels. */
.masthead {
  order: -1;
  display: flex;
  align-items: stretch;
  width: min(100% - 2 * var(--gutter), var(--page));
  margin: var(--s3) auto 0;
}
.wordmark {
  flex: none;
  display: flex;
  align-items: center;
  padding: var(--s3) var(--s4);
  font: 700 1.3125rem/1.2 var(--font-display);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark:hover { background: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); }
.places {
  flex: 1;
  display: flex;
  align-items: center;
  margin-block: var(--plate-inset);
  padding: var(--s1) var(--s3);
  border-left: 2px solid var(--ink);
}
.places ul { display: flex; flex-wrap: wrap; gap: 0 var(--s1); margin: 0; padding: 0; list-style: none; }
.places a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--s2);
  font: 700 0.9375rem/1.3 var(--font-ui);
  text-decoration: none;
  border-radius: 3px;
}
.places a[aria-current] { background: var(--ink); color: var(--plate); }

/* On the front page the big plate carries the name; the head is only the row of places. */
.front-page .masthead { background: none; justify-content: flex-end; }
.front-page .masthead::before { content: none; }
.front-page .places { flex: none; margin: 0; padding: 0; border: 0; }
.front-page .places ul { justify-content: flex-end; }

main {
  flex: 1;
  width: min(100% - 2 * var(--gutter), var(--page));
  margin: 0 auto;
  padding: var(--s5) 0 var(--s6);
}

/* ---------------------------------------------------------------- headings and heads */
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--t-title); line-height: 1.24; letter-spacing: -0.025em; margin: 0 0 var(--s3); max-width: 20em; }
.standfirst { font-size: var(--t-lead); line-height: 1.65; max-width: 36em; margin: 0 0 var(--s3); text-wrap: pretty; }
.dateline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s3);
  margin: 0;
  font: 400 0.875rem/1.4 var(--font-ui);
  color: var(--dim);
}

/* A place name on a small plate. The box is 44px tall for a thumb; the drawn plate sits inside it. */
.tag {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  font: 700 var(--t-tag)/1.3 var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  min-width: 2.75rem;
  justify-content: center;
}
.tag::before {
  content: "";
  position: absolute;
  inset: 0.5rem 0;
  z-index: -1;
  background: var(--plate);
  border: 1px solid var(--ink);
  border-radius: 3px;
}
.tag:hover { background: none; color: var(--ground); }
.tag:hover::before { background: var(--ink); }
.tag-lg { font: 700 1.0625rem/1.3 var(--font-display); padding: 0 0.85rem; min-height: 3rem; }
.tag-lg::before { inset: 0.25rem 0; border-width: 2px; }

/* ---------------------------------------------------------------- article */
.piece-head { margin-bottom: var(--s4); }
.piece-head .dateline { margin-top: var(--s2); }
.plain .piece-head { margin-bottom: var(--s4); }

.contents { max-width: 34rem; margin: 0 0 var(--s5); padding: var(--s3) var(--s4) var(--s3); }
.contents-name { margin: var(--s1) 0 var(--s1); font: 700 1rem/1.4 var(--font-display); }
.contents ol { margin: 0; padding: 0 0 var(--s1) 1.4rem; font: 400 var(--t-index)/1.45 var(--font-ui); }
.contents li::marker { color: var(--dim); font-variant-numeric: tabular-nums; }
.contents a { display: block; padding: 0.3rem 0; text-decoration: none; }

.prose { max-width: var(--measure); }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.1em; }
.prose p { text-wrap: pretty; }
.prose h2 { font-size: var(--t-section); line-height: 1.35; letter-spacing: -0.015em; margin-top: 2.4em; }
.prose h3 { font-size: 1.1875rem; line-height: 1.4; margin-top: 2em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--dim); }
.prose strong { font-weight: 700; }
.prose hr { border: 0; border-top: 2px dotted var(--rule); margin-block: var(--s4); }
.prose img { max-width: 100%; height: auto; }
/* A clinic's own words, set apart in a dashed box with no plate face: a clinic's sentence must not look like a public sign. */
.prose blockquote { margin-inline: 0; padding: var(--s2) var(--s3); border: 1px dashed var(--rule); }
.prose blockquote > * { margin: 0; }
.prose blockquote > * + * { margin-top: 0.6em; }

/* Tables: a reversed head row, dense rows, numbers in columns. They scroll inside themselves on a phone
   and may run past the reading column into the empty margin on a wide screen. */
.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font: 400 var(--t-index)/1.5 var(--font-ui);
  font-variant-numeric: tabular-nums;
  margin-block: 1.6em;
}
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.55rem 0.85rem; min-width: 7rem; max-width: 22rem; }
.prose thead th { background: var(--band); color: var(--on-band); font-weight: 700; font-size: var(--t-tag); line-height: 1.4; vertical-align: bottom; }
.prose td { border-bottom: 1px solid var(--rule-faint); }
.prose tbody tr:last-child td { border-bottom: 2px solid var(--rule); }
.prose td a:hover { color: var(--ground); }

.questions { max-width: var(--measure); margin-top: var(--s5); }
.questions h2, .sources h2, .more h2 { font-size: var(--t-section); line-height: 1.35; margin: 0 0 var(--s2); }
.questions dl { margin: 0; }
.questions dt { font: 700 1.125rem/1.45 var(--font-display); margin-top: var(--s3); }
.questions dd { margin: var(--s1) 0 0; }

/* ---------------------------------------------------------------- atlas index rows
   Title, a dotted leader that starts right after the title's last word, and the date (or the day a source was
   read) in its own column at the right. The dots are a zero-width inline box clipped at the title column's edge,
   so they never push the title onto another line. */
.index { list-style: none; margin: 0; padding: 0; max-width: var(--index-width); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s2); align-items: end; align-items: last baseline; }
.row + .row { margin-top: var(--s1); }
.row-title { overflow: hidden; margin-inline: -4px; padding: 0.35rem 4px; font: 400 1.0625rem/1.5 var(--font-text); text-decoration: none; }
.row-title::after {
  content: "\00a0\00a0. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .";
  display: inline-block;
  width: 0;
  white-space: nowrap;
  color: var(--rule);
  font-weight: 700;
  letter-spacing: 0.06em;
  pointer-events: none;
}
a.row-title:hover { background: none; color: var(--ink); text-decoration: underline; text-decoration-color: var(--ink); }
.row-title a:hover { color: var(--ground); }
.row-meta { display: inline-flex; align-items: baseline; gap: var(--s2); font: 400 0.875rem/1.5 var(--font-ui); color: var(--dim); white-space: nowrap; }
.row-meta .tag { min-height: 0; padding-block: 0.2rem; }
.row-meta .tag::before { inset: 0; }
.row-lead { grid-column: 1 / -1; max-width: var(--measure); margin: 0.1rem 0 var(--s2); font-size: var(--t-index); line-height: 1.7; color: var(--dim); }

.sources { margin-top: var(--s5); }
.sources .index { max-width: var(--index-width); }
.source .row-title { font: 400 var(--t-index)/1.55 var(--font-ui); }
.source + .source { margin-top: 0; }
.publisher { color: var(--dim); }

.more { margin-top: var(--s6); }

/* ---------------------------------------------------------------- lists of articles */
.listing-head { margin-bottom: var(--s4); }
.all { margin: var(--s4) 0 0; display: flex; flex-wrap: wrap; gap: 0 var(--s3); }
.all a { display: inline-flex; align-items: center; min-height: 2.75rem; font: 700 var(--t-index)/1.3 var(--font-ui); }

/* ---------------------------------------------------------------- front page */
.front { width: fit-content; max-width: 100%; padding: clamp(2.25rem, 5vw, 3.75rem) clamp(1.75rem, 5vw, 4rem); }
.front h1 { font-size: var(--t-front); line-height: 1.12; letter-spacing: -0.03em; margin: 0; max-width: none; }
.front-tagline { margin: var(--s3) 0 0; max-width: 40em; font-size: var(--t-lead); line-height: 1.6; }
.front-note { max-width: var(--measure); margin: var(--s4) 0 0; color: var(--dim); }

.newest { margin-top: var(--s6); max-width: 52rem; }
.index-head { margin: 0 0 var(--s2); font: 700 0.875rem/1.4 var(--font-ui); color: var(--dim); }
.newest-title { margin: 0; font: 700 clamp(1.5rem, 1.15rem + 1.5vw, 2.25rem)/1.3 var(--font-display); letter-spacing: -0.02em; text-wrap: balance; }
.newest-title a { text-decoration: none; }
.newest-lead { max-width: 36em; margin: var(--s2) 0 var(--s2); font-size: var(--t-lead); line-height: 1.65; text-wrap: pretty; }

.sheets { margin-top: var(--s6); display: grid; gap: var(--s5) var(--s5); }
.sheet-head { margin: 0 0 var(--s2); }
.sheet-intro { margin: 0 0 var(--s2); max-width: 34em; font-size: var(--t-index); line-height: 1.7; color: var(--dim); }
.sheet .row-title { font-size: 1rem; }
.sheet-more { margin: var(--s2) 0 0; }
.sheet-more a { display: inline-flex; align-items: center; min-height: 2.75rem; font: 700 var(--t-index)/1.3 var(--font-ui); }

/* ---------------------------------------------------------------- footer: the reversed plate */
.band { background: var(--band); color: var(--on-band); }
.band-inner { width: min(100% - 2 * var(--gutter), var(--page)); margin: 0 auto; padding: var(--s5) 0 var(--s5); }
.band-name { margin: 0 0 var(--s1); font: 700 1.3125rem/1.2 var(--font-display); letter-spacing: -0.02em; }
.band-note { margin: 0 0 var(--s2); max-width: var(--measure); font: 400 var(--t-index)/1.6 var(--font-ui); color: var(--on-band-dim); }
.band ul { display: flex; flex-wrap: wrap; gap: 0 var(--s1); margin: 0 0 0 -0.6rem; padding: 0; list-style: none; font: 700 var(--t-index)/1.3 var(--font-ui); }
.band a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.6rem; text-decoration-color: var(--on-band); }
.band a:hover { background: var(--on-band); color: var(--band); }
.band :focus-visible { outline-color: var(--on-band); }

/* ---------------------------------------------------------------- widths */
@media (min-width: 56rem) {
  .sheets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* A table may use the empty margin to the right of the reading column. */
  .prose table { max-width: min(var(--page), 100vw - 2 * var(--gutter) - 1rem); }
}

@media (max-width: 40rem) {
  main { padding-top: var(--s4); }
  .masthead { flex-direction: column; margin-top: var(--s2); }
  .wordmark { padding: var(--s3) var(--s3) var(--s2); }
  .places { margin: 0 var(--plate-inset) var(--plate-inset); padding: var(--s1) var(--s1); border-left: 0; border-top: 2px solid var(--ink); }
  .places ul { gap: 0; }
  .places a { min-width: 2.75rem; padding: 0 0.55rem; font-size: 0.875rem; }
  .front-page .masthead { margin-top: var(--s1); }
  .front-page .places { margin: 0; padding: 0; border: 0; }
  .front-page .places ul { justify-content: flex-start; margin-left: -0.55rem; }
  .front { padding: var(--s4) var(--s3) var(--s4) calc(var(--s3) + 0.25rem); }
  /* The leader folds away on a phone; the date drops under the title. */
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-title { min-height: 2.75rem; padding-block: 0.7rem 0.5rem; }
  .row + .row { margin-top: var(--s1); }
  .contents a { display: flex; align-items: center; min-height: 2.75rem; padding: 0.35rem 0; }
  .all a, .sheet-more a { min-width: 2.75rem; }
  .row-title::after { content: none; }
  .row-meta { min-height: 1.75rem; align-items: center; }
  .row-meta .tag { min-height: 2.75rem; padding-block: 0; }
  .row-meta .tag::before { inset: 0.5rem 0; }
  .source + .source { margin-top: var(--s1); }
  .prose th, .prose td { min-width: 8rem; }
}

@media print {
  :root { --ground: #fff; --ink: #12354e; --dim: #34536e; --plate: #fff; --rule: #34536e; --rule-faint: #b9c4cc; --band: #fff; --on-band: #12354e; --on-band-dim: #34536e; color-scheme: light; }
  .masthead, .more, .band ul, .all { display: none; }
  .prose thead th { border-bottom: 2px solid #12354e; }
  a { text-decoration: none; }
}
