/* ===================================================================
   MisterQuigley
   -------------------------------------------------------------------
   An editorial design, closer to a serious publication than a website.
   Serif headlines, generous margins, hairline rules, one restrained
   accent. Nothing shouts, because the writing is meant to.

   Built for an audience that is mostly over 40 and mostly on a phone:

     1. Body text never drops below 19px, anywhere, on any screen.
     2. Anything you tap is at least 48px tall with space around it.
     3. Contrast stays high in both themes. No grey text on grey.
   =================================================================== */

/* ---------- Theme ---------- */

:root {
  --paper: #fbfaf7;
  --paper-2: #f2efe9;
  --paper-3: #e7e2d9;
  --ink: #191714;
  --ink-2: #5f5850;
  --rule: #d8d2c7;
  --rule-strong: #b9b1a3;
  --accent: #8c1c24;
  --accent-soft: #f6ecec;
  --accent-ink: #ffffff;

  --bg: var(--paper);
  --bg-2: var(--paper-2);
  --bg-3: var(--paper-3);
  --fg: var(--ink);
  --fg-2: var(--ink-2);

  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --max: 1080px;
  --measure: 38em;
  --radius: 3px;
  --lift: 0 1px 2px rgba(25, 23, 20, 0.06), 0 8px 24px rgba(25, 23, 20, 0.06);
}

[data-theme='dark'] {
  --bg: #15161a;
  --bg-2: #1c1e23;
  --bg-3: #24272d;
  --fg: #f0ede7;
  --fg-2: #a8a49c;
  --rule: #32363d;
  --rule-strong: #454a52;
  --accent: #d4636b;
  --accent-soft: #241a1c;
  --accent-ink: #15161a;
  --lift: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15161a;
    --bg-2: #1c1e23;
    --bg-3: #24272d;
    --fg: #f0ede7;
    --fg-2: #a8a49c;
    --rule: #32363d;
    --rule-strong: #454a52;
    --accent: #d4636b;
    --accent-soft: #241a1c;
    --accent-ink: #15161a;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

/* ---------- 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; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
[hidden] { display: none !important; }

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

/* ---------- Skip link ---------- */

.skip {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 14px 20px;
  font-weight: 600;
  z-index: 200;
}
.skip:focus { left: 0; top: 0; }

/* ---------- Layout ---------- */

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 22px; }

section { padding: 60px 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px;
  margin-bottom: 36px;
}

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

h1 { font-size: clamp(2.1rem, 6vw, 3.5rem); line-height: 1.1; }
h2 { font-size: clamp(1.55rem, 4vw, 2.1rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.4rem); }

p { margin: 0 0 1.1em 0; }
a { color: inherit; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 14px 0;
}

/* ---------- Header ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule);
  padding-top: env(safe-area-inset-top, 0px);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
}

.logo {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.15rem, 3.6vw, 1.45rem);
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.logo span { color: var(--accent); }

.nav { display: none; align-items: center; gap: 2px; }

.nav a {
  display: block;
  padding: 11px 15px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--fg-2);
  border-radius: var(--radius);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav a:hover { color: var(--fg); background: var(--bg-2); }
.nav a[aria-current='page'] { color: var(--fg); font-weight: 600; }

.header-tools { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  min-width: 48px;
  height: 48px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { border-color: var(--rule-strong); color: var(--fg); }

.menu-btn { display: inline-flex; font-size: 1.15rem; }

.mobile-nav {
  display: none;
  border-top: 1px solid var(--rule);
  padding: 6px 0 14px;
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block;
  padding: 15px 4px;
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.mobile-nav a:last-child { border-bottom: 0; }
.mobile-nav a[aria-current='page'] { color: var(--accent); font-weight: 600; }

@media (min-width: 900px) {
  .nav { display: flex; }
  .menu-btn { display: none; }
  .mobile-nav { display: none !important; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 54px;
  padding: 15px 28px;
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--bg-2); border-color: var(--fg-2); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, black);
  border-color: color-mix(in srgb, var(--accent) 86%, black);
}

.btn-block { width: 100%; }

/* ---------- Hero ---------- */

.hero { border-bottom: 1px solid var(--rule); padding: 56px 0 64px; }

.hero-grid { display: grid; gap: 40px; grid-template-columns: 1fr; align-items: center; }

.hero h1 { margin-bottom: 22px; max-width: 16ch; }

.hero-intro {
  font-family: var(--serif);
  font-size: 1.28rem;
  line-height: 1.6;
  color: var(--fg-2);
  max-width: 34em;
  margin-bottom: 32px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.hero-portrait {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--lift);
  background: var(--bg-2);
}

.stat-strip {
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--rule);
  margin-top: 44px;
  padding-top: 26px;
  gap: 32px;
}
.stat { flex: 0 1 auto; }
.stat b {
  display: block;
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5vw, 2.2rem);
  font-weight: 600;
  line-height: 1;
}
.stat span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-top: 7px;
}

@media (min-width: 900px) {
  .hero { padding: 88px 0 96px; }
  .hero-grid { grid-template-columns: 1.45fr 1fr; gap: 64px; }
}

/* ---------- Newsletter signup ---------- */

.signup {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 36px 26px;
}

.signup h2 { margin-bottom: 14px; }
.signup p { font-size: 1.06rem; color: var(--fg-2); max-width: 46em; }

.signup-form { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; }

label.field-label {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 8px;
}

input[type='email'], input[type='text'], input[type='password'],
input[type='url'], input[type='number'], textarea, select {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  font-family: var(--sans);
  font-size: 1.04rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
textarea { min-height: 160px; line-height: 1.6; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--fg-2); opacity: 0.75; }

/* The honeypot. Hidden from people, reachable by bots, out of the tab order
   so a keyboard user never lands in it by accident. */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

.form-note { font-size: 0.94rem; color: var(--fg-2); margin: 0; }

.form-msg {
  margin: 18px 0 0;
  padding: 15px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 1.02rem;
  border: 1px solid transparent;
}
.form-msg.ok { background: #e8f3ec; color: #18512f; border-color: #bcdcc8; }
.form-msg.bad { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
[data-theme='dark'] .form-msg.ok { background: #16241b; color: #7fc79a; border-color: #2c4636; }

@media (min-width: 760px) {
  .signup { padding: 48px 44px; }
  .signup-form { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
  .signup-form .field { flex: 1 1 320px; }
  .signup-form .btn { flex: 0 0 auto; }
}

/* ---------- Post list ---------- */

.post-list { display: grid; gap: 0; }

.post-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 30px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  align-items: start;
}
.post-row:first-child { padding-top: 0; }
.post-row:hover h3 { color: var(--accent); }

.post-row img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-2);
}

.post-row h3 { margin-bottom: 10px; transition: color 0.15s ease; }
.post-row p {
  font-family: var(--serif);
  color: var(--fg-2);
  font-size: 1.05rem;
  margin: 0 0 10px;
}

.post-meta {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
  text-decoration: none;
}
a.post-meta:hover { color: var(--accent); }

@media (min-width: 760px) {
  .post-row { grid-template-columns: 260px 1fr; gap: 32px; }
}

/* ---------- Article ---------- */

.article { padding: 52px 0 72px; }
.article-head {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 32px;
  margin-bottom: 40px;
  max-width: var(--measure);
}
.article-head h1 { margin: 14px 0 0; }

.article-cover { width: 100%; border-radius: var(--radius); margin-bottom: 40px; }

.prose {
  max-width: var(--measure);
  font-family: var(--serif);
  font-size: 1.22rem;
  line-height: 1.75;
}
.prose h2 { margin: 2em 0 0.55em; font-size: clamp(1.45rem, 4vw, 1.85rem); }
.prose h3 { margin: 1.7em 0 0.45em; }
.prose img { border-radius: var(--radius); margin: 1.8em 0; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose blockquote {
  margin: 1.8em 0;
  padding: 2px 0 2px 26px;
  border-left: 3px solid var(--accent);
  font-style: italic;
  color: var(--fg-2);
}
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.55em; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.6em 0; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-2);
  padding: 2px 7px;
  border-radius: var(--radius);
  font-size: 0.88em;
}

/* ---------- Videos ---------- */

.video-grid { display: grid; gap: 32px; grid-template-columns: 1fr; }

.video-card { display: flex; flex-direction: column; }

.video-thumb {
  position: relative;
  border: 0;
  padding: 0;
  width: 100%;
  display: block;
  background: var(--bg-2);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
}
.video-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.video-thumb:hover img { transform: scale(1.03); }

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 18, 16, 0.18);
  transition: background 0.2s ease;
}
.video-thumb:hover .play-badge { background: rgba(20, 18, 16, 0.32); }
.play-badge span {
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
  border-radius: 50%;
  width: 62px; height: 62px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  padding-left: 5px;
  box-shadow: var(--lift);
}

.video-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
  border-radius: var(--radius);
}

.video-body { padding: 18px 2px 0; flex: 1; display: flex; flex-direction: column; }
.video-body h3 { font-size: 1.12rem; line-height: 1.3; margin: 10px 0 12px; }
.video-links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 16px; }
.video-links a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 6px 0;
}
.video-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 720px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Socials ---------- */

.social-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
}

.social-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  min-height: 92px;
  width: 100%;
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  font-family: var(--sans);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.social-card:hover {
  border-color: var(--rule-strong);
  box-shadow: var(--lift);
  transform: translateY(-2px);
}

.social-mark {
  flex: 0 0 50px;
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.social-text b {
  display: block;
  font-family: var(--serif);
  font-size: 1.14rem;
  font-weight: 600;
  line-height: 1.2;
}
.social-text span {
  display: block;
  font-size: 0.95rem;
  color: var(--fg-2);
  margin-top: 3px;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(18, 16, 14, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
@media (min-width: 720px) { .modal-backdrop { align-items: center; padding: 24px; } }

.modal {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--lift);
  width: 100%;
  max-width: 500px;
  max-height: 92vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 720px) { .modal { border-radius: var(--radius); } }

.modal-head {
  position: sticky;
  top: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--rule);
}
.modal-head h2 { font-size: 1.35rem; }
.modal-close {
  background: transparent;
  color: var(--fg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  width: 44px; height: 44px;
  font-size: 1.1rem;
  cursor: pointer;
  flex: 0 0 auto;
}
.modal-close:hover { color: var(--fg); border-color: var(--rule-strong); }

.modal-body { padding: 24px; }

.modal-stats {
  display: flex;
  gap: 32px;
  padding-bottom: 22px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}
.modal-stats b {
  display: block;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1;
}
.modal-stats span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-2);
  margin-top: 7px;
}

/* ---------- Contact ---------- */

.contact-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 820px) { .contact-grid { grid-template-columns: repeat(2, 1fr); } }

.contact-card {
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 30px 26px;
}
.contact-card h3 { margin-bottom: 12px; }
.contact-card address {
  font-style: normal;
  white-space: pre-line;
  color: var(--fg-2);
  font-family: var(--serif);
}
.contact-card a.big {
  display: inline-block;
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  word-break: break-word;
  padding: 8px 0;
}
.contact-card a.big:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Footer ---------- */

.footer {
  border-top: 1px solid var(--rule);
  padding: 52px 0 calc(44px + env(safe-area-inset-bottom, 0px));
  margin-top: 32px;
}
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; gap: 40px; } }

.footer h4 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 0 0 14px;
}
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer a { display: inline-block; padding: 7px 0; text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer-legal {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 0.93rem;
  color: var(--fg-2);
}
.footer-legal a { color: var(--fg-2); }

/* ---------- Utility ---------- */

.center { text-align: center; }
.muted { color: var(--fg-2); }
.stack > * + * { margin-top: 18px; }

.loading { padding: 52px 20px; text-align: center; color: var(--fg-2); }

.empty {
  padding: 44px 26px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-2);
  text-align: center;
  color: var(--fg-2);
  font-size: 1.04rem;
}

.notice {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 34px 28px;
  text-align: center;
}
.notice h1 { margin-bottom: 14px; font-size: clamp(1.6rem, 5vw, 2.2rem); }

/* Brand marks in the socials cards. A glyph gets a neutral disc so the
   different brand colours sit together without the row turning into a
   colour chart; the fallback initials keep the old accent treatment. */
.social-mark.has-icon {
  background: var(--bg-3);
  color: inherit;
}
.social-mark svg { display: block; }

.modal-title {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}
.modal-title .social-mark { flex: 0 0 40px; width: 40px; height: 40px; }
.modal-title .social-mark svg { width: 21px; height: 21px; }

/* Build credit. Quiet on purpose: it belongs to the site owner, not to us,
   so it sits at the very bottom and never competes with his own content. */
.credit {
  margin: 10px 0 0;
  font-size: 0.86rem;
  color: var(--fg-2);
  opacity: 0.85;
}
.credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.credit a:hover { color: var(--accent); }

.mini-footer {
  border-top: 1px solid var(--rule);
  padding: 22px 22px calc(22px + env(safe-area-inset-bottom, 0px));
  text-align: center;
}
.mini-footer .credit { margin: 0; }
