/* CholTECH Site Styles */

/* Design Tokens: Light Mode is the Default */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --surface: #ffffff;
  --text: #1a2230;
  --text-muted: #5a6577;
  --border: #e2e7ee;
  --accent: #1f5fbf;
  --accent-hover: #174a96;
  --accent-soft: #e8f0fc;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 12px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --wrap: 1120px;
  --measure: 740px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e131b;
  --bg-alt: #141b25;
  --surface: #18202c;
  --text: #e6ebf2;
  --text-muted: #9aa6b8;
  --border: #283244;
  --accent: #6aa5ff;
  --accent-hover: #93bdff;
  --accent-soft: #1b2a42;
  --on-accent: #0b1220;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color .2s ease, color .2s ease;
}

main { flex: 1; }

/* All Paragraphs are Fully Justified */
p {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  margin: 0 0 1.1em;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 750; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 650; }

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

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

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

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: var(--measure); }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--on-accent); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.2rem; letter-spacing: -.01em; }
.brand:hover { color: var(--text); }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand .tech { color: var(--accent); }

.nav { margin-left: auto; }
.nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-weight: 550; font-size: .95rem; }
.nav a:hover { color: var(--text); background: var(--bg-alt); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; }

/* Show the Icon for the Mode the Button Switches To */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }

@media (max-width: 760px) {
  .menu-toggle { display: inline-grid; }
  .nav { order: 3; margin-left: 0; }
  .header-inner { justify-content: space-between; gap: 0; }
  .header-actions { display: flex; gap: 8px; margin-left: auto; }
  .nav ul {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 64px;
    flex-direction: column;
    padding: 12px 20px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .nav.open ul { display: flex; }
  .nav a { padding: 12px; font-size: 1rem; }
}
@media (min-width: 761px) { .header-actions { display: flex; gap: 8px; } }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .98rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.6rem 0; }

/* Hero */
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 112px) 0 clamp(48px, 8vw, 88px);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1000px 400px at 85% -10%, var(--accent-soft), transparent 70%),
    linear-gradient(var(--bg), var(--bg));
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .55), transparent 85%);
  pointer-events: none;
}
.hero .wrap { position: relative; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; }
.lead { font-size: 1.15rem; color: var(--text-muted); max-width: 62ch; }

/* Page Header */
.page-header { padding: clamp(40px, 7vw, 72px) 0 28px; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.page-header h1 { margin-bottom: .3em; }
.page-header .lead { margin: 0; max-width: none; }
.crumb { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; text-decoration: none; margin-bottom: 14px; }

/* Sections */
.section { padding: clamp(48px, 7vw, 80px) 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 0; }
.section-head a { font-weight: 600; text-decoration: none; }

/* Grids and Cards */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.card-media { aspect-ratio: 16 / 9; background: var(--bg-alt); border-bottom: 1px solid var(--border); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.card-media.placeholder { display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-soft), var(--bg-alt)); color: var(--accent); font-weight: 750; font-size: 1.1rem; letter-spacing: .04em; }
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { margin-bottom: .45em; }
.card-body p { color: var(--text-muted); font-size: .95rem; margin-bottom: 0; }
.card-meta { font-size: .82rem; color: var(--text-muted); margin-bottom: 8px; }
.card-more { margin-top: auto; padding-top: 14px; font-weight: 600; font-size: .92rem; color: var(--accent); }

.feature { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.feature .icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.feature .icon svg { width: 22px; height: 22px; }
.feature p { color: var(--text-muted); font-size: .95rem; margin: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 10px; }
.tags li { font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* Prose: Article and Page Body */
.prose { padding: 40px 0 64px; }
.prose figure { margin: 2em 0; text-align: center; }
.prose figure img, .prose > img { border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .35em; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.4em 0; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--bg-alt); padding: 2px 5px; border-radius: 4px; }
.prose blockquote { margin: 1.5em 0; padding: .4em 1.2em; border-left: 3px solid var(--accent); color: var(--text-muted); }

.prose .actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.6em 0; }
.prose .actions p { margin: 0; }

.prose .wp-block-file { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; padding: 14px 18px; margin: 1.6em 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-alt); }
.prose .wp-block-file a:first-child { font-weight: 600; }
.prose .wp-block-file__button { padding: 7px 14px; border-radius: 8px; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; font-size: .9rem; }
.prose .wp-block-file__button:hover { background: var(--accent-hover); color: var(--on-accent); }

.article-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-muted); font-size: .92rem; margin-top: 10px; }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; border-top: 1px solid var(--border); padding: 28px 0 64px; }
.post-nav a { display: block; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); }
.post-nav a:hover { border-color: var(--accent); }
.post-nav small { display: block; color: var(--text-muted); font-size: .8rem; margin-bottom: 4px; }
.post-nav .next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } .post-nav .next { grid-column: 1; } }

/* About */
.founder { display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: start; }
.founder img { width: 100%; border-radius: 16px; border: 1px solid var(--border); }
@media (max-width: 700px) { .founder { grid-template-columns: 1fr; } .founder img { max-width: 200px; } }
.creds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; list-style: none; padding: 0; margin: 1.2em 0 1.6em; }
.creds li { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: .92rem; }
.creds strong { color: var(--accent); margin-right: 6px; }

.panel { padding: 26px 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-alt); }
.panel h2, .panel h3 { margin-top: 0; }
.panel p:last-child { margin-bottom: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-alt); padding: 36px 0; font-size: .92rem; color: var(--text-muted); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; align-items: center; }
.footer-inner ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; }
.footer-inner a { color: var(--text-muted); text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
