/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Self-hosted Geist (variable, weights 100–900). Loaded here so it's available
   on every page — marketing, dashboard, canvas editor, and embeds. Propshaft
   rewrites the url() below to the digested asset path. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/Geist-Variable-b6b8c383.ttf") format("truetype");
}

:root {
  --bg: #0b1220;
  --panel: #121a2b;
  --panel2: #0f1726;
  --border: #243047;
  --text: #e6edf7;
  --muted: #8ea0bd;
  --accent: #38bdf8;
  --accent2: #22d3ee;
  --danger: #f87171;
}

/* In-app replacement for the browser's window.confirm() on destructive
   actions. Driven by app/javascript/confirm_modal.js (Turbo confirm method). */
.app-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 8, 18, 0.72);
  backdrop-filter: blur(2px);
}
.app-confirm-overlay[hidden] { display: none; }

.app-confirm {
  width: 100%;
  max-width: 26rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: app-confirm-in 0.14s ease-out;
}
@keyframes app-confirm-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.app-confirm-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.app-confirm-msg {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}
.app-confirm-msg[hidden] { display: none; }

.app-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.app-confirm-btn {
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 0.55rem;
  border: 1px solid transparent;
  transition: filter 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.app-confirm-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.app-confirm-cancel {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}
.app-confirm-cancel:hover { background: var(--panel2); color: var(--text); }
.app-confirm-ok {
  background: var(--danger);
  color: #2a0808;
}
.app-confirm-ok:hover { filter: brightness(1.08); }

/* ─────────────────────────────────────────────────────────────────────────────
   BLOG
   Styling for rendered Markdown (app/models/blog/post.rb → kramdown).

   Plain CSS rather than Tailwind utilities, for two reasons. kramdown emits
   bare HTML with no classes, so utilities would mean a `prose` plugin or
   post-processing the output; and a Tailwind class that has never appeared in
   this codebase does not exist until the CSS is rebuilt, which fails silently
   (see CLAUDE.md). Everything here is scoped under .blog-prose / .blog-video,
   so none of it can leak onto the canvas or the marketing pages.
   ───────────────────────────────────────────────────────────────────────────── */

.blog-prose {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.75;
}

.blog-prose > * + * { margin-top: 1.25rem; }

.blog-prose h2 {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.35;
  margin-top: 2.75rem;
  margin-bottom: 0.85rem;
  scroll-margin-top: 5rem;   /* the nav is fixed; anchors must clear it */
}
.blog-prose h3 {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  scroll-margin-top: 5rem;
}
.blog-prose h2 + *, .blog-prose h3 + * { margin-top: 0; }

.blog-prose strong { color: #c7d3e6; font-weight: 700; }
.blog-prose em { font-style: italic; }

.blog-prose a {
  color: var(--accent);
  text-decoration: none;
}
.blog-prose a:hover { text-decoration: underline; }

.blog-prose ul, .blog-prose ol { padding-left: 1.4rem; }
.blog-prose ul { list-style: disc; }
.blog-prose ol { list-style: decimal; }
.blog-prose li + li { margin-top: 0.5rem; }
.blog-prose li::marker { color: #4a5c73; }

.blog-prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1.1rem;
  color: #c7d3e6;
  font-style: italic;
}

.blog-prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.blog-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
}

/* Inline code. `overflow-wrap:anywhere` because a long identifier in prose
   would otherwise push the article past the viewport on a phone. */
.blog-prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
  color: #c7d3e6;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  padding: 0.12em 0.38em;
  overflow-wrap: anywhere;
}

/* Fenced blocks scroll inside themselves rather than widening the page. */
.blog-prose pre {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.6;
}
.blog-prose pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: #c7d3e6;
  overflow-wrap: normal;
}

/* Tables (GFM). Wrapped in their own scroll container for the same reason as
   pre — the body must never scroll horizontally. */
.blog-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  display: block;
  overflow-x: auto;
}
.blog-prose th, .blog-prose td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
}
.blog-prose th { color: #c7d3e6; background: var(--panel); font-weight: 600; }

/* Syntax highlighting (Rouge). A small hand-picked set on the site palette
   rather than a generated Base16 theme, whose #181818 ground fights #0b1220. */
.blog-prose .highlight .c, .blog-prose .highlight .c1,
.blog-prose .highlight .cm, .blog-prose .highlight .cs { color: #5b6b85; font-style: italic; }
.blog-prose .highlight .k, .blog-prose .highlight .kd, .blog-prose .highlight .kn,
.blog-prose .highlight .kp, .blog-prose .highlight .kr { color: #c4a7f0; }
.blog-prose .highlight .kc, .blog-prose .highlight .kt, .blog-prose .highlight .m,
.blog-prose .highlight .mi, .blog-prose .highlight .mf { color: #f0b37e; }
.blog-prose .highlight .s, .blog-prose .highlight .s1, .blog-prose .highlight .s2,
.blog-prose .highlight .sb, .blog-prose .highlight .sd, .blog-prose .highlight .sx,
.blog-prose .highlight .dl { color: #9ede9e; }
.blog-prose .highlight .nf, .blog-prose .highlight .nd { color: var(--accent); }
.blog-prose .highlight .nc, .blog-prose .highlight .nn,
.blog-prose .highlight .no { color: var(--accent2); }
.blog-prose .highlight .nt { color: #f0b37e; }
.blog-prose .highlight .na, .blog-prose .highlight .nv,
.blog-prose .highlight .vi { color: #7fd1e8; }
.blog-prose .highlight .o, .blog-prose .highlight .ow,
.blog-prose .highlight .p { color: #8ea0bd; }
.blog-prose .highlight .gi { color: #9ede9e; }
.blog-prose .highlight .gd { color: var(--danger); }
.blog-prose .highlight .err { color: var(--danger); }

/* ── Video embeds in a post ──
   16:9 by aspect-ratio rather than the padding-top hack, which the browser
   floor in ApplicationController already guarantees (Safari 15, Chrome 88).
   The placeholder shares .blog-video-frame with the real thing, so swapping a
   recording in changes no layout. */
.blog-video { margin: 2rem 0; }
.blog-video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--panel2);
}
.blog-video-frame iframe,
.blog-video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.blog-video figcaption {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: #4a5c73;
  text-align: center;
}

/* The "coming soon" state. Deliberately reads as a deliberate placeholder
   rather than a broken embed — a grey box with no text reads as a failed load. */
.blog-video-placeholder .blog-video-frame {
  border-style: dashed;
  background:
    radial-gradient(circle at 50% 45%, rgba(56, 189, 248, 0.08), transparent 60%),
    var(--panel2);
}
.blog-video-pending {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.5rem;
  text-align: center;
}
.blog-video-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 0.35rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  font-size: 0.9rem;
  padding-left: 0.15rem;   /* optical centring of the ▶ glyph */
}
.blog-video-title {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}
.blog-video-note {
  margin: 0;
  max-width: 32ch;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
