/* Pine2Py — light product theme. Design tokens first, components after.
   No build step: plain CSS, custom properties only. */

:root {
  /* color */
  --bg: #f6f8fa;
  --bg-soft: #edf1f5;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --panel-edge: #dde4ec;
  --edge: #dde4ec;
  --edge-strong: #c3cedd;
  --text: #16222e;
  --text-dim: #51637a;
  --text-faint: #5d7189;
  --accent: #0b8159;
  --accent-dim: #0b8159;
  --accent-deep: #096e4c;
  --accent-ink: #ffffff;
  --accent-glow: rgba(16, 185, 129, 0.10);
  --accent-edge: rgba(13, 157, 108, 0.35);
  --code-bg: #f8fafc;
  --warn: #b45309;
  --err: #dc2626;

  /* spacing scale */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 88px;

  /* radius & shadow */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --shadow-card: 0 1px 2px rgba(15, 35, 55, 0.06), 0 8px 24px rgba(15, 35, 55, 0.07);
  --shadow-pop: 0 12px 32px rgba(15, 35, 55, 0.14);
  --shadow-accent: 0 0 0 1px var(--accent-edge), 0 12px 36px rgba(16, 185, 129, 0.12);

  /* type */
  --mono: Consolas, "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, "Courier New", monospace;
  --sans: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(16, 185, 129, 0.22); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 var(--sp-5); }
.container-narrow { max-width: 760px; }

h1 { font-size: clamp(34px, 5.4vw, 58px); line-height: 1.08; letter-spacing: -0.025em; font-weight: 750; }
h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.02em; font-weight: 700; text-align: center; line-height: 1.2; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-soft); border: 1px solid var(--edge); border-radius: 5px; padding: 1px 5px; }
a { color: var(--accent); }
.accent { color: var(--accent); }
.eyebrow {
  text-align: center; font-size: 12.5px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin-bottom: var(--sp-3);
}
.section-sub { color: var(--text-dim); text-align: center; margin: var(--sp-3) auto 0; max-width: 560px; }

/* visible keyboard focus everywhere */
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, textarea:focus-visible, .CodeMirror-focused {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); background: rgba(255, 255, 255, 0.86); border-bottom: 1px solid var(--edge); }
.nav-inner { max-width: 1120px; margin: 0 auto; padding: 13px var(--sp-5); display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.brand-sm { font-size: 15px; }
.nav-links { display: flex; gap: 24px; margin-left: auto; }
.nav-links a { color: var(--text-dim); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.nav-links a:hover { color: var(--text); }
.nav-inner > .btn { margin-left: 0; }
.nav-links + .btn { margin-left: 4px; }
@media (max-width: 640px) { .nav-links { display: none; } .nav-inner { justify-content: space-between; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-sm); padding: 11px 20px; font-size: 15px; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  font-family: var(--sans);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent-dim); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(11, 129, 89, 0.28); }
.btn-primary:hover { background: var(--accent-deep); }
.btn-primary:disabled { opacity: 0.55; cursor: default; box-shadow: none; }
.btn-ghost { background: #ffffff; color: var(--text); border-color: var(--edge-strong); }
.btn-ghost:hover { border-color: var(--text-faint); background: var(--panel-2); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--accent); font: inherit; font-size: 13.5px; cursor: pointer; padding: 2px 6px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero { padding: 84px 0 72px; text-align: center; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: -40% -20% auto; height: 130%;
  background: radial-gradient(640px 340px at 50% 0%, var(--accent-glow), transparent 70%);
  pointer-events: none;
}
.hero .container { position: relative; }
.pill {
  display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--accent-glow); border: 1px solid var(--accent-edge);
  border-radius: var(--r-pill); padding: 5px 14px; margin-bottom: 22px;
}
.hero-sub { color: var(--text-dim); max-width: 640px; margin: 20px auto 30px; font-size: 17.5px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 14px; justify-content: center; margin-top: 44px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-md); padding: 16px 22px; min-width: 200px; box-shadow: var(--shadow-card); }
.stat strong { display: block; font-size: 22px; color: var(--accent); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--text-dim); }

/* hero code showcase */
.showcase {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: var(--sp-4);
  max-width: 980px; margin: 52px auto 0; text-align: left;
}
.code-card {
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-card); display: flex; flex-direction: column; margin: 0;
}
.code-card-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--edge); background: var(--panel-2);
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--edge-strong); display: block; }
.dots i:nth-child(1) { background: #f87171; }
.dots i:nth-child(2) { background: #fbbf24; }
.dots i:nth-child(3) { background: #34d399; }
.code-card-name { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }
.code-card-lang { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.code-body {
  font-family: var(--mono); font-size: 12.8px; line-height: 1.6; padding: 16px 18px;
  overflow-x: auto; color: var(--text); flex: 1; background: var(--code-bg);
}
.code-body code { background: none; border: none; padding: 0; font-size: inherit; }
.tok-kw  { color: #7c3aed; }
.tok-fn  { color: #2563eb; }
.tok-str { color: #15803d; }
.tok-num { color: #c2410c; }
.tok-com { color: #64748b; font-style: italic; }
.tok-dec { color: #b45309; }
.showcase-arrow {
  align-self: center; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-glow); border: 1px solid var(--accent-edge); color: var(--accent);
}
@media (max-width: 860px) {
  .showcase { grid-template-columns: 1fr; }
  .showcase-arrow { margin: 0 auto; transform: rotate(90deg); }
}

/* ---------- converter ---------- */
.converter { padding: 24px 0 76px; }
.conv-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.conv-head h2 { text-align: left; }
.conv-toolbar { display: flex; gap: 10px; align-items: center; position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px;
  background: var(--panel-2); border: 1px solid var(--edge); border-radius: var(--r-md);
  padding: 6px; box-shadow: var(--shadow-pop);
}
.dropdown-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 9px 12px; font: inherit; font-size: 14px; border-radius: 7px; cursor: pointer;
}
.dropdown-menu button:hover { background: rgba(15, 35, 55, 0.05); }

.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .panes { grid-template-columns: 1fr; } }
.pane { background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-md); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-card); }
.pane-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--edge); background: var(--panel-2); }
.pane-title { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.pane-actions { margin-left: auto; display: inline-flex; gap: 2px; }
.pane-badge {
  margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-faint);
  border: 1px solid var(--edge); border-radius: var(--r-pill); padding: 2px 10px; white-space: nowrap;
}
.pane-badge.badge-ok { color: var(--accent); border-color: var(--accent-edge); }
.pane-badge.badge-warn { color: var(--warn); border-color: rgba(180, 83, 9, 0.45); }
.pane-badge.badge-err { color: var(--err); border-color: rgba(220, 38, 38, 0.4); }
.pane-actions + .pane-badge { margin-left: 0; }

.editor-host { height: 380px; }
.editor-host textarea, .CodeMirror {
  height: 100% !important; font-family: var(--mono); font-size: 13.5px; line-height: 1.55;
  background: var(--code-bg); color: var(--text);
}
.editor-host textarea { width: 100%; height: 100%; border: none; outline: none; resize: none; padding: 14px; background: var(--code-bg); }

.diag { border-top: 1px solid var(--edge); padding: 12px 14px; background: var(--bg-soft); }
.diag-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--warn); }
.diag-title.is-err { color: var(--err); }
.diag-title.is-ok { color: var(--accent); }
.diag-list { margin-left: 18px; font-size: 13px; color: var(--text-dim); }
.diag-list li { margin: 3px 0; }
.conv-note { text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 16px; }

/* ---------- features ---------- */
.features, .how, .faq, .pricing { padding: var(--sp-9) 0; }
.features { border-top: 1px solid var(--edge); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 40px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-md);
  padding: 24px; box-shadow: var(--shadow-card);
  transition: border-color .15s, transform .15s;
}
.feature:hover { border-color: var(--edge-strong); transform: translateY(-2px); }
.feature-icon {
  width: 44px; height: 44px; border-radius: 10px; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); background: var(--accent-glow); border: 1px solid var(--accent-edge);
}
.feature p { color: var(--text-dim); font-size: 14.5px; margin-top: 8px; }

/* ---------- how ---------- */
.how { background: var(--bg-soft); border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin-top: 40px; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }
.step { display: flex; gap: 14px; }
.step-n {
  flex: none; width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-glow); color: var(--accent); font-weight: 700; font-size: 14px;
  border: 1px solid var(--accent-edge);
}
.step p { color: var(--text-dim); font-size: 14.5px; margin-top: 6px; }

/* ---------- faq ---------- */
.faq h2 { margin-bottom: 36px; }
.faq details { border: 1px solid var(--edge); border-radius: 10px; background: var(--panel); margin-bottom: 10px; padding: 0 18px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 15px 24px 15px 0; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; color: var(--text-faint); font-size: 18px; }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--text-dim); font-size: 14.5px; padding: 0 0 16px; }

/* ---------- pricing ---------- */
.pricing { background: var(--bg-soft); border-top: 1px solid var(--edge); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 740px; margin: 40px auto 0; align-items: stretch; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }
.plan {
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-lg);
  padding: 30px 28px; position: relative; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
}
.plan-pro { border-color: var(--accent-edge); box-shadow: var(--shadow-accent); }
.plan-tag {
  position: absolute; top: -12px; left: 24px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--accent-dim); color: var(--accent-ink); border-radius: var(--r-pill); padding: 3px 11px; text-transform: uppercase;
}
.plan h3 { font-size: 15px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-dim); }
.plan-pro h3 { color: var(--accent); }
.price { font-size: 40px; font-weight: 750; margin: 12px 0 20px; letter-spacing: -0.02em; line-height: 1; }
.price span { font-size: 15px; font-weight: 400; color: var(--text-dim); letter-spacing: 0; }
.plan ul { list-style: none; margin-bottom: 26px; }
.plan li {
  padding: 6px 0 6px 28px; position: relative; color: var(--text-dim); font-size: 14.5px;
}
.plan li::before {
  content: ""; position: absolute; left: 0; top: 8px; width: 17px; height: 17px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b8159' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 10'/%3E%3C/svg%3E") center / contain no-repeat;
}
.plan .btn { margin-top: auto; }
.pricing-note { text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 24px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--edge); padding: 52px 0 34px; background: var(--bg-soft); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }
.footer-tagline { color: var(--text-faint); font-size: 13.5px; margin-top: 12px; line-height: 1.55; }
.footer-col h4 { font-size: 12.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 12px; }
.footer-col a { display: block; color: var(--text-dim); text-decoration: none; font-size: 14px; padding: 3px 0; }
.footer-col a:hover { color: var(--text); }
.footer-bottom {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--edge);
  color: var(--text-faint); font-size: 12.5px; display: flex; gap: 16px; flex-wrap: wrap;
}

/* ---------- legal pages ---------- */
.legal { padding: 56px 0 72px; }
.legal h1 { font-size: clamp(28px, 4vw, 40px); text-align: left; margin-bottom: 8px; }
.legal .legal-updated { color: var(--text-faint); font-size: 13.5px; margin-bottom: 36px; }
.legal h2 { font-size: 20px; text-align: left; margin: 34px 0 10px; }
.legal h3 { font-size: 16px; margin: 22px 0 8px; }
.legal p, .legal li { color: var(--text-dim); font-size: 15px; }
.legal p { margin-bottom: 12px; }
.legal ul, .legal ol { margin: 0 0 12px 22px; }
.legal li { margin: 4px 0; }
.legal a { text-decoration: underline; }
.legal .placeholder {
  font-family: var(--mono); font-size: 0.92em; color: var(--warn);
  background: rgba(217, 119, 6, 0.10); border: 1px dashed rgba(180, 83, 9, 0.45);
  border-radius: 5px; padding: 0 5px; white-space: nowrap;
}

/* ---------- CodeMirror theme overrides ---------- */
.CodeMirror { border: none; }
.CodeMirror-gutters { background: var(--panel-2); border-right: 1px solid var(--edge); }
.CodeMirror-linenumber { color: var(--text-faint); }
.cm-s-pine2py .cm-keyword { color: #7c3aed; }
.cm-s-pine2py .cm-builtin, .cm-s-pine2py .cm-atom { color: #2563eb; }
.cm-s-pine2py .cm-string { color: #15803d; }
.cm-s-pine2py .cm-number { color: #c2410c; }
.cm-s-pine2py .cm-comment { color: #64748b; font-style: italic; }
.cm-s-pine2py .cm-def { color: #b45309; }
.CodeMirror-cursor { border-left: 2px solid var(--accent) !important; }
.CodeMirror-selected { background: rgba(13, 157, 108, 0.14) !important; }

/* app.js does not set a CodeMirror theme option, so the editors run with
   CodeMirror's default theme (cm-s-default) loaded from the CDN *after* this
   file. These editor-host-scoped rules carry the same light palette with
   higher specificity so the converter panes stay readable regardless of
   stylesheet order. */
.editor-host .CodeMirror { background: var(--code-bg); color: var(--text); }
.editor-host .CodeMirror-gutters { background: var(--panel-2); border-right: 1px solid var(--edge); }
.editor-host .CodeMirror-linenumber { color: var(--text-faint); }
.editor-host .cm-s-default .cm-keyword { color: #7c3aed; }
.editor-host .cm-s-default .cm-builtin, .editor-host .cm-s-default .cm-atom { color: #2563eb; }
.editor-host .cm-s-default .cm-string { color: #15803d; }
.editor-host .cm-s-default .cm-number { color: #c2410c; }
.editor-host .cm-s-default .cm-comment { color: #64748b; font-style: italic; }
.editor-host .cm-s-default .cm-def { color: #b45309; }

/* ---------- account / sign-in (accounts v1) ---------- */
.account-area { margin-left: auto; display: flex; align-items: center; }
.account-box { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.account-box[hidden] { display: none; }
.account-email { color: var(--text-dim); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-state { color: var(--accent); border: 1px solid var(--edge); border-radius: 999px; padding: 2px 9px; font-size: 12px; white-space: nowrap; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(22, 34, 46, 0.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; padding: 28px; width: 100%; max-width: 380px; box-shadow: 0 24px 60px rgba(15, 35, 55, 0.22); }
.modal h3 { margin-bottom: 8px; }
.modal-note { color: var(--text-dim); font-size: 14px; margin-bottom: 18px; }
.modal-label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
.modal-input { width: 100%; background: var(--code-bg); border: 1px solid var(--edge); border-radius: 8px; color: var(--text); font-family: var(--sans); font-size: 15px; padding: 10px 12px; margin-bottom: 12px; }
.modal-input:focus { outline: none; border-color: var(--accent); }
.modal-msg { margin-top: 14px; font-size: 13px; color: var(--text-dim); }
.modal-msg.is-err { color: var(--err); }
.modal-close { position: absolute; top: 10px; right: 14px; background: none; border: none; color: var(--text-faint); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
