/* House Water Guide - Global Stylesheet (Single CSS) */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --paper:      #F4F6F7;
  --surface:    #FFFFFF;
  --ink:        #16232B;
  --ink-deep:   #0D1720;
  --ink-soft:   #4A5A64;
  --accent:     #0F6E85;
  --accent-dk:  #0A4E5F;
  --accent-lt:  #E3F0F3;
  --rule:       #D3DADD;
  --warn:       #A8471B;
  --warn-lt:    #F7EDE7;
}

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

html {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-size: clamp(16px, 4vw, 18px);
  line-height: 1.62;
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Typography */
h1 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: clamp(30px, 7.5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--ink);
}

h2 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: clamp(22px, 5vw, 32px);
  line-height: 1.18;
  letter-spacing: -0.015em;
  font-weight: 600;
  color: var(--ink);
}

h3 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: clamp(18px, 3.8vw, 22px);
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
}

p {
  margin-bottom: 16px;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-dk);
}

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

/* Monospace Helpers */
.mono {
  font-family: 'IBM Plex Mono', monospace;
  font-variant-numeric: tabular-nums;
}

.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dk);
  display: inline-block;
  margin-bottom: 12px;
}

/* Header & Navigation */
.site-header {
  background-color: var(--paper);
  border-bottom: 1px solid var(--rule);
  width: 100%;
}

.site-nav-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-brand {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.site-brand:hover {
  color: var(--accent-dk);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-nav a {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
}

.site-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--accent);
}

/* Layout Containers */
.page-main {
  flex: 1;
  width: 100%;
}

.content-container {
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.prose {
  max-width: 68ch;
}

.visual-wide {
  max-width: 980px;
  width: 100%;
  margin: 32px 0;
}

.section-divider {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 64px 0;
}

.content-section {
  margin-bottom: 48px;
}

.content-section:last-child {
  margin-bottom: 0;
}

.content-section h2 {
  margin-bottom: 20px;
}

.content-section h3 {
  margin-top: 24px;
  margin-bottom: 12px;
}

/* 3.1 Dark Hero Band */
.hero-band {
  width: 100%;
  background-color: var(--ink-deep);
  background-image: linear-gradient(rgba(13, 23, 32, 0.82), rgba(13, 23, 32, 0.92)), url('/assets/hero-water.webp');
  background-size: cover;
  background-position: center;
  padding: 96px 24px;
  color: #FFFFFF;
}

.hero-content {
  max-width: 980px;
  margin: 0 auto;
}

.hero-band .eyebrow {
  color: var(--accent-lt);
}

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

.hero-subtitle {
  font-size: clamp(17px, 3.8vw, 20px);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.72);
  max-width: 62ch;
}

.hero-overlap-wrapper {
  max-width: 980px;
  margin: -48px auto 0;
  padding: 0 24px;
  position: relative;
  z-index: 5;
}

/* 3.2 Main Line Sequence Diagram */
.mainline-card {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 24px;
}

.mainline-diagram {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.diagram-node {
  flex: 1;
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 12px 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  white-space: nowrap;
}

.diagram-node.filter-node {
  background-color: var(--accent);
  border: 2px solid var(--accent);
  color: #FFFFFF;
  font-weight: 600;
}

.diagram-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.diagram-arrow svg {
  display: block;
}

.diagram-caption {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 12px;
  line-height: 1.5;
}

@media (max-width: 700px) {
  .mainline-diagram {
    flex-direction: column;
    gap: 8px;
  }
  .diagram-node {
    width: 100%;
    padding: 10px 12px;
  }
  .diagram-arrow {
    transform: rotate(90deg);
  }
}

/* 3.3 Comparison Matrix Table */
.matrix-wrapper {
  width: 100%;
  margin: 32px 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background-color: var(--surface);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.comparison-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background-color: var(--ink);
  color: #FFFFFF;
  padding: 14px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  vertical-align: bottom;
  line-height: 1.35;
}

.comparison-table th:last-child {
  border-right: none;
}

.comparison-table td {
  padding: 12px 12px;
  border-top: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.comparison-table td:last-child {
  border-right: none;
}

.comparison-table td.col-system {
  font-weight: 600;
  background-color: var(--accent-lt);
  color: var(--ink);
  white-space: nowrap;
}

.comparison-table td.val-yes {
  background-color: var(--accent-lt);
  color: var(--accent-dk);
  font-weight: 600;
  text-align: center;
}

.comparison-table td.val-partly {
  background-color: var(--surface);
  color: var(--ink-soft);
  text-align: center;
}

.comparison-table td.val-no {
  background-color: var(--warn-lt);
  color: var(--warn);
  text-align: center;
}

@media (max-width: 760px) {
  .comparison-table th:first-child,
  .comparison-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.06);
  }
}

/* 3.4 "What It Does Not Do" Block */
.does-not-block {
  background-color: var(--warn-lt);
  border-left: 3px solid var(--warn);
  padding: 16px 20px;
  border-radius: 0 4px 4px 0;
  margin: 24px 0 32px;
}

.does-not-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 6px;
}

.does-not-text {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
}

/* 3.5 System Icons and H2 Alignment */
.system-heading-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  margin-bottom: 16px;
}

.system-heading-wrapper h2 {
  margin-bottom: 0;
}

.system-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.system-icon svg {
  width: 32px;
  height: 32px;
  stroke: var(--accent);
  stroke-width: 1.5;
  fill: none;
}

/* 3.6 Sequencing Diagram */
.sequencing-card {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 24px;
  margin: 32px 0;
}

.sequencing-diagram {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  max-width: 520px;
  margin: 0 auto;
}

.seq-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.seq-node {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 10px 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  width: 130px;
  text-align: center;
  flex-shrink: 0;
}

.seq-connector {
  display: flex;
  align-items: center;
  width: 100%;
  margin-left: 57px;
  height: 36px;
  position: relative;
}

.seq-arrow-down {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
}

.seq-annotation {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 20px;
}

.seq-annotation::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background-color: var(--accent);
}

/* Article Cards */
.article-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin: 24px 0 32px;
}

.article-card {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.article-card h3 {
  margin-bottom: 12px;
}

.article-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.article-card h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.article-card-desc {
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* Disclosure Bar */
.disclosure-bar {
  background-color: var(--accent-lt);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: 0 4px 4px 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 24px 0 32px;
}

.disclosure-bar a {
  color: var(--accent-dk);
  font-weight: 500;
}

/* Image Banner */
.article-banner-img {
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--rule);
  margin: 24px 0;
  display: block;
}

/* Lists */
.styled-ol {
  margin: 20px 0 24px 20px;
  padding-left: 8px;
}

.styled-ol li {
  margin-bottom: 12px;
  padding-left: 4px;
}

.styled-ul {
  list-style-type: disc;
  margin: 20px 0 24px 24px;
}

.styled-ul li {
  margin-bottom: 10px;
}

/* Author Section & Footer */
.author-box {
  background-color: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px 24px;
  margin-top: 64px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
}

.author-name {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--ink);
}

.author-bio {
  color: var(--ink-soft);
}

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 24px;
  margin-top: auto;
  background-color: var(--paper);
}

.footer-container {
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
  color: var(--ink-soft);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--ink);
  text-decoration: underline;
}

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