/* =============================================
   TBS Driver Resource Hub — Main Stylesheet
   Tablet-first, clean, functional
   ============================================= */

:root {
  --navy: #0d2340;
  --navy-mid: #1a3a5c;
  --navy-light: #2b5280;
  --accent: #f5a623;
  --accent-light: #d4861a;
  --text: #0d2340;
  --text-muted: #5a6a82;
  --text-light: #8898aa;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #dde3ed;
  --border-light: #eef1f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(26,35,50,0.08);
  --shadow-lg: 0 4px 24px rgba(26,35,50,0.12);
  --font: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --header-height: 64px;
  --footer-height: 56px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

/* =============================================
   HEADER
   ============================================= */

.site-header {
  background: var(--navy);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
}

.logo-mark {
  height: 36px;
  width: 36px;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.9);
}

.logo-text em {
  font-style: normal;
  color: rgba(255,255,255,0.5);
  display: block;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  font-weight: 500;
  background: rgba(255,255,255,0.08);
}

.nav-link:hover {
  color: white;
  background: rgba(255,255,255,0.15);
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 20px 40px;
}

/* =============================================
   PAGE HEADER
   ============================================= */

.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--navy);
}

.page-subtitle {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 15px;
}

/* =============================================
   CATEGORY SECTIONS
   ============================================= */

.category-list {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.category-section {
  /* nothing */
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.category-name {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.category-count {
  background: var(--border-light);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

/* =============================================
   SOP CARDS
   ============================================= */

.sop-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sop-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.15s ease;
  box-shadow: var(--shadow);
}

.sop-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(232,160,32,0.12);
  transform: translateY(-1px);
}

.sop-card:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}

.sop-card-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.sop-id {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--navy);
  background: rgba(245,166,35,0.18);
  border: 1px solid rgba(245,166,35,0.5);
  border-radius: 6px;
  padding: 3px 8px;
}

.sop-info {
  flex: 1;
  min-width: 0;
}

.sop-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sop-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

.sop-arrow {
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sop-card:hover .sop-arrow {
  opacity: 1;
}

/* =============================================
   SOP ARTICLE VIEW
   ============================================= */

.page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--navy);
}

.breadcrumb-sep {
  color: var(--border);
}

.breadcrumb-cat {
  font-size: 14px;
  color: var(--text-muted);
}

.sop-article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.article-header {
  padding: 28px 32px 24px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
}

.article-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: white;
  line-height: 1.3;
}

.article-meta {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}

.article-content {
  padding: 32px;
}

/* =============================================
   NOTION CONTENT STYLES
   ============================================= */

.notion-content {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
}

.notion-content h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.notion-content h1:first-child {
  margin-top: 0;
}

.notion-content h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--navy);
  margin: 28px 0 10px;
}

.notion-content h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-mid);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notion-content p {
  margin: 0 0 12px;
}

.notion-content ul, .notion-content ol {
  padding-left: 24px;
  margin: 0 0 16px;
}

.notion-content li {
  margin-bottom: 6px;
}

.notion-content ul li {
  list-style: none;
  position: relative;
  padding-left: 8px;
}

.notion-content ul li::before {
  content: "•";
  position: absolute;
  left: -16px;
  color: #770031;
  font-weight: 600;
}

.notion-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 8px 16px;
  margin: 16px 0;
  color: var(--text-muted);
  font-style: italic;
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.notion-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--navy);
}

.notion-content pre {
  background: var(--navy);
  border-radius: var(--radius-sm);
  padding: 20px;
  overflow-x: auto;
  margin: 16px 0;
}

.notion-content pre code {
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  padding: 0;
  font-size: 14px;
}

.notion-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

.notion-content strong {
  font-weight: 600;
  color: inherit;
}

.notion-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.notion-content figure {
  margin: 20px auto;
  text-align: center;
}

.notion-content figure img {
  display: block;
  margin: 0 auto;
  max-width: 70%;
}

.notion-content figure img.img-portrait,
.notion-content figure img.img-square {
  max-width: 60%;
}

.notion-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.notion-content figcaption {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* Callout */
.callout {
  display: flex;
  gap: 12px;
  background: #fffbf0;
  border: 1px solid #f5d68a;
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 16px 0;
}

.callout-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.5;
}

/* To-do items */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 6px 0;
}

.todo-item input[type="checkbox"] {
  margin-top: 4px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* Toggle */
.toggle {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 10px 0;
  background: var(--surface);
  transition: box-shadow 0.15s ease;
}

.toggle:hover {
  box-shadow: var(--shadow);
}

.toggle summary {
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  color: var(--navy);
  background: var(--bg);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px; /* tablet touch target */
  transition: background 0.15s ease;
}
.toggle-heading > summary {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.toggle summary:hover {
  background: #edf0f5;
}

.toggle summary::-webkit-details-marker { display: none; }

.toggle summary::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background-color: #770031;
  border-radius: 4px;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-position: center;
  mask-size: contain;
  -webkit-mask-size: contain;
  transition: transform 0.2s ease;
}

.toggle[open] > summary::before {
  transform: rotate(90deg);
}

.toggle[open] summary {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.toggle > div {
  padding: 16px;
  padding-left: 44px;
  animation: toggle-open 0.2s ease;
}

@keyframes toggle-open {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-wrapper td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.table-wrapper tr:last-child td {
  border-bottom: none;
}

.table-wrapper tr:nth-child(even) td {
  background: var(--bg);
}

/* Column layout */
.column-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 16px 0;
}

/* Video embed */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin: 16px 0;
}

.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Child page link */
.child-page-link {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 8px 0;
  font-size: 14px;
}

/* =============================================
   SEARCH
   ============================================= */

.search-container {
  max-width: 640px;
}

.search-form {
  margin-bottom: 28px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,160,32,0.12);
}

.search-icon {
  margin-left: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 16px 12px;
  font-size: 16px;
  font-family: var(--font);
  background: transparent;
  color: var(--text);
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-submit {
  background: var(--accent);
  color: var(--surface);
  border: none;
  padding: 16px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s ease;
}

.search-submit:hover {
  background: var(--accent-light);
}

.search-summary {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 15px;
  max-width: 360px;
  margin: 0 auto;
}

/* =============================================
   FOOTER
   ============================================= */

.site-footer {
  background: var(--navy);
  height: var(--footer-height);
  margin-top: auto;
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-footer span {
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

.offline-status {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
}

.offline-status.ready::before {
  content: "●";
  color: #4caf7d;
  margin-right: 6px;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--navy);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1000;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  background: #1a5c35;
}

.toast.error {
  background: #7c1d1d;
}

/* =============================================
   JUMP NAV
   ============================================= */

.jump-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 16px;
  margin: 16px 0;
}

.jump-nav-label {
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.jump-link {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  background: white;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s ease;
  min-height: 44px;
}

.jump-link:hover {
  background: var(--accent);
  color: var(--surface);
}

.jump-link::before {
  content: none;
}

/* =============================================
   EDIT SUGGESTION
   ============================================= */

.suggestion-section {
  margin-top: 24px;
}

.suggestion-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 48px;
}

.suggestion-toggle:hover {
  border-color: var(--accent);
  color: var(--navy);
  background: white;
}

.suggestion-form-wrap {
  margin-top: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: toggle-open 0.2s ease;
}

.suggestion-form {
  padding: 24px;
}

.suggestion-heading {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
}

.suggestion-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.6;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.15s ease;
  background: var(--bg);
}

.suggestion-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,160,32,0.12);
  background: white;
}

.suggestion-privacy {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
  margin-bottom: 16px;
}

.suggestion-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.suggestion-submit {
  background: var(--accent);
  color: var( --surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s ease;
  min-height: 44px;
}

.suggestion-submit:hover {
  background: var(--accent-light);
}

.suggestion-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.suggestion-cancel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  padding: 11px 8px;
  transition: color 0.15s ease;
}

.suggestion-cancel:hover {
  color: var(--text);
}

.suggestion-status {
  margin-top: 12px;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
}

.suggestion-status.success {
  background: #edfaf3;
  color: #1a5c35;
  border: 1px solid #a8e6c4;
}

.suggestion-status.error {
  background: #fef2f2;
  color: #7c1d1d;
  border: 1px solid #fca5a5;
}

/* =============================================
   IMAGE LIGHTBOX
   ============================================= */

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  animation: lightbox-fade 0.2s ease;
}

.lightbox-overlay.active {
  display: flex;
}

@keyframes lightbox-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-img-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 48px 16px 16px;
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 48px rgba(0,0,0,0.6);
  transition: transform 0.1s ease;
  touch-action: pinch-zoom;
  cursor: zoom-in;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  z-index: 2001;
}

.lightbox-close:hover {
  background: rgba(255,255,255,0.22);
}

.notion-content img {
  transition: opacity 0.15s ease;
}

.notion-content img:hover {
  opacity: 0.88;
}

/* =============================================
   NOTION TEXT COLOURS
   ============================================= */

.notion-content .notion-color-red { color: #e03e3e !important; }
.notion-content .notion-color-orange { color: #d9730d !important; }
.notion-content .notion-color-yellow { color: #cb912f !important; }
.notion-content .notion-color-green { color: #448361 !important; }
.notion-content .notion-color-blue { color: #337ea9 !important; }
.notion-content .notion-color-purple { color: #9065b0 !important; }
.notion-content .notion-color-pink { color: #c14c8a !important; }
.notion-content .notion-color-brown { color: #64473a !important; }
.notion-content .notion-color-gray { color: #9b9a97 !important; }

.notion-bg-red { background: #fbe4e4; padding: 1px 3px; border-radius: 3px; }
.notion-bg-orange { background: #faebdd; padding: 1px 3px; border-radius: 3px; }
.notion-bg-yellow { background: #fef3c7; padding: 1px 3px; border-radius: 3px; }
.notion-bg-green { background: #ddedea; padding: 1px 3px; border-radius: 3px; }
.notion-bg-blue { background: #ddebf1; padding: 1px 3px; border-radius: 3px; }
.notion-bg-purple { background: #eae4f2; padding: 1px 3px; border-radius: 3px; }
.notion-bg-pink { background: #f4dfeb; padding: 1px 3px; border-radius: 3px; }
.notion-bg-brown { background: #f4eeee; padding: 1px 3px; border-radius: 3px; }
.notion-bg-gray { background: #ebeced; padding: 1px 3px; border-radius: 3px; }

/* =============================================
   RESPONSIVE — TABLET
   ============================================= */

@media (max-width: 768px) {
  .main-content {
    padding: 24px 16px 32px;
  }

  .page-title {
    font-size: 22px;
  }

  .article-header {
    padding: 22px 20px 18px;
  }

  .article-title {
    font-size: 21px;
  }

  .article-content {
    padding: 22px 20px;
  }

  .notion-content {
    font-size: 15px;
  }

  .column-list {
    grid-template-columns: 1fr;
  }

  .sop-card-inner {
    padding: 14px 16px;
  }

  .sop-title {
    font-size: 15px;
  }

  .logo-text {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 14px;
  }

  .nav-link {
    padding: 8px 10px;
    font-size: 14px;
  }

  .logo-text em {
    display: none;
  }
}

/* =============================================
   HOME SCREEN
   ============================================= */

.home-screen {
  padding: 32px 0;
}

.home-intro {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.home-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.15s ease;
  min-height: 88px;
}

.home-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.home-card--primary {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.home-card--primary:hover {
  background: var(--navy-mid);
  border-color: var(--navy-mid);
}

.home-card--primary .home-card-desc {
  color: rgba(255,255,255,0.65);
}

.home-card--primary .home-card-arrow {
  color: var(--accent);
}

.home-card-icon {
  font-size: 32px;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}

.home-card-body {
  flex: 1;
}

.home-card-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.3;
}

.home-card-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.home-card-arrow {
  font-size: 20px;
  color: var(--text-light);
  flex-shrink: 0;
}

/* =============================================
   STYLED DOCUMENTS (content_html from the feed)
   The document carries its own masthead and layout; the stylesheet that
   styles it (.sop-doc …) is published with the content at /data/css/sop-doc.css.
   ============================================= */

.sop-article.styled {
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.sop-article.styled .article-content {
  padding: 0;
}

.sop-article.styled .article-content.sop-doc {
  background: transparent;
}

/* Back to top */
.totop {
  position: fixed; right: 14px; bottom: 18px; z-index: 50;
  padding: 10px 14px; border-radius: 999px;
  background: var(--navy); color: white; font: 700 13px/1 var(--font);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25); text-decoration: none;
  opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .15s, transform .15s;
}
.totop.visible { opacity: 1; pointer-events: auto; transform: none; }

/* Footer: two lines on the left (copyright; content published), the offline status on the right,
   in every orientation. The footer grows to fit; nothing is clipped. (Jason, 8 Sept: same layout portrait and landscape.) */
.site-footer { height: auto; min-height: var(--footer-height); }
.footer-inner { height: auto; padding: 10px 20px; align-items: center; gap: 12px; }
.footer-left { line-height: 1.4; }
.footer-pub { display: block; }
.footer-pub .footer-sep { display: none; }
@media (max-width: 640px) {
  .site-footer span { font-size: 12px; line-height: 1.4; }
  .footer-org { display: none; }
}
@media (max-width: 400px) {
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 2px; }
}

/* =============================================
   LANDING PAGE — the six buttons (8 Sept 2026)
   Tiles, 3 × 2 in landscape and 2 × 3 in portrait, one screen on the Samsung Tab Active 5
   (768 × 442 CSS px landscape, 480 × 730 portrait). Each tile reads on its own.
   ============================================= */

.main-content:has(> .home) { padding: 10px 16px 8px; max-width: 900px; }
.home { --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif-condensed, sans-serif; --red: #c0392b; --muted: #5a6a82; }
.home-danger { background: var(--red); color: #fff; border-radius: 10px; padding: 6px 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; line-height: 1.3; }
.home-danger-q { font-family: var(--cond); font-size: 22px; font-weight: 800; letter-spacing: .01em; }
.home-danger-call { background: #fff; color: var(--red); font-family: var(--cond); font-size: 20px; font-weight: 800; padding: 3px 14px; border-radius: 8px; text-decoration: none; white-space: nowrap; }
.home-danger-then { font-size: 14px; font-weight: 700; }
.home-danger-then a { color: #fff; text-decoration: none; white-space: nowrap; display: inline-block; border: 1.5px solid rgba(255,255,255,.85); border-radius: 999px; padding: 1px 10px; margin-left: 2px; }
.home-danger-then a::before { content: ''; display: inline-block; width: .85em; height: .85em; margin-right: .3em; vertical-align: -.08em; background-color: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M6.6%2010.8a15.1%2015.1%200%200%200%206.6%206.6l2.2-2.2c.3-.3.7-.4%201-.2%201.1.4%202.3.6%203.6.6.6%200%201%20.4%201%201V20c0%20.6-.4%201-1%201A17%2017%200%200%201%203%204c0-.6.4-1%201-1h3.5c.6%200%201%20.4%201%201%200%201.3.2%202.5.6%203.6.1.3%200%20.7-.2%201z%22%2F%3E%3C%2Fsvg%3E") no-repeat center / contain; mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cpath%20d%3D%22M6.6%2010.8a15.1%2015.1%200%200%200%206.6%206.6l2.2-2.2c.3-.3.7-.4%201-.2%201.1.4%202.3.6%203.6.6.6%200%201%20.4%201%201V20c0%20.6-.4%201-1%201A17%2017%200%200%201%203%204c0-.6.4-1%201-1h3.5c.6%200%201%20.4%201%201%200%201.3.2%202.5.6%203.6.1.3%200%20.7-.2%201z%22%2F%3E%3C%2Fsvg%3E") no-repeat center / contain; }

.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.home-button { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; gap: 3px; min-width: 0; overflow: hidden; height: 102px; padding: 6px 10px 3px; gap: 2px;
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--navy);
  box-shadow: 0 2px 8px rgba(26,35,50,.06); -webkit-tap-highlight-color: transparent; line-height: 1.2; }
.home-button:active { transform: scale(.985); }
.home-button.mate { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,166,35,.25); }
.home-icon { width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0; display: block; }
.home-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; max-width: 100%; }
.home-title { font-family: var(--cond); font-size: 22px; font-weight: 800; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-sub { font-size: 12px; line-height: 1.18; color: var(--muted); overflow: hidden; max-height: 2.4em; }   /* wraps to two lines, never cut mid-word with an ellipsis */

@media (max-width: 660px) {
  /* portrait on the tablet, and phones: 2 × 3 */
  .home-grid { grid-template-columns: 1fr 1fr; }
  .home-button { height: 124px; }
  .home-icon { width: 50px; height: 50px; }
  .home-title { font-size: 21px; }
}
@media (max-width: 380px) {
  .home-title { font-size: 19px; }
  .home-sub { font-size: 12px; }
  .home-danger-q { font-size: 20px; }
}

/* the phone rule on the main menu, as on SOP-00 and Report It: question navy, the whole answer red */
.home-seat, .home > p, .home + p { margin: 6px 2px 0; font-size: 13px; line-height: 1.35; color: #0d2340; font-weight: 600; text-align: center; }
.home-seat strong, .home > p strong, .home + p strong { color: #c0392b; font-weight: 700; }
@media (max-width: 660px) { .home-seat, .home > p, .home + p { font-size: 14px; margin-top: 10px; } }
