/* ==========================================================================
   The Outpatient Program Guide — shared editorial stylesheet
   Paper-texture journal: warm off-white, charcoal ink, burnt sienna rules.
   ========================================================================== */

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.6;
  color: #2a2a2a;
  background-color: #faf6ef;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.035'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  min-width: 0;
}

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

a {
  color: #9a4a2a;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

a:hover,
a:focus-visible {
  color: #6e341c;
  text-decoration-thickness: 0.12em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #c05621;
  outline-offset: 2px;
}

h1,
h2,
h3,
h4 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1.2;
  color: #1f1f1f;
  overflow-wrap: break-word;
  word-break: break-word;
}

p {
  max-width: 72ch;
}

/* ---------- Shared shell ---------- */
.site-header {
  border-bottom: 4px solid #b5532f;
  background: #faf6ef;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #1f1f1f;
  text-decoration: none;
}

.brand:hover {
  color: #9a4a2a;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.25rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #9a4a2a;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  border-bottom-color: #b5532f;
  color: #6e341c;
}

.site-footer {
  border-top: 4px solid #b5532f;
  background: #f1eadf;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  justify-content: space-between;
  align-items: flex-start;
}

.footer-inner p {
  font-size: 0.9rem;
  color: #4a443c;
  max-width: 60ch;
}

.footer-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  padding: 0;
}

.footer-nav a {
  font-size: 0.9rem;
  color: #9a4a2a;
  text-decoration: underline;
}

.footer-nav a:hover,
.footer-nav a:focus-visible {
  color: #6e341c;
}

/* ---------- Main layout ---------- */
.outermain {
  min-width: 0;
}

div.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-width: 0;
}

/* ---------- Home page ---------- */
.page.home {
  padding-top: 0;
}

.home-journal {
  min-width: 0;
}

.hero-lede {
  padding-top: 2rem;
}

.hero-figure {
  margin: 0 0 2rem;
}

.hero-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.kicker {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9a4a2a;
  margin-bottom: 0.75rem;
}

.hero-lede h1 {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  max-width: 20ch;
  margin-bottom: 1rem;
}

.lede {
  font-size: 1.15rem;
  line-height: 1.6;
  max-width: 72ch;
  color: #3a352e;
}

.guide-section,
.sources-section,
.worksheet-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid #d8cfc0;
}

.guide-section h2,
.sources-section h2,
.worksheet-section h2 {
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
}

.guide-section p,
.sources-section p,
.worksheet-section p {
  margin-bottom: 1rem;
}

.guide-list,
.question-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  max-width: 72ch;
}

.guide-list li,
.question-list li {
  padding: 0.75rem 0 0.75rem 1.5rem;
  border-left: 3px solid #b5532f;
  margin-bottom: 0.75rem;
  font-size: 1rem;
  line-height: 1.6;
}

.guide-list a {
  font-weight: 700;
}

.support-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin: 1.5rem 0 2rem;
  min-width: 0;
}

.support-figure {
  margin: 0;
  min-width: 0;
}

.support-figure img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* ---------- Article figures & captions ---------- */
.article-figure {
  margin: 0 0 1.5rem;
  min-width: 0;
}

.article-figure img {
  width: 100%;
  height: auto;
}

.media-caption {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #4a443c;
  padding-top: 0.5rem;
  border-bottom: 1px solid #d8cfc0;
  max-width: 72ch;
}

/* ---------- Article pages ---------- */
.page.article {
  padding-top: 2.5rem;
}

.article-header {
  padding-bottom: 1.5rem;
  border-bottom: 4px solid #b5532f;
  margin-bottom: 2rem;
}

.article-header .kicker {
  margin-bottom: 0.5rem;
}

.article-header h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  max-width: 24ch;
  margin-bottom: 0.75rem;
}

.article-header p {
  color: #4a443c;
  font-size: 1.05rem;
  max-width: 72ch;
}

.article-body {
  max-width: 72ch;
  min-width: 0;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #d8cfc0;
}

.article-body h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.5rem;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem 1.5rem;
  max-width: 72ch;
}

.article-body li {
  margin-bottom: 0.5rem;
}

/* ---------- Editorial table ---------- */
.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0 2rem;
  border: 1px solid #d8cfc0;
  min-width: 0;
}

.table-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 560px;
}

.table-scroll th {
  background: #b5532f;
  color: #faf6ef;
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 700;
  border: 1px solid #9a4a2a;
}

.table-scroll td {
  padding: 0.75rem 1rem;
  border: 1px solid #d8cfc0;
  vertical-align: top;
  background: #fdfbf7;
}

.table-scroll tr:nth-child(even) td {
  background: #f7f2e9;
}

/* ---------- Professional review aside ---------- */
.professional-review {
  margin: 3rem 0 1rem;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid #b5532f;
  background: #f1eadf;
  font-size: 0.9rem;
  color: #4a443c;
  max-width: 72ch;
}

.professional-review h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #1f1f1f;
}

.professional-review p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* ---------- Program directory ---------- */
.program-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  min-width: 0;
}

.program-row {
  padding: 1.25rem 0;
  border-bottom: 1px solid #d8cfc0;
  min-width: 0;
}

.program-row:first-child {
  border-top: 1px solid #d8cfc0;
}

.program-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.program-title a {
  color: #9a4a2a;
}

.program-meta {
  font-size: 0.85rem;
  color: #4a443c;
  margin-bottom: 0.5rem;
}

.program-summary {
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 72ch;
}

/* ---------- Tool / worksheet page ---------- */
.page.tool {
  padding-top: 2.5rem;
}

.tool-page form {
  max-width: 1200px;
  min-width: 0;
}

.tool-page h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: 1rem;
}

.tool-page form > p {
  margin-bottom: 1.5rem;
  max-width: 72ch;
  color: #3a352e;
}

fieldset {
  border: 2px solid #b5532f;
  padding: 1.5rem;
  margin: 0 0 1.5rem;
  min-width: 0;
}

legend {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f1f1f;
  padding: 0 0.5rem;
}

fieldset[disabled] {
  opacity: 1;
}

fieldset[disabled] legend {
  color: #4a443c;
}

.program-column {
  margin-bottom: 1.5rem;
  min-width: 0;
}

.program-column h2,
.questions-row h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid #b5532f;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #2a2a2a;
  margin: 0.75rem 0 0.25rem;
}

input[type="url"],
textarea {
  width: 100%;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1.5;
  color: #2a2a2a;
  background: #fdfbf7;
  border: 1px solid #b8ae9e;
  border-radius: 0;
  padding: 0.6rem 0.75rem;
  min-width: 0;
}

input[type="url"]:focus,
textarea:focus {
  border-color: #b5532f;
  outline: 3px solid rgba(181, 83, 47, 0.25);
  outline-offset: 0;
}

input[type="url"]::placeholder,
textarea::placeholder {
  color: #6b645a;
  opacity: 1;
}

textarea {
  resize: vertical;
  min-height: 6rem;
}

.questions-row {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #d8cfc0;
  min-width: 0;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.tool-actions button {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.6rem 1.25rem;
  border: 2px solid #b5532f;
  background: #faf6ef;
  color: #9a4a2a;
  cursor: pointer;
  border-radius: 0;
}

.tool-actions button:hover:not(:disabled) {
  background: #b5532f;
  color: #faf6ef;
}

.tool-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: #b8ae9e;
  color: #6b645a;
}

#status {
  font-size: 0.9rem;
  color: #4a443c;
  margin: 0.5rem 0 1rem;
  min-height: 1.5em;
}

#results {
  margin: 1.5rem 0;
  min-width: 0;
}

#results[hidden] {
  display: none;
}

#results h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

#results .program-list {
  margin-top: 0;
}

noscript p {
  font-size: 0.9rem;
  color: #4a443c;
  padding: 1rem;
  border: 1px solid #d8cfc0;
  background: #f1eadf;
  max-width: 72ch;
}

/* ---------- Sources & date copy ---------- */
.source-list,
.date-copy {
  font-size: 0.85rem;
  color: #4a443c;
  line-height: 1.5;
  max-width: 72ch;
}

.source-list li {
  margin-bottom: 0.4rem;
}

/* ---------- Reduced motion ---------- */
@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;
  }
}

/* ---------- Responsive: 390px and below ---------- */
@media (max-width: 640px) {
  body {
    font-size: 17px;
  }

  .header-inner {
    padding: 1rem 1rem 0.75rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .site-nav ul {
    gap: 0.25rem 1rem;
  }

  .site-nav a {
    font-size: 0.9rem;
  }

  div.page {
    padding: 0 1rem;
  }

  .hero-lede {
    padding-top: 1.5rem;
  }

  .hero-figure img {
    aspect-ratio: 4 / 3;
  }

  .hero-lede h1 {
    font-size: 1.75rem;
  }

  .lede {
    font-size: 1.05rem;
  }

  .support-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .guide-section,
  .sources-section,
  .worksheet-section {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
  }

  .guide-section h2,
  .sources-section h2,
  .worksheet-section h2 {
    font-size: 1.35rem;
  }

  .guide-list li,
  .question-list li {
    padding-left: 1rem;
    font-size: 0.95rem;
  }

  fieldset {
    padding: 1rem;
  }

  .tool-actions {
    flex-direction: column;
  }

  .tool-actions button {
    width: 100%;
  }

  .footer-inner {
    padding: 1.5rem 1rem 2.5rem;
    flex-direction: column;
    gap: 1rem;
  }

  .footer-nav ul {
    gap: 0.25rem 1rem;
  }

  .article-header h1 {
    font-size: 1.6rem;
  }

  .article-body {
    font-size: 0.95rem;
  }

  .table-scroll table {
    min-width: 480px;
  }

  .professional-review {
    padding: 1rem;
  }
}

/* ---------- Print-friendly worksheet ---------- */
@media print {
  body {
    background: #fff;
    font-size: 12pt;
  }

  .site-header,
  .site-footer,
  .tool-actions,
  #status {
    display: none;
  }

  .outermain {
    max-width: 100%;
  }

  div.page {
    max-width: 100%;
    padding: 0;
  }

  fieldset {
    border: 1px solid #999;
    break-inside: avoid;
  }

  textarea,
  input[type="url"] {
    border: 1px solid #999;
    background: #fff;
  }

  .media-caption {
    border-bottom: 1px solid #999;
  }
}
