/* Shared styles for case study pages.
   Mirrors the home page (fixed sidebar, Inter 300/400/500, hairline borders, marker pills).
   Spacing scale: 4, 8, 12, 16, 24, 32, 48, 64, 96 (px). */

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

:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #555555;
  --faint: #767676; /* home uses #999; darkened to meet 4.5:1 on white */
  --border: #e8e8e8;
  --surface: #f7f7f7;
  --accent: #e8a060;
  --accent-text: #b45309; /* accent orange darkened for text contrast */
  --focus: #0b5fff;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;

  --sidebar: 240px;
  --measure: 60ch;
  --radius: 8px;
  --figure-ratio: 4 / 3; /* matches the 1920x1440 source images, so nothing is cropped */
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}

a { color: inherit; text-decoration: none; }

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

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  border-radius: 4px;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar);
  height: 100vh;
  padding: 48px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 4px 0;
  font-size: 13px;
  color: var(--faint);
  transition: color 0.15s;
}
.sidebar-home:hover { color: var(--text); }

.sidebar-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
}

.sidebar-nav a {
  padding: 4px 0;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--faint);
  transition: color 0.15s;
}
.sidebar-nav a:hover,
.sidebar-nav a[aria-current] { color: var(--text); }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar);
  padding: 48px 48px 96px;
}

/* Single centered column: hero, text, figures and footer share this width. */
.cs-content {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
}

/* ── TOP ROW (matches the home social row) ── */
.cs-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.cs-toprow a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  color: var(--faint);
  transition: color 0.15s;
}
.cs-toprow a:hover { color: var(--text); }
.cs-toprow svg { flex-shrink: 0; }

/* ── HERO ── */
.cs-hero {
  margin-bottom: 48px;
  text-align: center;
}

.cs-hero h1 {
  font-size: 32px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.cs-hero-meta {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--faint);
}

/* ── ARTICLE ── */
.cs-article {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.cs-article > p,
.cs-article > ul,
.cs-article > ol,
.cs-article > h2 { max-width: var(--measure); }

.cs-article p,
.cs-article li {
  font-weight: 300;
  line-height: 1.8;
  color: var(--muted);
}

.cs-article h2 {
  margin-top: 32px;
  scroll-margin-top: 24px;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text);
}
.cs-article > h2:first-child { margin-top: 0; }

.cs-article > h3 {
  max-width: var(--measure);
  margin-top: 16px;
  scroll-margin-top: 24px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
}

.cs-article strong { font-weight: 400; color: var(--text); }

.cs-article p a {
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: border-color 0.15s;
}
.cs-article p a:hover { border-color: var(--text); }

/* Bullets use the home page's "·" list with marker-style pills. */
.cs-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
}

.cs-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cs-list li::before { content: "·"; flex-shrink: 0; color: var(--faint); }

.pill {
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 400;
  color: var(--text);
}
.pill-blue   { background: rgba(59, 130, 246, 0.16); }
.pill-red    { background: rgba(239, 68, 68, 0.16); }
.pill-orange { background: rgba(249, 115, 22, 0.18); }
.pill-green  { background: rgba(34, 197, 94, 0.18); }

/* Numbered steps reuse the "·" list layout with 01, 02 markers. */
.cs-list--steps { counter-reset: step; }
.cs-list--steps li { counter-increment: step; gap: 12px; }
.cs-list--steps li::before {
  content: counter(step, decimal-leading-zero);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* Statements from the product's point of view */
.cs-quote {
  align-self: stretch;
  padding-left: 24px;
  border-left: 2px solid var(--faint);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
}

/* Sample alert messages and product output */
.cs-alert {
  align-self: stretch;
  padding: 16px 24px;
  background: var(--surface);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
}
.cs-alert > span { display: block; }
.cs-alert > span + span { margin-top: 8px; }

.cs-alert-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Redacted findings in the paywall example */
.cs-redact {
  width: 240px;
  max-width: 100%;
  height: 12px;
  border-radius: 2px;
  background: #d4d4d4;
}

/* ── FIGURES ── */
.cs-article > figure {
  align-self: stretch;
  margin-top: 16px;
}
.cs-article > figure + :not(h2) { margin-top: 16px; }

.cs-article figure img {
  display: block;
  width: 100%;
  height: auto; /* the height attribute is only a layout-shift hint */
  aspect-ratio: var(--figure-ratio);
  object-fit: contain;
}

.cs-article figcaption {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--muted);
}
.cs-article figcaption .cs-fig-num { color: var(--text); font-weight: 500; }

/* ── TAKEAWAY (home "personal thesis" style) ── */
.cs-takeaway {
  align-self: stretch;
  margin-top: 32px;
  padding: 12px 24px;
  border-left: 2px solid var(--accent);
}

.cs-takeaway h2 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.cs-takeaway p {
  font-size: 16px;
  font-style: italic;
  font-weight: 300;
  line-height: 1.7;
  color: var(--muted);
}

/* ── PROJECT ROWS (playground page) ── */
.cs-hero--left { text-align: left; }

.project-list { display: flex; flex-direction: column; }

.project-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
  transition: opacity 0.15s;
}
@media (hover: hover) { a.project-item:hover { opacity: 0.55; } }
.project-item:last-child { border-bottom: 1px solid var(--border); }

.project-item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 4px;
}
.project-item-name { font-size: 14px; color: var(--text); }
.project-item-tag {
  flex-shrink: 0;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.project-item-desc { font-size: 13px; font-weight: 300; line-height: 1.65; color: var(--muted); }

/* ── MOBILE CONTENTS (built by case-study.js; the sidebar is hidden on small screens) ── */
.cs-mobile-toc {
  display: none;
  margin-bottom: 32px;
  border-block: 1px solid var(--border);
  font-size: 14px;
}
.cs-mobile-toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  list-style: none;
}
.cs-mobile-toc summary::-webkit-details-marker { display: none; }
.cs-mobile-toc summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.15s;
}
.cs-mobile-toc[open] summary::after { transform: rotate(-135deg); }
.cs-mobile-toc-links { display: flex; flex-direction: column; padding-bottom: 8px; }
.cs-mobile-toc-links a {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
}

/* ── READING PROGRESS ── */
.cs-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  width: 100%;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

/* ── HOVER TO ZOOM ── */
.cs-zoom {
  overflow: hidden;
  border-radius: var(--radius);
  cursor: zoom-in;
}

.cs-zoom img {
  transform-origin: var(--zx, 50%) var(--zy, 50%);
  transition: transform 0.35s ease;
}
.cs-zoom:hover img { transform: scale(2); }

@media (prefers-reduced-motion: reduce) {
  .cs-zoom img { transition: none; }
}

/* ── FOOTER ── */
.cs-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--faint);
}
.cs-footer a { display: inline-flex; align-items: center; min-height: 44px; transition: color 0.15s; }
.cs-footer a:hover { color: var(--text); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; max-width: 100%; padding: 16px 16px 64px; }

  .cs-hero h1 { font-size: 26px; }
  .cs-mobile-toc { display: block; }
  .cs-alert { padding: 16px; }
  .cs-quote { padding-left: 16px; }
  .cs-takeaway { padding: 12px 16px; }
}
