/* ============================================================
   SAMPLE DOCUMENTS — shared styling for the Work Output pieces
   (infographics, reports, SOPs, training decks).
   Same Coastal Retreat tokens as the main site so the samples
   read as one body of work, not clip-art from elsewhere.
   ============================================================ */
:root {
  --paper: #F7F9F8;
  --paper-dim: #DBE2DC;
  --ink: #335765;
  --ink-deep: #223941;
  --ink-soft: #4A6670;
  --ink-faint: #5C7981;
  --amber: #7F543D;
  --amber-bright: #C08A5E;
  --amber-text: #6B4530;
  --amber-on-dark: #E6CBA8;
  --teal: #74A8A4;
  --teal-text: #3D6B66;
  --sky: #B6D9E0;
  --line: rgba(51, 87, 101, 0.14);
  --line-strong: rgba(51, 87, 101, 0.28);
  --ok: #3D6B66;
  --warn: #8C5F27;
  --bad: #A33A2E;

  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'Space Grotesk', 'IBM Plex Mono', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper-dim);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* ---------- Sheet: the "document" surface ---------- */
.sheet {
  max-width: 900px;
  margin: 0 auto;
  background: var(--paper);
  min-height: 100vh;
  box-shadow: 0 0 60px -20px rgba(51, 87, 101, 0.25);
}
.sheet__inner { padding: clamp(2rem, 5vw, 4rem); }

/* ---------- Reading progress ---------- */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 100%;
  background: transparent;
  z-index: 30;
}
.read-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 0.08s linear;
}

/* ---------- Hero band: colour block at the top of a doc ---------- */
.hero-band {
  position: relative;
  margin: 0 0 2.5rem;
  padding: 2.25rem 2rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink-deep) 100%);
  color: var(--paper);
  overflow: hidden;
}
.hero-band::after {
  /* subtle dot field, echoes the deck styling */
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(247,249,248,0.16) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: 0.5;
  pointer-events: none;
  mask-image: linear-gradient(115deg, transparent 45%, black);
  -webkit-mask-image: linear-gradient(115deg, transparent 45%, black);
}
.hero-band__label {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-on-dark);
  margin-bottom: 0.8em;
}
.hero-band__stats {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1.5rem;
}
.hero-band__n {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: var(--paper);
  line-height: 1;
}
.hero-band__n em {
  font-style: normal;
  font-size: 0.5em;
  color: var(--amber-on-dark);
  margin-left: 0.15em;
}
.hero-band__k {
  font-size: 0.76rem;
  color: rgba(247, 249, 248, 0.72);
  margin-top: 0.5em;
  line-height: 1.35;
}
/* `.sheet strong` (declared later in this file) sets a dark ink colour, which
   renders invisible on the dark band. Matching specificity would lose to source
   order, so scope through .sheet to outrank it. */
.sheet .hero-band strong,
.sheet .hero-band em { color: var(--amber-on-dark); font-style: normal; }
.sheet .hero-band__n em { color: var(--amber-on-dark); }

/* ---------- Section header with icon ---------- */
.sec {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 3rem 0 1rem;
}
.sec__icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--paper-dim);
  color: var(--teal-text);
  border: 1px solid var(--line);
}
.sec__icon svg { width: 19px; height: 19px; }
.sec h2 { margin: 0; }

/* ---------- Metric cards with accent bar ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0 2.5rem;
}
.metric {
  position: relative;
  padding: 1.25rem 1.25rem 1.25rem 1.5rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.metric::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent, var(--teal));
}
.metric__n {
  font-family: var(--font-mono);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.metric__k {
  font-size: 0.76rem;
  color: var(--ink-faint);
  margin-top: 0.55em;
  line-height: 1.35;
}
.metric--amber { --accent: var(--amber); }
.metric--amber .metric__n { color: var(--amber-text); }
.metric--teal  { --accent: var(--teal); }
.metric--teal .metric__n { color: var(--teal-text); }
.metric--bad   { --accent: var(--bad); }
.metric--bad .metric__n { color: var(--bad); }
.metric--sky   { --accent: var(--sky); }

/* ---------- Donut / ring chart ---------- */
.rings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1.25rem;
  margin: 1.75rem 0 2.5rem;
  justify-items: center;
}
.ring { text-align: center; }
.ring__svg { width: 112px; height: 112px; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--paper-dim); stroke-width: 10; }
.ring__fill {
  fill: none;
  stroke: var(--ring-color, var(--teal));
  stroke-width: 10;
  stroke-linecap: round;
  /* circumference for r=52 ≈ 326.7; set via --dash at render time */
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 1.1s var(--ease);
}
.ring.is-shown .ring__fill { stroke-dashoffset: var(--offset, 326.7); }
.ring__center {
  transform: rotate(90deg);
  transform-origin: center;
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  fill: var(--ink);
}
.ring__label {
  font-size: 0.76rem;
  color: var(--ink-faint);
  margin-top: 0.6em;
  line-height: 1.35;
  max-width: 15ch;
  margin-inline: auto;
}

/* ---------- Layer stack diagram ---------- */
.layers { margin: 1.75rem 0 2.5rem; }
.layer {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  margin-bottom: 0.6rem;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.layer:hover {
  transform: translateX(4px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px -10px rgba(51,87,101,0.3);
}
.layer__badge {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
}
.layer:nth-child(1) .layer__badge { background: var(--ink); }
.layer:nth-child(2) .layer__badge { background: var(--teal-text); }
.layer:nth-child(3) .layer__badge { background: var(--amber); }
.layer:nth-child(4) .layer__badge { background: var(--amber-bright); }
.layer__t {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 1rem;
  margin-bottom: 0.15em;
}
.layer__d { font-size: 0.83rem; color: var(--ink-faint); line-height: 1.4; }

/* ---------- Icon list ---------- */
.icon-list { list-style: none; padding: 0; margin: 1.25rem 0 2rem; }
.icon-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.85rem;
  align-items: start;
  margin-bottom: 0.9em;
  color: var(--ink-soft);
  font-size: 0.93rem;
}
.icon-list svg {
  width: 18px; height: 18px;
  margin-top: 0.15em;
  color: var(--teal-text);
  flex-shrink: 0;
}
.icon-list--warn svg { color: var(--bad); }

/* ---------- Quote / pull ---------- */
.pull {
  margin: 2.25rem 0;
  padding: 1.5rem 0 1.5rem 1.75rem;
  border-left: 4px solid var(--amber);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  line-height: 1.4;
  color: var(--ink);
  font-style: italic;
}

/* ---------- Return bar ---------- */
.sample-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2rem);
  background: rgba(34, 57, 65, 0.96);
  backdrop-filter: blur(8px);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.sample-bar a {
  color: var(--paper);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s var(--ease);
}
.sample-bar a:hover { opacity: 1; }
.sample-bar__tag {
  padding: 0.25em 0.7em;
  border: 1px solid rgba(247, 249, 248, 0.3);
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------- Document head ---------- */
.doc-head {
  padding-bottom: 1.75rem;
  margin-bottom: 2.5rem;
  border-bottom: 2px solid var(--ink);
}
.doc-head__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber-text);
  margin: 0 0 0.9em;
}
.doc-head h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 0 0 0.5em;
}
.doc-head__lede {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
}
.doc-meta strong { color: var(--ink); font-weight: 500; }

/* ---------- Generic typography ---------- */
.sheet h2 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 600;
  margin: 2.75rem 0 1rem;
  letter-spacing: -0.005em;
}
.sheet h3 {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--teal-text);
  font-weight: 500;
  margin: 2rem 0 0.75rem;
}
.sheet p { margin: 0 0 1em; color: var(--ink-soft); }
.sheet strong { color: var(--ink); }
.sheet ul, .sheet ol { color: var(--ink-soft); padding-left: 1.25em; margin: 0 0 1.25em; }
.sheet li { margin-bottom: 0.4em; }

.section-num {
  font-family: var(--font-mono);
  color: var(--amber-text);
  margin-right: 0.5em;
  font-size: 0.85em;
}

/* ---------- Stat row ---------- */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 2rem 0;
}
.stat-box__num {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--amber-text);
  line-height: 1;
}
.stat-box__label {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 0.5em;
  line-height: 1.35;
}

/* ---------- Callout ---------- */
.callout {
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--amber);
  background: rgba(127, 84, 61, 0.06);
  border-radius: 0 4px 4px 0;
  margin: 1.75rem 0;
}
.callout p:last-child { margin-bottom: 0; }
.callout__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber-text);
  margin-bottom: 0.5em;
}
.callout--teal { border-left-color: var(--teal); background: rgba(116, 168, 164, 0.1); }
.callout--teal .callout__label { color: var(--teal-text); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 520px;
}
th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--paper);
  background: var(--ink);
  padding: 0.85em 1em;
  font-weight: 500;
}
td {
  padding: 0.85em 1em;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  vertical-align: top;
}
tbody tr:nth-child(even) { background: rgba(219, 226, 220, 0.4); }
td strong { color: var(--ink); }

/* ---------- Bar chart (pure CSS) ---------- */
.bars { margin: 1.5rem 0 2rem; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
}
.bar-row__label { color: var(--ink-soft); }
.bar-row__track {
  height: 22px;
  background: var(--paper-dim);
  border-radius: 3px;
  overflow: hidden;
}
/* Bars grow when the chart scrolls into view (JS adds .is-shown), not on page
   load — otherwise the animation is over before the reader ever reaches it. */
.bar-row__fill {
  height: 100%;
  background: var(--teal);
  border-radius: 3px;
  width: 0;
  transition: width 0.9s var(--ease);
  transition-delay: calc(var(--bi, 0) * 0.08s);
}
.bars.is-shown .bar-row__fill { width: var(--w, 0%); }
.bar-row:nth-child(odd) .bar-row__fill { background: var(--amber-bright); }
.bar-row__val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  font-size: 0.82rem;
  min-width: 3.5em;
  text-align: right;
}

/* ---------- Compare grid (authentic vs forged) ---------- */
.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0 2.5rem;
}
.compare__col { border-radius: 6px; overflow: hidden; border: 1px solid var(--line-strong); }
.compare__head {
  padding: 0.9em 1.2em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--paper);
}
.compare__col--ok .compare__head { background: var(--ok); }
.compare__col--bad .compare__head { background: var(--bad); }
.compare__body { padding: 1.2em; background: var(--paper); }
.compare__body ul { margin: 0; padding-left: 1.1em; font-size: 0.88rem; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; padding: 0; margin: 1.25rem 0; }
.checklist li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.85em;
  color: var(--ink-soft);
}
.checklist li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--teal);
  border-radius: 3px;
}
.checklist li::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 0.32em;
  width: 5px;
  height: 9px;
  border: solid var(--teal);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ---------- Step flow ---------- */
.steps { counter-reset: step; margin: 1.5rem 0 2.5rem; }
.step {
  position: relative;
  padding-left: 3.25rem;
  padding-bottom: 1.75rem;
  border-left: 1px solid var(--line-strong);
  margin-left: 1rem;
}
.step:last-child { border-left-color: transparent; padding-bottom: 0; }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -1rem;
  top: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}
.step h4 {
  margin: 0.25em 0 0.4em;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}
.step p { margin-bottom: 0.5em; font-size: 0.92rem; }
.step__meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Timeline (run of show) ---------- */
.ros { margin: 1.5rem 0 2.5rem; }
.ros__item {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1.25rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.ros__time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--amber-text);
}
.ros__what strong { display: block; color: var(--ink); margin-bottom: 0.15em; }
.ros__what span { font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- Crew / org grid ---------- */
.crew {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2.5rem;
}
.crew__card {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}
.crew__role {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal-text);
  margin-bottom: 0.4em;
}
.crew__n {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.crew__desc { font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.5em; line-height: 1.35; }

/* ---------- Pills ---------- */
.pills { display: flex; flex-wrap: wrap; gap: 0.5em; margin: 1rem 0 2rem; }
.pills span {
  font-size: 0.8rem;
  padding: 0.45em 0.9em;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink-soft);
}

/* ---------- Sources ---------- */
.sources {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-faint);
}
.sources h3 { margin-top: 0; }
.sources ol { padding-left: 1.25em; }
.sources li { margin-bottom: 0.5em; word-break: break-word; }
.sources a { color: var(--teal-text); }

/* ---------- Doc footer ---------- */
.doc-foot {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* ---------- Sample notice ---------- */
.sample-note {
  margin-top: 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px dashed var(--line-strong);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--ink-faint);
  background: rgba(219, 226, 220, 0.35);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .compare { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .bar-row__val { text-align: left; }
  .ros__item { grid-template-columns: 1fr; gap: 0.25rem; }
}

@media print {
  body { background: #fff; }
  .sample-bar { display: none; }
  .sheet { box-shadow: none; max-width: none; }
}
