@import "tailwindcss";

@theme {
  --color-white: #ffffff;
  --color-black: #000000;
  --color-ink: #0a0f2e;
  --color-blue: #1e40ff;
  --color-blue-deep: #1530c4;
  --color-mist: #e8ecff;
  --color-line: #e5e8f0;
  --color-paper: #ffffff;
  --color-slate: #4a5280;

  --font-display: "Inter", -apple-system, "Helvetica Neue", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  --container-max: 1200px;
}

@layer base {
  html, body {
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

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

  ::selection {
    background: var(--color-blue);
    color: white;
  }
}

/* Long-form article typography used by /blog/[slug] and product detail pages. */
@layer components {
  .legacy-html {
    color: var(--color-ink);
    font-size: 18px;
    line-height: 1.8;
  }
  .legacy-html > *:first-child { margin-top: 0; }
  .legacy-html > *:last-child { margin-bottom: 0; }
  .legacy-html h1,
  .legacy-html h2,
  .legacy-html h3,
  .legacy-html h4 {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--color-ink);
    line-height: 1.2;
    letter-spacing: -0.015em;
    margin-top: 2em;
    margin-bottom: 0.6em;
  }
  .legacy-html h1 { font-size: 2.25rem; }
  .legacy-html h2 {
    font-size: 1.75rem;
    padding-top: 0.4em;
    border-top: 1px solid var(--color-line);
  }
  .legacy-html h3 { font-size: 1.35rem; }
  .legacy-html h4 { font-size: 1.125rem; }
  .legacy-html p { margin: 1.15em 0; }
  .legacy-html strong, .legacy-html b { font-weight: 700; color: var(--color-ink); }
  .legacy-html a {
    color: var(--color-blue);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1.5px;
    transition: color 150ms ease;
  }
  .legacy-html a:hover { color: var(--color-blue-deep); }
  .legacy-html ul,
  .legacy-html ol {
    margin: 1.25em 0;
    padding-left: 1.5em;
  }
  .legacy-html ul { list-style: disc; }
  .legacy-html ol { list-style: decimal; }
  .legacy-html li { margin: 0.5em 0; }
  .legacy-html li::marker { color: var(--color-blue); }
  .legacy-html blockquote {
    margin: 1.75em 0;
    padding: 1em 1.5em;
    border-left: 4px solid var(--color-blue);
    background: var(--color-mist);
    color: var(--color-ink);
    font-style: italic;
    border-radius: 0 8px 8px 0;
  }
  .legacy-html img {
    max-width: 100%;
    height: auto;
    margin: 2em auto;
    border-radius: 10px;
    display: block;
    box-shadow: 0 1px 3px rgba(10, 15, 46, 0.06), 0 4px 16px rgba(10, 15, 46, 0.06);
  }
  .legacy-html figure { margin: 2em 0; }
  .legacy-html figure figcaption {
    font-size: 0.875rem;
    color: var(--color-slate);
    margin-top: 0.75em;
    text-align: center;
  }
  .legacy-html table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.75em 0;
    font-size: 0.95em;
    border: 1px solid var(--color-line);
    border-radius: 8px;
    overflow: hidden;
  }
  .legacy-html th,
  .legacy-html td {
    border-bottom: 1px solid var(--color-line);
    padding: 0.75em 1em;
    text-align: left;
    vertical-align: top;
  }
  .legacy-html tr:last-child td { border-bottom: 0; }
  .legacy-html th {
    background: var(--color-mist);
    font-weight: 700;
    color: var(--color-ink);
  }
  .legacy-html code {
    background: var(--color-mist);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88em;
    color: var(--color-blue-deep);
  }
  .legacy-html pre {
    background: var(--color-ink);
    color: #e8ecff;
    padding: 1.25em;
    border-radius: 10px;
    overflow-x: auto;
    margin: 1.75em 0;
    font-size: 0.9em;
    line-height: 1.55;
  }
  .legacy-html pre code {
    background: transparent;
    color: inherit;
    padding: 0;
  }
  .legacy-html hr {
    border: 0;
    border-top: 1px solid var(--color-line);
    margin: 2.5em 0;
  }
  .legacy-html iframe,
  .legacy-html video {
    max-width: 100%;
    border-radius: 10px;
    margin: 1.75em 0;
  }
  /* Wrapper around embedded videos (admin-authored via the editor's Video
   * button). Maintains 16:9 aspect for iframes and lets native <video>
   * expand naturally. */
  .legacy-html figure.video-embed {
    margin: 2em 0;
  }
  .legacy-html figure.video-embed .video-embed-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
  }
  .legacy-html figure.video-embed .video-embed-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 10px;
  }
  .legacy-html figure.video-embed video {
    width: 100%;
    margin: 0;
    border-radius: 10px;
    background: #000;
  }
  .legacy-html figure.video-embed figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: var(--color-slate);
    margin-top: 0.75em;
  }

  /* Anchor targets from the sticky TOC need breathing room under the sticky header */
  .legacy-html h2,
  .legacy-html h3,
  .legacy-html h4 {
    scroll-margin-top: 7rem;
  }

  /* Blog-specific flourishes */
  .legacy-html p.blog-lead {
    font-size: 1.2em;
    line-height: 1.6;
    color: var(--color-ink);
  }
  .legacy-html p.blog-lead::first-letter {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--color-blue);
    float: left;
    font-size: 3.8em;
    line-height: 0.85;
    padding: 0.08em 0.1em 0 0;
    margin: 0.08em 0.02em 0 0;
  }
  .blog-body.legacy-html h2 {
    position: relative;
    padding-top: 1.25em;
    border-top: 1px solid var(--color-line);
  }
  .blog-body.legacy-html h2::before {
    content: "";
    display: block;
    width: 36px;
    height: 3px;
    background: var(--color-blue);
    border-radius: 2px;
    margin-bottom: 0.75em;
  }

  /* Scroll-reveal for body sections — powered by CSS scroll-driven animations
     with a graceful fallback: if unsupported, content just shows normally. */
  @keyframes blog-reveal {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @supports (animation-timeline: view()) {
    .blog-body.legacy-html > h2,
    .blog-body.legacy-html > h3,
    .blog-body.legacy-html > p,
    .blog-body.legacy-html > ul,
    .blog-body.legacy-html > ol,
    .blog-body.legacy-html > figure,
    .blog-body.legacy-html > blockquote,
    .blog-body.legacy-html > table,
    .blog-body.legacy-html > pre,
    .blog-body.legacy-html > img {
      animation: blog-reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    .blog-body.legacy-html > * { animation: none !important; }
  }
}
