/*
Theme Name: District 71
Theme URI: https://district71aa.org/
Author: AA District 71
Description: A plain, calm, accessible block theme for AA District 71, set like a printed public notice.
Version: 0.4.3
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 8.0
Text Domain: district71
*/

@font-face {
  font-display: swap;
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  src: url("./assets/fonts/atkinson-regular.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  src: url("./assets/fonts/atkinson-bold.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 400;
  src: url("./assets/fonts/atkinson-italic.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: "Atkinson Hyperlegible";
  font-style: italic;
  font-weight: 700;
  src: url("./assets/fonts/atkinson-bold-italic.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: "Literata";
  font-style: normal;
  font-weight: 700;
  src: url("./assets/fonts/literata-700.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Literata";
  font-style: normal;
  font-weight: 800;
  src: url("./assets/fonts/literata-800.woff2") format("woff2");
}

:root {
  --d71-paper: #f9fafb;
  --d71-wash: #eef1f3;
  --d71-ink: #22323f;
  --d71-muted: #51606b;
  --d71-blue: #1e4b6d;
  --d71-blue-deep: #16394f;
  --d71-line: #d8dde1;
  --d71-serif: "Literata", "Charter", "Iowan Old Style", Georgia, serif;
  /* One rhythm for the whole page: space between major sections, and the
     breathing room under each section rule. */
  --d71-gap-section: clamp(44px, 6vw, 72px);
  --d71-gap-rule: clamp(24px, 3.5vw, 36px);
}

html {
  box-sizing: border-box;
}

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

body {
  background: var(--d71-paper);
}

::selection {
  background: var(--d71-blue);
  color: var(--d71-paper);
}

a {
  text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--d71-blue);
  outline-offset: 2px;
}

.d71-hotline-band a:focus-visible {
  outline-color: var(--d71-paper);
  outline-offset: -4px;
}

/* Hotline band: first thing on every page, one tap on mobile. */

.d71-hotline-band {
  background: var(--d71-blue);
}

.d71-hotline-band p {
  margin: 0;
  text-align: center;
}

.d71-hotline-band a {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  column-gap: 0.6em;
  min-height: 48px;
  align-content: center;
  padding: 0.45rem 0;
  color: var(--d71-paper);
  font-size: 0.98rem;
  line-height: 1.3;
  text-decoration: none;
}

.d71-hotline-band a:hover strong {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.d71-hotline-band .d71-band-label {
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.d71-hotline-band strong {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

/* Masthead: set like the front page of a local paper. */

.d71-masthead {
  padding-top: clamp(30px, 4.5vw, 52px);
}

.d71-masthead-name {
  text-align: center;
}

.d71-eyebrow {
  margin: 0 0 0.55rem;
  color: var(--d71-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
}

.d71-eyebrow span {
  display: inline;
}

.d71-masthead .wp-block-site-title {
  margin: 0;
  font-family: var(--d71-serif);
  font-size: clamp(2.15rem, 4.5vw, 2.9rem);
  font-weight: 800;
  letter-spacing: 0.005em;
  line-height: 1.04;
}

.d71-masthead .wp-block-site-title a {
  color: var(--d71-ink);
  text-decoration: none;
}

.d71-rule-oxford {
  width: 100%;
  max-width: none;
  height: 7px;
  margin: clamp(18px, 2.5vw, 26px) 0 0;
  border: 0;
  border-top: 3px solid var(--d71-ink);
  border-bottom: 1px solid var(--d71-ink);
  background: transparent;
  opacity: 1;
}

.d71-masthead-nav {
  border-bottom: 1px solid var(--d71-line);
}

.d71-masthead-nav .wp-block-navigation {
  padding: 0.55rem 0;
}

.d71-masthead-nav a {
  padding: 0.45rem 0.15rem;
  color: var(--d71-ink);
  text-decoration: none;
}

.d71-masthead-nav a:hover {
  color: var(--d71-blue);
  text-decoration: underline;
}

.d71-masthead-nav .wp-block-navigation-item__content {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Main column */

.d71-main {
  padding-top: clamp(24px, 3.5vw, 44px);
  padding-bottom: clamp(56px, 8vw, 92px);
}

.d71-main .wp-block-post-content > :first-child {
  margin-block-start: 0;
}

body.tsml #tsml {
  padding-top: clamp(34px, 5vw, 58px);
}

body.tsml .d71-main {
  padding-top: clamp(28px, 4vw, 48px);
}

.d71-page-title {
  margin-bottom: clamp(24px, 4vw, 40px);
  padding-bottom: clamp(14px, 2vw, 20px);
  border-bottom: 1px solid var(--d71-line);
}

.d71-page-title h1 {
  max-width: 24ch;
  margin: 0;
}

.d71-lede {
  max-width: 64ch;
  color: var(--d71-muted);
  font-size: clamp(1.08rem, 1.5vw, 1.2rem);
  line-height: 1.7;
}

.d71-kicker {
  margin: 0 0 0.7rem;
  color: var(--d71-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-transform: uppercase;
}

/* Buttons */

.wp-block-button__link,
.d71-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  font-weight: 700;
  line-height: 1.2;
}

.d71-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 1.6rem;
}

.is-style-outline .wp-block-button__link {
  border: 1.5px solid var(--d71-blue);
}

/* Children of our grid containers size to their track, never to WP's
   constrained-layout centering. */
.d71-week > *,
.d71-week-rail > *,
.d71-newcomer > *,
.d71-district-note > *,
.d71-directory-row > *,
.d71-notice > *,
.d71-footer-grid > *,
.d71-landing > *,
.d71-photo-note > * {
  max-width: none;
}

/* The week: schedule table plus help rail. */

.d71-week {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: clamp(30px, 4.5vw, 60px);
  align-items: start;
}

.d71-week-main h1 {
  max-width: none;
  margin: 0 0 0.5rem;
}

.d71-schedule-note {
  max-width: 60ch;
  margin: 0 0 1.5rem;
  color: var(--d71-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.d71-schedule {
  margin: 0 0 1.4rem;
}

.d71-schedule table {
  width: 100%;
  border-collapse: collapse;
  border: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.d71-schedule th,
.d71-schedule td {
  padding: 0.6rem 0.9rem 0.6rem 0;
  border: 0;
  border-bottom: 1px solid var(--d71-line);
  text-align: left;
  vertical-align: baseline;
}

.d71-schedule th:last-child,
.d71-schedule td:last-child {
  padding-right: 0;
}

.d71-schedule thead th {
  padding-top: 0;
  border-bottom: 2px solid var(--d71-ink);
  color: var(--d71-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.d71-schedule td:first-child {
  width: 3.4em;
  font-family: var(--d71-serif);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.d71-schedule td:nth-child(2) {
  white-space: nowrap;
}

.d71-schedule td:last-child {
  color: var(--d71-muted);
}

/* Heavier rule where a new day begins (progressive enhancement). */
.d71-schedule tbody tr:has(> td:first-child:not(:empty)) > td {
  border-top: 2px solid var(--d71-ink);
}

.d71-schedule tbody tr:first-child > td {
  border-top: 0;
}

/* Next meetings, rendered by the 12 Step Meeting List shortcode. */

.d71-next {
  margin: 0 0 1.4rem;
  border-top: 2px solid var(--d71-ink);
}

/* Late at night the plugin has no meetings left today; say so instead of
   rendering a bare rule. */
.d71-next:not(:has(table)):not(:has(li))::before {
  content: "No more meetings today. The full meeting list has tomorrow's schedule.";
  display: block;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--d71-line);
  color: var(--d71-muted);
  line-height: 1.6;
}

.d71-next table {
  width: 100%;
  border-collapse: collapse;
  border: 0;
  font-size: 1rem;
  line-height: 1.45;
}

.d71-next th,
.d71-next td {
  padding: 0.65rem 0.9rem 0.65rem 0;
  border: 0;
  border-bottom: 1px solid var(--d71-line);
  text-align: left;
  vertical-align: baseline;
}

.d71-next th:last-child,
.d71-next td:last-child {
  padding-right: 0;
}

.d71-next thead th {
  color: var(--d71-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.d71-next td:first-child {
  white-space: nowrap;
  font-family: var(--d71-serif);
  font-size: 0.95rem;
  font-weight: 700;
}

.d71-next td:last-child {
  color: var(--d71-muted);
}

.d71-next ul {
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--d71-ink);
  list-style: none;
}

.d71-next li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--d71-line);
}

/* Framed help notice, set like a print notice. */

.d71-help-box {
  padding: clamp(22px, 3vw, 30px);
  background: var(--d71-wash);
  border: 2px solid var(--d71-ink);
  color: var(--d71-ink);
}

.d71-help-box h2,
.d71-help-box h3 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.28rem, 2vw, 1.45rem);
}

.d71-help-box p {
  margin: 0 0 0.8rem;
  color: var(--d71-ink);
}

.d71-help-box p:last-child {
  margin-bottom: 0;
}

.d71-phone {
  margin: 0.3rem 0 0.55rem;
}

.d71-phone a,
a.d71-phone {
  display: inline-block;
  color: var(--d71-blue);
  font-family: var(--d71-serif);
  font-size: clamp(1.6rem, 2.6vw, 1.95rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.16em;
}

.d71-help-small {
  color: var(--d71-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.d71-week-rail {
  position: sticky;
  top: 24px;
  display: grid;
  gap: clamp(20px, 3vw, 28px);
}

/* Newcomer note with captioned photo. */

.d71-newcomer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
  margin-top: var(--d71-gap-section);
  padding-top: var(--d71-gap-rule);
  border-top: 2px solid var(--d71-ink);
}

.d71-newcomer h2 {
  margin-top: 0;
}

.d71-newcomer p {
  max-width: 58ch;
}

.d71-newcomer figure {
  margin: 0;
}

.d71-newcomer img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  filter: saturate(0.8) contrast(0.98);
}

.d71-newcomer figcaption,
.wp-block-image figcaption {
  margin: 0;
  padding-top: 0.55rem;
  border-top: 1px solid var(--d71-line);
  color: var(--d71-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  text-align: left;
}

/* District business: quiet strip near the bottom of the homepage. */

.d71-district-note {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr);
  gap: clamp(16px, 4vw, 32px);
  margin-top: var(--d71-gap-section);
  padding-top: var(--d71-gap-rule);
  border-top: 1px solid var(--d71-line);
}

.d71-district-note h2 {
  margin: 0;
  font-size: 1.1rem;
}

.d71-district-note p {
  max-width: 64ch;
  margin: 0;
  color: var(--d71-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

/* Directory rows and notices, shared by inner pages. */

.d71-section {
  padding-block: clamp(30px, 5vw, 56px);
}

.d71-section-header {
  max-width: 700px;
  margin-bottom: clamp(18px, 3vw, 30px);
}

.d71-directory {
  border-top: 2px solid var(--d71-ink);
}

.d71-directory-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr);
  gap: clamp(16px, 4vw, 32px);
  padding: 20px 0;
  border-bottom: 1px solid var(--d71-line);
}

.d71-directory-row h3 {
  margin: 0;
  font-size: 1.1rem;
}

.d71-directory-row p {
  margin-top: 0;
}

.d71-directory-row p:last-child {
  margin-bottom: 0;
}

.d71-notice {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr);
  gap: clamp(18px, 4vw, 34px);
  padding: clamp(20px, 3vw, 28px);
  background: var(--d71-wash);
  border: 1px solid var(--d71-line);
}

.d71-notice strong {
  font-family: var(--d71-serif);
  font-size: 1.05rem;
  color: var(--d71-ink);
}

/* Legacy homepage classes, kept readable until content is regenerated. */

.d71-landing {
  display: grid;
  grid-template-columns: minmax(0, 0.62fr) minmax(320px, 0.38fr);
  gap: clamp(24px, 4vw, 42px);
  align-items: start;
  margin-bottom: clamp(26px, 5vw, 56px);
}

.d71-landing-copy {
  padding: 0;
  background: transparent;
  border: 0;
}

.d71-landing h1 {
  max-width: 20ch;
  margin-top: 0;
}

.d71-photo-note {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(240px, 0.58fr);
  gap: clamp(18px, 5vw, 44px);
  align-items: center;
  margin-top: clamp(28px, 5vw, 56px);
  padding-top: clamp(20px, 4vw, 34px);
  border-top: 2px solid var(--d71-ink);
}

.d71-photo-note figure {
  margin: 0;
}

.d71-photo-note img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: saturate(0.8) contrast(0.98);
}

.d71-room-image {
  min-height: 260px;
  aspect-ratio: 4 / 3;
  background-color: #c6cbcf;
  background-image: url("./assets/images/meeting-room.jpg");
  background-position: center;
  background-size: cover;
  filter: saturate(0.8) contrast(0.98);
}

/* Footer */

.d71-site-footer {
  margin-top: 0;
  background: var(--d71-paper);
}

.d71-site-footer .d71-rule-oxford {
  margin: 0;
}

.d71-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) repeat(2, minmax(180px, 0.55fr));
  gap: clamp(24px, 5vw, 56px);
  padding-block: clamp(34px, 5vw, 56px);
}

.d71-footer-grid h2,
.d71-footer-grid h3 {
  margin: 0 0 0.6rem;
  font-size: 1.1rem;
}

.d71-footer-small {
  color: var(--d71-muted);
  font-size: 0.92rem;
  line-height: 1.58;
}

/* 12 Step Meeting List plugin surfaces. */

.tsml #meetings,
.tsml .meetings {
  font-size: 1rem;
}

.tsml table {
  border-color: var(--d71-line);
}

.tsml #meetings th,
.tsml #meetings td {
  vertical-align: top;
}

.tsml #tsml {
  max-width: 100%;
}

.tsml #table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 760px) {
  .d71-hotline-band a {
    width: 100%;
    min-height: 52px;
  }

  .d71-masthead {
    padding-top: 20px;
  }

  .d71-masthead .wp-block-site-title {
    font-size: clamp(1.9rem, 8vw, 2.15rem);
  }

  /* Stack the eyebrow: "Alcoholics Anonymous" over "Northern Illinois Area 20". */
  .d71-eyebrow span {
    display: block;
  }

  .d71-eyebrow .d71-eyebrow-sep {
    display: none;
  }

  .d71-masthead-nav .wp-block-navigation {
    padding: 0.2rem 0;
  }

  .d71-masthead-nav .wp-block-navigation__container {
    justify-content: center;
    gap: 0 1.35rem;
  }

  .d71-main {
    padding-top: 20px;
  }

  .d71-week {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .d71-week-main h1 {
    margin-bottom: 0.4rem;
  }

  .d71-newcomer,
  .d71-district-note {
    margin-top: 44px;
    padding-top: 24px;
  }

  /* Help notice above the schedule on small screens. */
  .d71-week-rail {
    position: static;
    order: -1;
  }

  .d71-schedule table {
    font-size: 0.95rem;
  }

  .d71-schedule th,
  .d71-schedule td {
    padding: 0.5rem 0.55rem 0.5rem 0;
  }

  .d71-schedule td:first-child {
    width: 2.9em;
  }

  .d71-next table {
    font-size: 0.95rem;
  }

  .d71-next th,
  .d71-next td {
    padding: 0.55rem 0.55rem 0.55rem 0;
  }

  /* Drop the location column on small screens; town says enough at a
     glance and details are one tap away on the full list. */
  .d71-next th:nth-child(3),
  .d71-next td:nth-child(3) {
    display: none;
  }

  .d71-next td:first-child {
    white-space: nowrap;
    font-size: 0.85rem;
  }

  .d71-next td:last-child {
    text-align: right;
  }

  .d71-newcomer,
  .d71-district-note,
  .d71-landing,
  .d71-notice,
  .d71-directory-row,
  .d71-photo-note {
    grid-template-columns: 1fr;
  }

  /* Footer: identity full-width, then hotline and mail share one row. */
  .d71-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 26px 20px;
  }

  .d71-footer-grid > :first-child {
    grid-column: 1 / -1;
  }

  .d71-footer-grid > :nth-child(n + 2) {
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
  }

  .d71-footer-grid > :nth-child(n + 2) h3 {
    font-size: 0.98rem;
  }

  .d71-district-note {
    gap: 8px;
  }

  .d71-landing h1 {
    max-width: 100%;
  }

  .d71-help-box {
    padding: 20px;
  }

  .d71-room-image {
    min-height: 220px;
  }

  .d71-quick-actions,
  .d71-quick-actions .wp-block-button,
  .d71-quick-actions .wp-block-button__link {
    width: 100%;
  }

  .tsml #meetings.container {
    width: 100%;
    max-width: 100%;
    padding-right: 0;
    padding-left: 0;
  }

  .tsml #meetings .row {
    margin-right: 0;
    margin-left: 0;
  }

  .tsml #meetings [class*="col-"] {
    width: 100%;
    float: none;
    right: auto;
    left: auto;
    padding-right: 0;
    padding-left: 0;
  }

  .tsml #meetings .controls {
    display: grid;
    gap: 10px;
  }

  .tsml #meetings .controls::before,
  .tsml #meetings .controls::after {
    display: none;
  }

  .tsml #meetings .input-group {
    display: flex;
    width: 100%;
  }

  .tsml #meetings .input-group .form-control {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .tsml #meetings .input-group-btn {
    width: auto;
    flex: 0 0 auto;
  }

  .tsml #meetings .btn-group-justified {
    display: flex;
    width: 100%;
  }

  .tsml #meetings .btn-group-justified > .btn,
  .tsml #meetings .btn-group-justified > .btn-group {
    width: auto;
    flex: 1 1 0;
    display: inline-flex;
    justify-content: center;
  }

  .tsml #meetings .dropdown,
  .tsml #meetings .dropdown > .btn {
    width: 100%;
  }

  .tsml #meetings .dropdown > .btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .tsml #meetings .dropdown .selected {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tsml #meetings .results td,
  .tsml #meetings .results a {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
