/* Hardly Funny: His & Hers.
   Samantha mode is soft, round and pink; Randall mode is the black T-shirt:
   monospace, square, counting from zero. Randall mode is also the dark mode and
   follows the OS until someone picks a side with the switch. Every text/ground
   pair here meets WCAG AA contrast. */

/* Self-hosted Google Fonts (SIL Open Font License 1.1), latin subset, variable weights. */
@font-face {
  font-family: "Fredoka"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url("fonts/fredoka.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito"; font-style: italic; font-weight: 400 400; font-display: swap;
  src: url("fonts/nunito-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/nunito.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --ground: #fff4fa;
  --surface: #ffffff;
  --ink: #3b2440;
  --muted: #765a7e;
  --line: #f6d3ea;
  --accent: #ff66cc;
  --accent-ink: #b1127c;
  --on-accent: #1d1020;
  --r: 28px;
  --r-sm: 999px;
  --display: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, sans-serif;
  --word-fill: #ccff99;
  --word-stroke: #669933;
  --word-shadow: 3px 3px 0 #669933;
  --note-open: "";
  --note-close: "";
  --tag-prefix: "#";
  --shadow: 0 18px 40px -18px rgba(177, 18, 124, .35);
  --scribbles-x: 0px;
  --scribbles-flip: 1;
  --samantha-only: block;
  --randall-only: none;
  --brand-flow: column;
  --brand-gap: 0px;
  --track-fill: linear-gradient(90deg, #ffd6f0 0 50%, #19191b 50%);
}

/* Randall mode: declared for the OS setting and for the switch. Keep these two blocks identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="samantha"]) {
    color-scheme: dark;
    --ground: #19191b; --surface: #222225; --ink: #e8e8ec; --muted: #9a9aa4; --line: #34343a;
    --accent: #ccff99; --accent-ink: #ccff99; --on-accent: #19191b;
    --r: 3px; --r-sm: 3px;
    --display: "JetBrains Mono", ui-monospace, monospace; --body: "JetBrains Mono", ui-monospace, monospace;
    --word-fill: #ccff99; --word-stroke: transparent; --word-shadow: 0 0 18px rgba(204, 255, 153, .25);
    --note-open: "/*"; --note-close: "*/"; --tag-prefix: "--tag=";
    --shadow: 0 0 0 1px #34343a;
    --scribbles-x: 62px; --scribbles-flip: -1;
    --samantha-only: none; --randall-only: block; --brand-flow: row; --brand-gap: 14px;
  }
}
:root[data-mode="randall"] {
  color-scheme: dark;
  --ground: #19191b; --surface: #222225; --ink: #e8e8ec; --muted: #9a9aa4; --line: #34343a;
  --accent: #ccff99; --accent-ink: #ccff99; --on-accent: #19191b;
  --r: 3px; --r-sm: 3px;
  --display: "JetBrains Mono", ui-monospace, monospace; --body: "JetBrains Mono", ui-monospace, monospace;
  --word-fill: #ccff99; --word-stroke: transparent; --word-shadow: 0 0 18px rgba(204, 255, 153, .25);
  --note-open: "/*"; --note-close: "*/"; --tag-prefix: "--tag=";
  --shadow: 0 0 0 1px #34343a;
  --scribbles-x: 62px; --scribbles-flip: -1;
  --samantha-only: none; --randall-only: block; --brand-flow: row; --brand-gap: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 17px/1.6 var(--body);
  padding-inline: 16px;
  overflow-wrap: break-word; /* long URLs in her notes must wrap on phones */
  transition: background-color .35s ease, color .35s ease;
}
a { color: var(--accent-ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { text-wrap: balance; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 10;
  background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 8px;
  font: 600 15px/1 var(--display); text-decoration: none;
}
.skip-link:focus { top: 12px; }

.wrap { max-width: 940px; margin: 0 auto; }

/* Header */
.site-header { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-block: 22px 8px; text-align: center; }
.brand { display: flex; flex-direction: var(--brand-flow); align-items: center; gap: var(--brand-gap); text-decoration: none; color: inherit; }
/* Hers: the original 2012 banner, which draws the name and tagline itself. His: the couple and a wordmark. */
.brand .banner { display: var(--samantha-only); width: min(100%, 760px); height: auto; }
.brand .couple { display: var(--randall-only); width: 84px; height: auto; border-radius: var(--r); }
.brand-text { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:root[data-mode="randall"] .brand-text { position: static; width: auto; height: auto; margin: 0; padding: 0; overflow: visible; clip: auto; white-space: normal; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="samantha"]) .brand-text { position: static; width: auto; height: auto; margin: 0; padding: 0; overflow: visible; clip: auto; white-space: normal; }
}
.wordmark {
  display: block; margin: 0;
  font: 700 clamp(30px, 6vw, 44px)/1 var(--display);
  color: var(--word-fill);
  -webkit-text-stroke: 2px var(--word-stroke);
  paint-order: stroke fill;
  text-shadow: var(--word-shadow);
  letter-spacing: -.01em;
}
.tagline { display: block; margin: 4px 0 0; color: var(--muted); font: 400 14px/1.4 var(--body); }

.switch { display: grid; justify-items: center; gap: 6px; }
.switch-row { display: flex; align-items: center; gap: 10px; font: 600 14px/1 var(--display); }
.switch-row span { color: var(--muted); transition: color .3s; }
.switch-row span.on { color: var(--ink); }
.track {
  position: relative; width: 132px; height: 50px; padding: 0; cursor: pointer; overflow: hidden;
  border: 2px solid var(--ink); border-radius: 999px; background: var(--track-fill);
  transition: border-color .35s;
}
.track img {
  position: absolute; top: 4px; left: 8px; width: 54px; height: auto;
  transform: translateX(var(--scribbles-x)) scaleX(var(--scribbles-flip));
  transition: transform .6s cubic-bezier(.5, -0.3, .3, 1.4);
}
.switch-hint { font-size: 12px; color: var(--muted); }
.no-js .switch { display: none; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }
.site-nav a { font: 600 15px/1 var(--display); color: var(--muted); text-decoration: none; padding: 0 4px; min-height: 44px; display: inline-flex; align-items: center; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

main { padding-block: 16px 40px; }

/* Comic */
.intro { text-align: center; color: var(--muted); margin: 10px auto 0; max-width: 56ch; }
.comic-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin: 18px 0 12px; }
.comic-title { font: 600 clamp(26px, 5vw, 34px)/1.15 var(--display); margin: 0; }
.comic-title a { color: inherit; text-decoration: none; }
.comic-title a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.stamp { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; margin: 0; }
.eyebrow { display: block; font: 600 13px/1.2 var(--display); color: var(--accent-ink); letter-spacing: .02em; margin-bottom: 4px; }

.comic-art {
  margin: 0; background: var(--surface); border-radius: var(--r); padding: clamp(10px, 2.5vw, 20px);
  box-shadow: var(--shadow); display: grid; gap: 12px; justify-items: center;
  transition: border-radius .35s, box-shadow .35s, background .35s;
}
.comic-art img { display: block; border-radius: calc(var(--r) * .45); background: #fff; }

.comic-nav ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.button {
  display: inline-flex; align-items: center; min-height: 44px; font: 600 16px/1 var(--display); color: var(--ink); text-decoration: none; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 18px; transition: border-color .15s, background .35s, border-radius .35s;
}
.button:hover { border-color: var(--accent); }
.button[aria-disabled="true"] { opacity: .45; cursor: default; }
.button[aria-disabled="true"]:hover { border-color: var(--line); }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Transcript */
.transcript { margin: 18px auto 0; max-width: 660px; }
.transcript summary {
  cursor: pointer; font: 600 15px/1.4 var(--display); color: var(--accent-ink);
  padding: 11px 0; min-height: 44px; list-style-position: inside;
}
.transcript summary h2 { display: inline; font: inherit; margin: 0; }
.transcript ol { list-style: none; margin: 6px 0 0; padding: 14px 18px; background: var(--surface); border-radius: calc(var(--r) * .6); box-shadow: var(--shadow); }
.transcript li { margin: 0 0 6px; }
.transcript li.direction { color: var(--muted); font-style: italic; }
.transcript li b { font-weight: 700; }

/* Samantha's note */
.note { margin: 30px auto 0; max-width: 660px; display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: start; }
.note .who { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; object-position: 12% 20%; background: #ffd6f0; border: 2px solid var(--line); }
.bubble { position: relative; background: var(--surface); border-radius: var(--r); padding: 16px 20px; box-shadow: var(--shadow); transition: border-radius .35s; }
.bubble::before { content: ""; position: absolute; left: -9px; top: 20px; width: 18px; height: 18px; background: var(--surface); transform: rotate(45deg); border-radius: 3px; }
.bubble h2 { font: 600 15px/1.2 var(--display); color: var(--accent-ink); margin: 0 0 8px; }
.bubble .body::before { content: var(--note-open); display: block; color: var(--muted); }
.bubble .body::after { content: var(--note-close); display: block; color: var(--muted); }
.bubble .body p { margin: 0 0 10px; }
.bubble .body a, .about .body a { overflow-wrap: anywhere; }
.bubble .body p:last-child { margin-bottom: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.tags li { font-size: 13px; padding: 3px 10px; border-radius: var(--r-sm); background: var(--ground); color: var(--muted); }
.tags li::before { content: var(--tag-prefix); }

/* Sharing */
.share { margin: 30px auto 0; max-width: 660px; text-align: center; }
.share h2 { font: 600 15px/1.2 var(--display); color: var(--muted); margin: 0 0 10px; }
.share ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.share a, .share button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 44px; min-height: 44px; padding: 0 14px;
  font: 600 14px/1 var(--display); color: var(--ink); text-decoration: none; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-sm);
  transition: border-color .15s, color .15s;
}
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent-ink); }
.share svg { flex: none; }
/* Her networks in Samantha mode, his in Randall mode; Copy link is in both. */
.share [data-side="samantha"] { display: var(--samantha-only); }
.share [data-side="randall"] { display: var(--randall-only); }
.share-status { min-height: 1.6em; margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* Archive */
.page-title { font: 600 clamp(28px, 5vw, 34px)/1.1 var(--display); margin: 18px 0 6px; text-align: center; }
.page-lede { text-align: center; color: var(--muted); margin: 0 0 22px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.shelf a {
  height: 100%; color: inherit; text-decoration: none; background: var(--surface);
  border-radius: calc(var(--r) * .6); padding: 8px; display: grid; gap: 6px; align-content: start; box-shadow: var(--shadow);
}
.shelf a:hover { outline: 2px solid var(--accent); }
.shelf img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; object-position: top; border-radius: calc(var(--r) * .4); background: #fff; }
.shelf .t { font: 600 14px/1.3 var(--display); }
.shelf .d { font-size: 12px; color: var(--muted); }
.shelf .n, .shelf .perm { display: none; }

/* In Randall mode the archive is `ls -la`. Keep these two blocks identical. */
:root[data-mode="randall"] .shelf { grid-template-columns: 1fr; gap: 0; }
:root[data-mode="randall"] .shelf a { grid-template-columns: auto 4ch 11ch 1fr; gap: 14px; box-shadow: none; padding: 4px 8px; font-size: 13px; background: transparent; border-radius: 0; }
:root[data-mode="randall"] .shelf img { display: none; }
:root[data-mode="randall"] .shelf .perm, :root[data-mode="randall"] .shelf .n { display: block; color: var(--muted); }
:root[data-mode="randall"] .shelf .n { text-align: right; }
:root[data-mode="randall"] .shelf .t { font: 400 13px/1.5 var(--body); color: var(--accent-ink); order: 4; }
:root[data-mode="randall"] .shelf .d { font-size: 13px; order: 3; }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="samantha"]) .shelf { grid-template-columns: 1fr; gap: 0; }
  :root:not([data-mode="samantha"]) .shelf a { grid-template-columns: auto 4ch 11ch 1fr; gap: 14px; box-shadow: none; padding: 4px 8px; font-size: 13px; background: transparent; border-radius: 0; }
  :root:not([data-mode="samantha"]) .shelf img { display: none; }
  :root:not([data-mode="samantha"]) .shelf .perm, :root:not([data-mode="samantha"]) .shelf .n { display: block; color: var(--muted); }
  :root:not([data-mode="samantha"]) .shelf .n { text-align: right; }
  :root:not([data-mode="samantha"]) .shelf .t { font: 400 13px/1.5 var(--body); color: var(--accent-ink); order: 4; }
  :root:not([data-mode="samantha"]) .shelf .d { font-size: 13px; order: 3; }
}

/* 404 */
.lost { text-align: center; padding-top: 12px; }
.lost-dog { display: block; margin: 8px auto 0; width: 122px; height: auto; transform: rotate(-6deg); }
.lost-picks { max-width: 720px; margin: 8px auto 0; }
.lost-picks-title { font: 600 18px/1.2 var(--display); text-align: center; margin: 0 0 14px; }
.lost-picks .shelf { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.lost-picks .center { margin-top: 22px; }

/* About */
.about { max-width: 660px; margin: 0 auto; }
.about .comic-art { justify-items: stretch; padding: 24px 28px; }
.about .comic-art > img { justify-self: center; width: min(240px, 70%); background: transparent; }
.about .body p { margin: 0 0 14px; }
.about .body strong { color: var(--accent-ink); }
.about .body::before { content: var(--note-open); display: block; color: var(--muted); }
.about .body::after { content: var(--note-close); display: block; color: var(--muted); }
.center { text-align: center; }

/* Footer */
.site-footer { border-top: 2px dashed var(--line); padding-block: 22px 40px; color: var(--muted); font-size: 14px; text-align: center; }
.site-footer p { margin: 4px 0; }
.keys { margin-top: 14px !important; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 16px; }
.keys > span { white-space: nowrap; }
kbd { font: 600 12px/1 var(--display); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 3px 6px; }
.keys-toggle { font: 600 13px/1 var(--display); color: var(--accent-ink); background: none; border: 0; padding: 6px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.no-js .keys, .no-js [data-js-only] { display: none; }
/* Single-key shortcuts mean nothing on touch-only devices. */
@media (hover: none) and (pointer: coarse) { .keys { display: none; } }

@media (max-width: 560px) {
  .brand { flex-direction: column; gap: min(var(--brand-gap), 8px); }
  /* The banner's drawn tagline would be ~7px tall here. Clip that strip off (Scribbles keeps his
     feet) and set the real tagline in its place beside him. */
  .brand .banner { clip-path: polygon(0 0, 100% 0, 100% 81%, 16.5% 81%, 16.5% 100%, 0 100%); }
  .brand-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; margin: -5.3% 0 0; padding-left: 16.5%; }
  .brand-text .wordmark { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .brand-text .tagline { margin: 0; font-size: 13px; line-height: 1.35; }
  :root[data-mode="randall"] .brand-text .wordmark { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  :root[data-mode="randall"] .brand-text .tagline { margin: 4px 0 0; font-size: 14px; line-height: 1.4; }
  .note { grid-template-columns: 1fr; }
  .note .who { display: none; }
  .bubble::before { display: none; }
  .button { padding: 10px 13px; font-size: 15px; }
  :root[data-mode="randall"] .shelf a { grid-template-columns: 4ch 1fr; }
  :root[data-mode="randall"] .shelf .perm, :root[data-mode="randall"] .shelf .d { display: none; }
}
@media (max-width: 560px) and (prefers-color-scheme: dark) {
  :root:not([data-mode="samantha"]) .brand-text .wordmark { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  :root:not([data-mode="samantha"]) .brand-text .tagline { margin: 4px 0 0; font-size: 14px; line-height: 1.4; }
  :root:not([data-mode="samantha"]) .shelf a { grid-template-columns: 4ch 1fr; }
  :root:not([data-mode="samantha"]) .shelf .perm, :root:not([data-mode="samantha"]) .shelf .d { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
