/* alan.bigsy.au - paper and ink theme.
 *
 * MOBILE FIRST: every rule outside a media query is the phone layout, and the media
 * queries only ever ADD room as the screen grows. There is no max-width query in this
 * file, so nothing here is a desktop layout being patched for small screens.
 *
 * Breakpoints: 560px (small tablet), 780px (tablet/desktop), 1080px (wide).
 * Class-based media queries only. No inline styles, no !important.
 */

/* ── Tokens ── */
:root {
  --paper:     #f5f0e6;
  --paper-2:   #efe8da;
  --paper-3:   #e7ddca;
  --ink:       #14120f;
  --ink-soft:  #3f3a31;
  --muted:     #6b6455;
  --rule:      #d9cfba;
  --rule-hard: #14120f;

  --seal:      #a63a1d;
  --seal-tint: #f6e6e0;

  --sage:      #175c4a;
  --sage-tint: #e2ede8;
  --indigo:    #24386b;
  --indigo-tint: #e6ebf6;
  --ochre:     #7a4a0c;
  --ochre-tint: #f7ecd9;
  --clay:      #8f2418;
  --clay-tint: #f8e7e3;
  --slate:     #4a4a4a;
  --slate-tint: #eceae5;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius: 3px;
  --tap: 44px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background-color: var(--paper);
  /* A faint laid-paper texture, pure CSS: two hairline gradients. */
  background-image:
    repeating-linear-gradient(0deg, rgba(20, 18, 15, 0.022) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(20, 18, 15, 0.018) 0 1px, transparent 1px 4px);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0 0 1em; }

a {
  color: var(--seal);
  text-decoration: none;
  border-bottom: 1px solid rgba(166, 58, 29, 0.32);
  transition: border-color 0.15s, color 0.15s;
}
a:hover { border-bottom-color: var(--seal); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.005em;
  margin: 0 0 0.5em;
  overflow-wrap: anywhere;
}

/* A reference page carries DOIs, PMIDs and long work titles. One 37-character token
   ("doi:10.1001/jamapsychiatry.2026.0096.") set the whole page's min-content width to 357px,
   which is a horizontal scrollbar on a 320px phone. Break inside a word only when a word
   genuinely does not fit, which is what anywhere does and break-word does not promise. */
.claim, .snip, .entry-detail p, .pair-term, .pair-text, .group-note, .legend p,
.method p, .standfirst, .smallprint, .hint, .counts, blockquote.quote, blockquote.quote cite {
  overflow-wrap: anywhere;
}

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

:focus-visible {
  outline: 2px solid var(--seal);
  outline-offset: 2px;
}

/* ── Frame ── */
.wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 18px;
}

.seal-rule {
  height: 3px;
  background: var(--seal);
}

.masthead { border-bottom: 1px solid var(--rule); background: var(--paper); }

.masthead .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
  padding-top: 16px;
  padding-bottom: 14px;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.32rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  border: 0;
  margin-right: auto;
}
.wordmark span { color: var(--seal); }

.masthead nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.masthead nav a { color: var(--muted); border: 0; }
.masthead nav a:hover { color: var(--ink); }

/* ── Hero ── */
.hero { padding: 34px 0 26px; }

.hero h1 {
  font-size: 2.05rem;
  margin-bottom: 0.55em;
}
.hero h1 em {
  font-style: italic;
  color: var(--seal);
}

.hero .standfirst {
  font-size: 1.02rem;
  color: var(--ink-soft);
  max-width: 46ch;
}

.hero .counts {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin: 18px 0 0;
}

/* A wave, drawn as a background image: the motif from the favicon. */
.wave {
  height: 12px;
  margin: 22px 0 0;
  background-repeat: repeat-x;
  background-position: 0 50%;
  background-size: 44px 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='12' viewBox='0 0 44 12'%3E%3Cpath d='M0 9c5.5 0 5.5-6 11-6s5.5 6 11 6 5.5-6 11-6 5.5 6 11 6' fill='none' stroke='%23a63a1d' stroke-width='1.4' stroke-opacity='.5'/%3E%3C/svg%3E");
}

/* ── Search ── */
.searchpanel { padding: 0 0 24px; }

.field {
  display: flex;
  align-items: stretch;
  border-bottom: 2px solid var(--rule-hard);
  background: transparent;
}

.field input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--tap);
  font-family: var(--serif);
  font-size: 1.12rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 8px 0;
  -webkit-appearance: none;
  appearance: none;
}
.field input[type="search"]::placeholder { color: var(--muted); opacity: 1; }
.field input[type="search"]:focus { outline: none; }
.field:focus-within { border-bottom-color: var(--seal); }

.field .clearbtn {
  flex: 0 0 auto;
  width: var(--tap);
  min-height: var(--tap);
  font-family: var(--sans);
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.field .clearbtn:hover { color: var(--seal); }

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 10px 0 16px;
}
.hint strong { color: var(--ink); font-weight: 600; }

/* ── Filter chips: 44px targets, wrapping, one tap each ── */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.chip {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  min-height: var(--tap);
  padding: 10px 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip span { opacity: 0.72; font-weight: 500; }

/* ── Result count ── */
.count {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  padding-top: 12px;
  margin: 0 0 22px;
}

/* ── Groups ── */
.group { margin: 0 0 34px; }

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  border-top: 2px solid var(--ink);
  padding-top: 10px;
  margin-bottom: 6px;
}
.group-head h2 { font-size: 1.28rem; margin: 0; min-width: 0; }
.group-head .tally {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.group-note {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 16px;
  max-width: 52ch;
}

/* ── Entry cards ── */
.entry {
  background: #fbf8f1;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--paper-3);
  border-radius: var(--radius);
  padding: 16px 15px 15px;
  margin: 0 0 12px;
}
.entry:hover { border-left-color: var(--seal); }
.entry.is-target {
  border-left-color: var(--seal);
  background: #fffdf8;
  box-shadow: 0 0 0 1px var(--seal);
}

.entry-head { margin-bottom: 8px; }
.entry-head h3 {
  font-size: 1.1rem;
  margin: 0 0 6px;
}
.entry-head .ref {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1px 6px;
  margin-right: 8px;
  vertical-align: 2px;
}
.entry-head .ref:hover { color: var(--seal); border-color: var(--seal); }

/* Status as a stamp: hairline box, small caps, colour AND the word. */
.badge-status {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  padding: 2px 7px;
  margin: 0 6px 4px 0;
  white-space: nowrap;
}
.badge-status.s-traced    { color: var(--sage);   background: var(--sage-tint); }
.badge-status.s-peer      { color: var(--indigo); background: var(--indigo-tint); }
.badge-status.s-analysis  { color: var(--slate);  background: var(--slate-tint); }
.badge-status.s-absent    { color: var(--clay);   background: var(--clay-tint); }
.badge-status.s-secondary,
.badge-status.s-contested,
.badge-status.s-located,
.badge-status.s-open      { color: var(--ochre);  background: var(--ochre-tint); }

.claim {
  font-size: 16.5px;
  line-height: 1.6;
  margin: 0 0 10px;
}

.snip {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 10px;
}
.snip mark {
  background: #f0d9a8;
  color: var(--ink);
  padding: 0 2px;
}

/* Quotes: set in the serif, with a hanging mark, on a tinted well. */
.quote {
  margin: 12px 0;
  padding: 12px 14px;
  background: var(--paper-2);
  border-left: 2px solid var(--seal);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.58;
  overflow-wrap: anywhere;
}
.quote p { margin: 0 0 8px; }
.quote p::first-letter { }
.quote cite {
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.entry details {
  border-top: 1px solid var(--rule);
  margin-top: 12px;
  padding-top: 10px;
}
.entry details summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--seal);
  cursor: pointer;
  list-style: none;
}
.entry details summary::-webkit-details-marker { display: none; }
.entry details summary::after { content: ' +'; }
.entry details[open] summary::after { content: ' \2212'; }

.entry-detail h4 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 5px;
}
.entry-detail p { font-size: 15px; margin: 0 0 8px; }
.entry-detail p.analysis { color: var(--ink-soft); }

.pair {
  background: #fbf8f1;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.pair .pair-term { font-family: var(--serif); font-size: 1.02rem; margin: 0 0 5px; }
.pair .pair-text { font-size: 14.5px; color: var(--ink-soft); margin: 0; }

.mangle { margin-bottom: 12px; }
.mangle .wrong, .mangle .right {
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 6px;
  padding-left: 12px;
  border-left: 2px solid var(--rule);
  overflow-wrap: anywhere;
}
.mangle .wrong { border-left-color: var(--clay); }
.mangle .right { border-left-color: var(--sage); }
.mangle p span {
  display: block;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.empty {
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
}
.empty p { color: var(--muted); font-size: 15px; }
.empty .try {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.empty .try button {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  min-height: var(--tap);
  padding: 10px 14px;
  cursor: pointer;
}
.empty .try button:hover { border-color: var(--seal); color: var(--seal); }

/* ── Legend ── */
.legend { padding: 6px 0 30px; }
.legend h2 { font-size: 1.5rem; }
.legend .legend-list > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  border-top: 1px solid var(--rule);
  padding: 12px 0;
}
.legend .legend-list p {
  flex: 1 1 14ch;
  min-width: 0;
  font-size: 14.5px;
  color: var(--muted);
  margin: 0;
}

/* ── Prose (the method page) ── */
.method { padding: 6px 0 20px; }
.method h2 {
  font-size: 1.42rem;
  margin: 30px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.method p { font-size: 16.5px; max-width: 62ch; }
.method .lead { font-size: 1.06rem; color: var(--ink-soft); }
.method code {
  font-size: 0.92em;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1px 4px;
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--rule);
  padding: 22px 0 40px;
  font-size: 13px;
  color: var(--muted);
}
.footer .wordmark { font-size: 1.15rem; }
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin: 10px 0 0;
}
.footer nav a { color: var(--muted); border: 0; }
.footer nav a:hover { color: var(--ink); }
.footer .byline { margin: 14px 0 0; max-width: 56ch; }
.footer .byline img { height: 30px; width: auto; vertical-align: middle; margin-bottom: 6px; }
.footer .smallprint { font-size: 12px; margin: 12px 0 0; max-width: 62ch; }

/* ── Bootstrap's table, themed ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.method table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 10px;
}
.method table th, .method table td {
  text-align: left;
  vertical-align: top;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
}
.method table th {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: var(--ink);
  white-space: nowrap;
}

/* ── Small tablet ── */
@media (min-width: 560px) {
  .wrap { padding: 0 24px; }
  .hero { padding: 46px 0 30px; }
  .hero h1 { font-size: 2.6rem; }
  .hero .standfirst { font-size: 1.08rem; }
  .entry { padding: 20px 22px 18px; }
  .entry-head h3 { font-size: 1.2rem; }
  .claim { font-size: 17px; }
  .quote { padding: 14px 18px; margin: 14px 0; }
  .field input[type="search"] { font-size: 1.22rem; }
  .group-head h2 { font-size: 1.45rem; }
}

/* ── Tablet / desktop ── */
@media (min-width: 780px) {
  body { font-size: 17.5px; }
  .wrap { max-width: 860px; padding: 0 32px; }
  .hero h1 { font-size: 3.1rem; }
  .hero .standfirst { font-size: 1.12rem; }
  .masthead .wrap { padding-top: 20px; padding-bottom: 18px; }
  .wordmark { font-size: 1.5rem; }
  .group-head h2 { font-size: 1.6rem; }
  .group-note { font-size: 14px; }
  .entry { padding: 22px 24px 20px; margin-bottom: 14px; }
  .entry-head h3 { font-size: 1.28rem; }
  .quote { font-size: 17px; }
  .legend .legend-list > div { flex-wrap: nowrap; }
}

/* ── Wide ── */
@media (min-width: 1080px) {
  .wrap { max-width: 900px; }
  .hero h1 { font-size: 3.4rem; }
}

/* ── Print: this is a reference page, so let it print cleanly ── */
@media print {
  body { background: #fff; background-image: none; font-size: 11pt; }
  .masthead nav, .chips, .field, .hint, .count, .footer nav { display: none; }
  .entry { border: 1px solid #ccc; background: #fff; break-inside: avoid; }
  .quote { background: #fff; }
  a { color: #000; border: 0; }
}
