/* Shared stylesheet for the AI Business Cards example pages (/cards/<slug>/). */

:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #dce1e8;
  --ink: #0a0a0a;
  --ink-secondary: #5f6770;
  /* --brand / --brand-text mirror src/theme/colors.css (--color-brand / --brand-dark). These static
     /cards/ pages cannot import the Tailwind @utility layer, so the values are duplicated here; keep
     them in sync if the brand palette changes. */
  --brand: #00c2b2;
  --brand-text: #006875;
  --brand-text-hover: #00525c;
  --track: #e9edf2;
  --pre-bg: #f4f6f8;
  --radius: 12px;
  --font-sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Focus. --brand-text (#006875) keeps the indicator above the 3:1
   non-text contrast minimum on both --bg and --card; #00C2B2 sits at 2.2:1. */
:focus-visible {
  outline: 2px solid var(--brand-text);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: #ffffff;
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 1rem;
}

/* Layout column */
header[role='banner'],
main,
footer[role='contentinfo'] {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Header */
header[role='banner'] {
  padding-top: 2rem;
}

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1.25rem;
}

.business-name {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.subdomain-pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--brand-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* View switcher (pill tabs) */
[role='tablist'] {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
}

[role='tab'] {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

[role='tab']:hover {
  color: var(--ink);
}

/* Filled controls use the dark-teal --brand-text fill + white text so the label clears WCAG AA
   (white on #006875 is ~5.7:1). Mint --brand fill would be ~2.2:1, below the 4.5:1 text bar, so it
   stays for non-text accents only. */
[role='tab'][aria-selected='true'] {
  background: var(--brand-text);
  color: #ffffff;
}

/* Panels as content cards */
[role='tabpanel'] {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin-top: 1.25rem;
}

@media (min-width: 600px) {
  [role='tabpanel'] {
    padding: 2.5rem 2.5rem;
  }
}

/* Typography */
h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

@media (min-width: 600px) {
  h1 {
    font-size: 2.125rem;
  }
}

h2 {
  margin: 2.5rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--brand-text);
}
a:hover {
  color: var(--ink);
}

ul,
ol {
  margin: 0 0 1rem;
  padding-left: 1.4rem;
}
li {
  margin-bottom: 0.4rem;
}

.tagline {
  margin: 0 0 1.5rem;
  color: var(--ink-secondary);
  font-size: 1.0625rem;
}

/* Persona portrait */
.persona {
  display: block;
  width: 160px;
  height: 160px;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  object-fit: cover;
}

@media (min-width: 600px) {
  .persona {
    width: 200px;
    height: 200px;
  }
}

/* Services */
.service {
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}
.service:last-of-type {
  padding-bottom: 0;
}
.service p {
  margin-bottom: 0;
}

/* FAQ */
details {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  background: var(--card);
}

summary {
  list-style: none;
  position: relative;
  padding: 0.8rem 2.4rem 0.8rem 1rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}

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

summary::after {
  content: '+';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--brand-text);
  font-size: 1.2rem;
  font-weight: 600;
}

details[open] summary::after {
  content: '\2212';
}

details > p {
  padding: 0 1rem 1rem;
  margin: 0;
}

/* Ring network (tier 2-3) */
nav.ring ul {
  list-style: none;
  padding-left: 0;
}
nav.ring li {
  margin-bottom: 0.5rem;
}

/* Testimonials and case study (tier 3) */
blockquote {
  margin: 0 0 1rem;
  padding: 0.9rem 1.1rem;
  border-left: 3px solid var(--brand);
  background: var(--pre-bg);
  border-radius: 0 8px 8px 0;
}
blockquote p {
  margin-bottom: 0.5rem;
}
blockquote footer {
  font-size: 0.875rem;
  color: var(--ink-secondary);
}

/* Contact */
address {
  font-style: normal;
  margin-bottom: 0.75rem;
  line-height: 1.8;
}

.hours {
  color: var(--ink-secondary);
}

/* AI panel */
pre {
  background: var(--pre-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  font-family: var(--font-mono);
}

.ai-note {
  color: var(--ink-secondary);
}

/* Category score bars */
.category-list {
  padding-left: 1.4rem;
}
.category-list li {
  margin-bottom: 0.9rem;
}
.category-label {
  display: block;
  font-weight: 600;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.score-track {
  flex: 1 1 auto;
  display: block;
  height: 8px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.score-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.score-value {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--brand-text);
}

/* Triples table */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

caption {
  text-align: left;
  color: var(--ink-secondary);
  font-size: 0.8125rem;
  padding-bottom: 0.5rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 600;
}

/* Citable chunks */
.chunk-list {
  list-style: none;
  padding-left: 0;
}
.chunk-list li {
  margin-bottom: 1.25rem;
}
.chunk-label {
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* CTA strip */
.cta-strip {
  margin-top: 1.5rem;
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  text-align: center;
}

.cta-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  /* Dark-teal fill + white text clears AA (~5.7:1); the mint fill would not. */
  background: var(--brand-text);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.cta-button:hover {
  background: var(--brand-text-hover);
  color: #ffffff;
}

.cta-secondary {
  margin: 0.9rem 0 0;
  font-size: 0.9375rem;
}

/* Footer */
footer[role='contentinfo'] {
  padding-top: 2rem;
  padding-bottom: 3rem;
  color: var(--ink-secondary);
  font-size: 0.8125rem;
  line-height: 1.7;
}

footer[role='contentinfo'] p {
  margin-bottom: 0.5rem;
}

/* ===== First-visit AI transformation intro ===== */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* While the AI tab still reads "Create AI-friendly version", give the
   longer label room on narrow screens. */
@media (max-width: 480px) {
  [role='tablist'].has-create-label {
    flex-wrap: wrap;
  }
  [role='tablist'].has-create-label [role='tab'] {
    padding: 0.45rem 0.7rem;
    font-size: 0.8125rem;
  }
}

/* The AI panel hosts the overlay while the sequence plays. */
.ai-intro-host {
  position: relative;
}

.ai-intro-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--card);
  border-radius: var(--radius);
  transition: opacity 0.5s ease 0.1s;
}

.ai-intro-overlay.is-clearing {
  opacity: 0;
  pointer-events: none;
}

.ai-intro-stage {
  position: sticky;
  top: 0;
  min-height: 340px;
  padding: 2.5rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 600px) {
  .ai-intro-stage {
    padding: 2.5rem;
    min-height: 400px;
  }
}

.ai-intro-skip {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 4;
  appearance: none;
  cursor: pointer;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
}

.ai-intro-skip:hover {
  color: var(--ink);
  border-color: var(--ink-secondary);
}

.ai-intro-step {
  margin: 0;
  min-height: 1.2em;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-text);
}

/* Scenes stack in one grid cell; only the active one is visible. */
.ai-intro-scenes {
  flex: 1 1 auto;
  display: grid;
  min-width: 0;
}

.ai-intro-scene {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.3s ease,
    transform 0.35s ease,
    visibility 0s linear 0.35s;
}

.ai-intro-scene.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.3s ease 0.05s,
    transform 0.35s ease 0.05s,
    visibility 0s;
}

/* Stage 1: scanline over a miniature of the human page. */
.ai-intro-scan {
  transform-origin: top center;
}

.ai-intro-scan.is-leaving {
  transform: scaleY(0.06);
}

.ai-scan-doc {
  position: relative;
  max-width: 460px;
  padding: 0.25rem 0;
}

.ai-scan-beam {
  position: absolute;
  left: -6px;
  right: -6px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
  box-shadow: 0 0 12px 2px rgba(0, 194, 178, 0.45);
  opacity: 0;
}

.ai-intro-scan.is-active .ai-scan-beam {
  animation: aiBeamSweep 1.15s linear forwards;
}

@keyframes aiBeamSweep {
  0% {
    top: 0;
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    top: 100%;
    opacity: 0;
  }
}

/* The dimmed "not yet read" state uses --ink-secondary (#5F6770, 5.6:1 on the
   white card) so the miniature page text stays AA before the beam lights it. */
.ai-scan-line {
  margin-bottom: 0.5rem;
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--ink-secondary);
}

.ai-scan-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.ai-scan-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  filter: grayscale(1);
}

.ai-intro-scan.is-active .ai-scan-line {
  animation: aiLineLit 0.55s ease forwards;
  animation-delay: var(--d, 0s);
}

@keyframes aiLineLit {
  0% {
    color: var(--ink-secondary);
    background: transparent;
  }
  35% {
    color: var(--brand-text);
    background: rgba(0, 194, 178, 0.14);
  }
  100% {
    color: var(--ink);
    background: transparent;
  }
}

/* Stage 2: real embedding head values stream in. */
.ai-embed-stream {
  max-width: 480px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
}

.ai-num {
  opacity: 0;
}

.ai-intro-embed.is-active .ai-num {
  animation: aiNumIn 0.4s ease forwards;
  animation-delay: var(--d, 0s);
}

@keyframes aiNumIn {
  0% {
    opacity: 0;
    transform: translateY(5px);
    color: var(--brand-text);
  }
  60% {
    opacity: 1;
    color: var(--brand-text);
  }
  100% {
    opacity: 1;
    transform: none;
    color: var(--ink);
  }
}

.ai-embed-tail {
  margin: 0.75rem 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-secondary);
  opacity: 0;
}

.ai-intro-embed.is-active .ai-embed-tail {
  animation: aiFadeIn 0.4s ease forwards;
  animation-delay: 1.05s;
}

@keyframes aiFadeIn {
  to {
    opacity: 1;
  }
}

/* Stage 3: knowledge graph from the page's triples. */
.ai-graph-svg {
  width: 100%;
  height: auto;
  max-height: 56vh;
  display: block;
}

.ai-node {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

.ai-intro-graph.is-active .ai-node {
  animation: aiNodePop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.35) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes aiNodePop {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.ai-node-dot {
  fill: var(--brand);
  stroke: #ffffff;
  stroke-width: 1.5;
}

.ai-node-ring {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
}

.ai-node-label {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--ink);
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
}

.ai-node-label.is-center {
  font-size: 11px;
  font-weight: 700;
}

.ai-edge {
  stroke: #c9cfd6;
  stroke-width: 1;
  fill: none;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.ai-intro-graph.is-active .ai-edge {
  animation: aiEdgeDraw 0.5s ease forwards;
  animation-delay: var(--d, 0s);
}

@keyframes aiEdgeDraw {
  to {
    stroke-dashoffset: 0;
  }
}

.ai-edge-label {
  font-family: var(--font-sans);
  font-size: 9px;
  fill: var(--ink-secondary);
  opacity: 0;
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
}

.ai-intro-graph.is-active .ai-edge-label {
  animation: aiFadeIn 0.35s ease forwards;
  animation-delay: var(--d, 0s);
}

/* Stage 4: graph docks into the corner, panel fades in underneath. */
.ai-intro-scene.is-docking {
  transform-origin: top right;
  transform: scale(0.18);
  opacity: 0;
  transition:
    transform 0.6s ease,
    opacity 0.6s ease;
}

/* Reduced motion: the script never starts the intro, and this guarantees
   that none of the intro animations or transitions can run either. */
@media (prefers-reduced-motion: reduce) {
  .ai-intro-overlay,
  .ai-intro-overlay * {
    animation: none !important;
    transition: none !important;
  }
  .ai-intro-overlay {
    display: none !important;
  }
  .ai-intro-scene {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
}

/* Print */
@media print {
  body {
    background: #ffffff;
  }
  [role='tablist'],
  .skip-link,
  .cta-strip,
  .ai-intro-overlay {
    display: none;
  }
  [role='tabpanel'] {
    border: 0;
    padding: 0;
  }
  a {
    color: var(--ink);
    text-decoration: none;
  }
  pre {
    white-space: pre-wrap;
  }
  .service,
  details,
  blockquote {
    break-inside: avoid;
  }
}
