/*
Theme Name: Delirium Words Editorial
Theme URI: https://www.deliriumwords.com/
Author: Alasdair MacLullich
Description: An accessible medical-editorial WordPress theme for Delirium Words.
Version: 1.1.7
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
Text Domain: delirium-words-editorial
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/

:root {
  --dw-ink: #183447;
  --dw-teal-dark: #0b5965;
  --dw-teal: #137c8b;
  --dw-ivory: #f7f3eb;
  --dw-mist: #eef3f3;
  --dw-orange: #c66b3d;
  --dw-white: #ffffff;
  --dw-text: #263640;
  --dw-muted: #52636d;
  --dw-border: #c8d4d4;
  --dw-focus: #f2b84b;
  --dw-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --dw-sans: "Source Sans 3", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --dw-content: 46rem;
  --dw-wide: 74rem;
  --dw-radius: 0.3rem;
  --dw-shadow: 0 0.6rem 2rem rgba(24, 52, 71, 0.08);
}

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

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--dw-ivory);
  color: var(--dw-text);
  font-family: var(--dw-sans);
  font-size: 1.1875rem;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 2rem 0; }
figcaption { margin-top: 0.55rem; color: var(--dw-muted); font-size: 0.92rem; }

a { color: var(--dw-teal-dark); text-decoration-thickness: 0.08em; text-underline-offset: 0.16em; }
a:hover { color: var(--dw-orange); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 0.2rem solid var(--dw-focus);
  outline-offset: 0.18rem;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10000;
  transform: translateY(-180%);
  padding: 0.65rem 0.9rem;
  background: var(--dw-ink);
  color: var(--dw-white);
  font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.screen-reader-text:focus { clip: auto !important; width: auto; height: auto; }

.site-shell { min-height: 100vh; }
.site-header { background: var(--dw-ivory); border-bottom: 1px solid var(--dw-border); }
.site-header__inner, .site-footer__inner, .section-inner, .archive-shell, .page-shell, .post-shell {
  width: min(calc(100% - 2.2rem), var(--dw-wide));
  margin-inline: auto;
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-height: 5.2rem; }
.site-branding { flex: 0 0 auto; }
.site-title { margin: 0; font-family: var(--dw-serif); font-size: clamp(1.55rem, 3vw, 2rem); font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.site-title a { color: var(--dw-ink); text-decoration: none; }
.site-description { margin: 0.35rem 0 0; color: var(--dw-muted); font-size: 0.85rem; line-height: 1.25; }
.custom-logo { max-height: 3.4rem; width: auto; }

.menu-toggle {
  display: none;
  border: 1px solid var(--dw-teal-dark);
  border-radius: var(--dw-radius);
  padding: 0.55rem 0.8rem;
  background: transparent;
  color: var(--dw-ink);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.primary-menu, .footer-menu { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1.35rem; margin: 0; padding: 0; list-style: none; }
.primary-menu a { display: block; padding: 0.45rem 0; color: var(--dw-ink); font-size: 1rem; font-weight: 650; text-decoration: none; }
.primary-menu a:hover, .primary-menu .current-menu-item > a, .primary-menu .current_page_item > a { color: var(--dw-teal-dark); box-shadow: inset 0 -0.15rem 0 var(--dw-orange); }

.site-main { min-height: 56vh; }
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--dw-border); background: var(--dw-mist); }
.hero::after { content: ""; position: absolute; right: -6rem; bottom: -7rem; width: 20rem; height: 20rem; border: 3rem solid rgba(19, 124, 139, 0.08); border-radius: 50%; pointer-events: none; }
.hero--with-image::after { display: none; }
.hero__inner { position: relative; z-index: 1; width: min(calc(100% - 2.2rem), 62rem); margin-inline: auto; padding: clamp(4rem, 9vw, 7.5rem) 0; }
.hero--with-image .hero__inner { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(22rem, 1.1fr); align-items: center; gap: clamp(2rem, 5vw, 5rem); width: min(calc(100% - 2.2rem), var(--dw-wide)); padding: clamp(3.5rem, 7vw, 6rem) 0; }
.hero__copy { min-width: 0; }
.eyebrow { margin: 0 0 0.75rem; color: var(--dw-teal-dark); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.1em; line-height: 1.3; text-transform: uppercase; }
.hero h1, .archive-header h1, .page-header h1, .entry-header h1 {
  margin: 0;
  color: var(--dw-ink);
  font-family: var(--dw-serif);
  font-size: clamp(2.5rem, 7vw, 5.3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.02;
}
.hero__description { max-width: 42rem; margin: 1.35rem 0 0; color: var(--dw-text); font-size: clamp(1.18rem, 2.4vw, 1.48rem); line-height: 1.5; }
.hero__content { max-width: 46rem; margin-top: 1.5rem; }
.hero__content > * { max-width: none; margin-right: 0; margin-left: 0; }
.hero__visual { margin: 0; overflow: hidden; border: 1px solid var(--dw-border); background: var(--dw-ivory); box-shadow: var(--dw-shadow); }
.hero__visual img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }

.section { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.section--white { background: var(--dw-white); }
.section--mist { background: var(--dw-mist); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.section-heading h2 { margin: 0; color: var(--dw-ink); font-family: var(--dw-serif); font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; line-height: 1.1; }
.section-heading--stacked { display: block; max-width: 48rem; }
.section-intro { margin: 0.8rem 0 0; color: var(--dw-muted); font-size: 1.08rem; line-height: 1.55; }
.section-link { font-size: 1rem; font-weight: 750; }

.featured-story { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr); border: 1px solid var(--dw-border); background: var(--dw-white); box-shadow: var(--dw-shadow); }
.featured-story--no-image { grid-template-columns: 1fr; }
.featured-story__image { min-height: 24rem; background: var(--dw-mist); }
.featured-story__image img { width: 100%; height: 100%; object-fit: cover; }
.featured-story--contain-image .featured-story__image { display: flex; align-items: center; min-height: 0; padding: clamp(0.75rem, 2vw, 1.25rem); }
.featured-story--contain-image .featured-story__image img { height: auto; border: 1px solid var(--dw-border); object-fit: contain; }
.featured-story__body { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 5vw, 4rem); }
.featured-story h2, .article-card h2, .archive-item h2, .related-posts h2 { font-family: var(--dw-serif); font-weight: 600; letter-spacing: -0.02em; }
.featured-story h2 { margin: 0.45rem 0 1rem; color: var(--dw-ink); font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.08; }
.featured-story h2 a, .article-card h2 a, .archive-item h2 a { color: inherit; text-decoration: none; }
.featured-story h2 a:hover, .article-card h2 a:hover, .archive-item h2 a:hover { color: var(--dw-teal-dark); text-decoration: underline; }

.post-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.85rem; margin: 0; color: var(--dw-muted); font-size: 0.9rem; line-height: 1.4; }
.post-meta a { color: inherit; }
.post-meta > * + *::before { content: "·"; margin-right: 0.85rem; color: var(--dw-orange); }
.entry-summary { color: var(--dw-text); }
.read-more { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.75rem; font-size: 1rem; font-weight: 750; }
.read-more::after { content: "→"; }

.article-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.article-card { display: flex; flex-direction: column; min-width: 0; border-top: 0.28rem solid var(--dw-teal); background: var(--dw-white); box-shadow: var(--dw-shadow); }
.article-card__image { aspect-ratio: 16 / 10; overflow: hidden; background: var(--dw-mist); }
.article-card__image img { width: 100%; height: 100%; object-fit: cover; }
.article-card__body { display: flex; flex: 1; flex-direction: column; padding: 1.5rem; }
.article-card h2 { margin: 0.55rem 0 0.7rem; color: var(--dw-ink); font-size: 1.65rem; line-height: 1.16; }
.article-card .entry-summary { font-size: 1rem; line-height: 1.55; }
.article-card .read-more { margin-top: auto; padding-top: 0.5rem; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.topic-card { display: block; min-height: 9rem; border: 1px solid var(--dw-border); border-left: 0.32rem solid var(--dw-orange); padding: 1.4rem; background: var(--dw-ivory); color: var(--dw-ink); text-decoration: none; }
.topic-card:hover { border-color: var(--dw-teal); background: var(--dw-white); color: var(--dw-teal-dark); }
.topic-card strong { display: block; font-family: var(--dw-serif); font-size: 1.35rem; line-height: 1.2; }
.topic-card span { display: block; margin-top: 0.5rem; color: var(--dw-muted); font-size: 0.92rem; }

.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.resource-card { display: flex; min-width: 0; min-height: 16rem; flex-direction: column; border: 1px solid var(--dw-border); border-top: 0.3rem solid var(--dw-teal); padding: 1.5rem; background: var(--dw-ivory); color: var(--dw-text); text-decoration: none; box-shadow: var(--dw-shadow); }
.resource-card:hover { border-top-color: var(--dw-orange); background: var(--dw-white); color: var(--dw-text); }
.resource-card__domain { color: var(--dw-teal-dark); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.07em; line-height: 1.3; text-transform: uppercase; }
.resource-card > strong { margin-top: 0.7rem; color: var(--dw-ink); font-family: var(--dw-serif); font-size: 1.65rem; line-height: 1.15; }
.resource-card__description { margin-top: 0.7rem; font-size: 1rem; line-height: 1.5; }
.resource-card__cta { margin-top: auto; padding-top: 1rem; color: var(--dw-teal-dark); font-size: 0.95rem; font-weight: 750; }

.archive-shell, .page-shell, .post-shell { padding: clamp(3.5rem, 7vw, 6rem) 0; }
.archive-header, .page-header { max-width: 54rem; margin-bottom: 3.2rem; }
.archive-header h1, .page-header h1 { font-size: clamp(2.6rem, 6vw, 4.7rem); }
.archive-description { margin-top: 1rem; color: var(--dw-muted); font-size: 1.1rem; }
.archive-list { max-width: 58rem; }
.archive-item { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 2rem; padding: 2rem 0; border-top: 1px solid var(--dw-border); }
.archive-item:first-child { border-top-width: 0.22rem; border-top-color: var(--dw-teal); }
.archive-item__date { color: var(--dw-muted); font-size: 0.95rem; font-weight: 650; }
.archive-item__date span, .archive-item__date time { display: block; }
.archive-item h2 { margin: 0 0 0.7rem; color: var(--dw-ink); font-size: clamp(1.65rem, 3vw, 2.35rem); line-height: 1.13; }
.archive-item .entry-summary { margin: 0; font-size: 1.02rem; }

.pagination, .posts-navigation, .post-navigation { margin-top: 3rem; }
.nav-links { display: flex; align-items: stretch; justify-content: space-between; gap: 1rem; }
.nav-links > * { display: inline-block; border: 1px solid var(--dw-border); padding: 0.65rem 0.9rem; background: var(--dw-white); font-weight: 700; text-decoration: none; }

.post-shell { width: min(calc(100% - 2.2rem), var(--dw-content)); }
.entry-header { margin-bottom: 2.5rem; }
.entry-header h1 { margin-top: 0.7rem; font-size: clamp(2.5rem, 6.8vw, 4.8rem); }
.entry-header .post-meta { margin-top: 1.25rem; }
.entry-featured-image { width: min(calc(100% - 2.2rem), 68rem); margin: 0 auto 3rem; }
.entry-featured-image img { width: 100%; max-height: 48rem; object-fit: cover; }
.entry-content { color: var(--dw-text); }
.entry-content a { overflow-wrap: anywhere; }
.entry-content > * { max-width: var(--dw-content); margin-right: auto; margin-left: auto; }
.entry-content > .alignwide { max-width: 62rem; margin-left: 50%; transform: translateX(-50%); width: min(62rem, calc(100vw - 2.2rem)); }
.entry-content > .alignfull { max-width: none; margin-left: 50%; transform: translateX(-50%); width: 100vw; }
.entry-content p, .entry-content li { font-size: 1.1875rem; }
.entry-content h2, .entry-content h3, .entry-content h4 { margin-top: 2.4em; margin-bottom: 0.65em; color: var(--dw-ink); font-family: var(--dw-serif); font-weight: 600; line-height: 1.15; }
.entry-content h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.entry-content h3 { font-size: clamp(1.45rem, 3vw, 2rem); }
.entry-content blockquote { margin: 2.2rem 0; border-left: 0.32rem solid var(--dw-orange); padding: 0.4rem 0 0.4rem 1.4rem; color: var(--dw-ink); font-family: var(--dw-serif); font-size: 1.35rem; line-height: 1.5; }
.entry-content table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 1rem; }
.entry-content th, .entry-content td { border: 1px solid var(--dw-border); padding: 0.6rem 0.75rem; text-align: left; }
.entry-content th { background: var(--dw-mist); color: var(--dw-ink); }
.entry-content code { padding: 0.1em 0.25em; background: var(--dw-mist); font-size: 0.9em; }
.entry-content pre { overflow-x: auto; padding: 1rem; background: var(--dw-ink); color: var(--dw-white); font-size: 0.95rem; }

.archive-notice { margin: 0 0 2.2rem; border: 1px solid var(--dw-border); border-left: 0.32rem solid var(--dw-orange); padding: 1rem 1.2rem; background: var(--dw-mist); color: var(--dw-text); }
.archive-notice strong { color: var(--dw-ink); font-family: var(--dw-serif); font-size: 1.15rem; }
.archive-notice p { margin: 0.3rem 0 0; font-size: 1rem; line-height: 1.55; }

.entry-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--dw-border); color: var(--dw-muted); font-size: 0.95rem; }
.entry-taxonomy { margin: 0.4rem 0; }
.author-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.25rem; margin-top: 3rem; border-top: 0.25rem solid var(--dw-teal); padding: 1.5rem; background: var(--dw-mist); }
.author-box__avatar img { border-radius: 50%; }
.author-box h2 { margin: 0; color: var(--dw-ink); font-family: var(--dw-serif); font-size: 1.5rem; }
.author-box p { margin: 0.45rem 0 0; font-size: 1rem; }
.author-box--primary, .author-box--guest { grid-template-columns: 1fr; }
.author-box__label { color: var(--dw-teal-dark); font-size: 0.78rem !important; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.author-box__links { color: var(--dw-muted); }
.author-box--guest { grid-template-columns: 1fr; }

.related-posts { margin-top: 4rem; }
.related-posts > h2 { margin-bottom: 1rem; color: var(--dw-ink); font-size: 2rem; }
.related-posts ul { margin: 0; padding: 0; list-style: none; }
.related-posts li { border-top: 1px solid var(--dw-border); padding: 1rem 0; }
.related-posts a { font-family: var(--dw-serif); font-size: 1.25rem; font-weight: 600; }

.search-form { display: flex; max-width: 40rem; gap: 0.5rem; }
.search-form label { flex: 1; }
.search-field { width: 100%; min-height: 3rem; border: 1px solid var(--dw-border); border-radius: var(--dw-radius); padding: 0.65rem 0.8rem; background: var(--dw-white); color: var(--dw-text); font: inherit; }
.search-submit, .button {
  min-height: 3rem;
  border: 2px solid var(--dw-teal-dark);
  border-radius: var(--dw-radius);
  padding: 0.6rem 1rem;
  background: var(--dw-teal-dark);
  color: var(--dw-white);
  font: inherit;
  font-size: 1rem;
  font-weight: 750;
  cursor: pointer;
}
.search-submit:hover, .button:hover { background: var(--dw-ink); }
.no-results { max-width: var(--dw-content); }

.content-note {
  margin: 0 0 2rem;
  border-left: 0.3rem solid var(--dw-orange);
  padding: 1rem 1.15rem;
  background: #fff4eb;
  color: var(--dw-text);
  font-size: 1rem;
}
.content-note p { margin: 0; }

.site-footer { border-top: 0.32rem solid var(--dw-orange); background: var(--dw-ink); color: rgba(255, 255, 255, 0.9); }
.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(10rem, 0.6fr) minmax(16rem, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-top: 3.25rem;
  padding-bottom: 2.75rem;
}
.site-footer a { color: var(--dw-white); }
.site-footer a:hover { color: #f4c8af; }
.site-footer__title { margin: 0; color: var(--dw-white); font-family: var(--dw-serif); font-size: 1.75rem; }
.site-footer__description, .site-footer__legal { margin: 0.5rem 0 0; color: rgba(255, 255, 255, 0.74); font-size: 0.9rem; }
.site-footer__editor { max-width: 42rem; margin: 1rem 0 0; font-size: 0.95rem; line-height: 1.55; }
.site-footer__profile-links,
.site-footer__policy-links,
.site-footer__resources {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.site-footer__profile-links { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.9rem; }
.site-footer__column h2 { margin: 0 0 0.8rem; color: var(--dw-white); font-family: var(--dw-sans); font-size: 0.95rem; letter-spacing: 0.06em; text-transform: uppercase; }
.site-footer .footer-menu { display: grid; align-items: initial; justify-content: initial; gap: 0.45rem; }
.site-footer .footer-menu a, .site-footer__policy-links a { font-size: 0.95rem; }
.site-footer__policy-links { border-top: 1px solid rgba(255, 255, 255, 0.18); padding-top: 0.9rem; }
.site-footer__resources { display: grid; gap: 0.65rem; }
.site-footer__resources a { display: block; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: var(--dw-radius); padding: 0.75rem 0.85rem; text-decoration: none; }
.site-footer__resources strong, .site-footer__resources span { display: block; }
.site-footer__resources span { margin-top: 0.15rem; color: rgba(255, 255, 255, 0.74); font-size: 0.82rem; line-height: 1.4; }
.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem 2rem;
  width: min(calc(100% - 2.2rem), var(--dw-wide));
  margin-inline: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding: 1.1rem 0 1.35rem;
}
.site-footer__notice { margin: 0; color: rgba(255, 255, 255, 0.86); font-size: 0.9rem; }
.site-footer__legal { margin: 0; white-space: nowrap; }

@media (max-width: 56rem) {
  .menu-toggle { display: inline-block; }
  .primary-navigation { position: relative; }
  .primary-menu { position: absolute; top: calc(100% + 1rem); right: 0; z-index: 50; display: none; min-width: 14rem; border: 1px solid var(--dw-border); padding: 0.7rem 1rem; background: var(--dw-white); box-shadow: var(--dw-shadow); }
  .primary-menu.is-open { display: block; }
  .primary-menu li + li { border-top: 1px solid var(--dw-border); }
  .primary-menu a { padding: 0.7rem 0; }
  .hero--with-image .hero__inner { grid-template-columns: 1fr; gap: 2.25rem; }
  .featured-story { grid-template-columns: 1fr; }
  .featured-story__image { min-height: 18rem; }
  .featured-story--contain-image .featured-story__image { min-height: 0; padding: 0.85rem; }
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: 1fr; }
  .site-footer__inner { grid-template-columns: minmax(0, 1.25fr) minmax(14rem, 0.75fr); }
  .site-footer__column:last-child { grid-column: 1 / -1; }
  .site-footer__resources { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 40rem) {
  body { font-size: 1.125rem; }
  .site-header__inner { min-height: 4.6rem; }
  .site-description { display: none; }
  .article-grid { grid-template-columns: 1fr; }
  .archive-item { grid-template-columns: 1fr; gap: 0.35rem; }
  .search-form { flex-direction: column; }
  .site-footer__inner { grid-template-columns: 1fr; }
  .site-footer__column:last-child { grid-column: auto; }
  .site-footer__resources { grid-template-columns: 1fr; }
  .site-footer__bottom { flex-direction: column; }
  .site-footer__legal { white-space: normal; }
  .author-box { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .post-navigation, .related-posts, .search-form { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  a { color: #000; text-decoration: underline; }
  .post-shell { width: 100%; padding: 0; }
}
