/* ===========================
   Taimur Code Playground - Shared Styles
   =========================== */

:root {
  --bg: #0f1115;
  --bg-elev: #161922;
  --bg-elev-2: #1d2130;
  --border: #262b3d;
  --border-strong: #353b54;
  --text: #e6e9f2;
  --text-dim: #9aa0b4;
  --text-muted: #6b7088;
  --accent: #7c5cff;
  --accent-hover: #9077ff;
  --accent-soft: rgba(124, 92, 255, 0.15);
  --success: #2ecc71;
  --warning: #f5a623;
  --danger: #ff5470;
  --info: #2dd4ff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --transition: 160ms ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --bg-elev-2: #f0f2f8;
  --border: #e2e6ef;
  --border-strong: #c9cfdc;
  --text: #1a1d29;
  --text-dim: #525872;
  --text-muted: #8c92a8;
  --accent: #6244ff;
  --accent-hover: #4d2eff;
  --accent-soft: rgba(98, 68, 255, 0.12);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 6px 24px rgba(0,0,0,.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }

img { max-width: 100%; display: block; }

/* ===========================
   Layout - Header / Nav
   =========================== */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 17, 21, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .header { background: rgba(255, 255, 255, 0.85); }

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.nav-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  background: linear-gradient(135deg, #7c5cff, #5b8bff);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1.3;
}

/* ============================================================
   Editor sub-nav — sits below the main site pill nav.
   Lets users jump between Home / Editor 2.0 / Classic /
   Gallery / My Pens / Playground without leaving the editor.
   ============================================================ */
.editor-subnav {
  position: sticky;
  top: 96px;                              /* immediately below the 96px-tall main pill nav strip */
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 46px;
  padding: 0 20px;
  background: rgba(13, 16, 24, 0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
  scrollbar-width: none;
}
.editor-subnav::-webkit-scrollbar { display: none; }

.editor-subnav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-right: 6px;
  white-space: nowrap;
}

.editor-subnav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}
.editor-subnav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}
.editor-subnav a.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(10, 132, 255, 0.22));
  border-color: rgba(124, 132, 255, 0.32);
  box-shadow: 0 0 0 1px rgba(124, 132, 255, 0.12), 0 4px 14px rgba(124, 92, 255, 0.2);
}
.editor-subnav-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  background: linear-gradient(135deg, #7c5cff, #5b8bff);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .editor-subnav { padding: 0 12px; gap: 2px; height: 42px; }
  .editor-subnav-label { display: none; }
  .editor-subnav a { padding: 6px 10px; font-size: 12.5px; }
}
.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
}

.nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}
.nav a:hover { color: var(--text); background: var(--bg-elev-2); }
.nav a.active { color: var(--text); background: var(--accent-soft); }

.header-spacer { flex: 1; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--bg-elev-2); color: var(--text); }

.hamburger { display: none; }

/* ===========================
   Buttons
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-elev-2); border-color: var(--border-strong); }

.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-elev-2); }

.btn-danger { color: var(--danger); border-color: rgba(255, 84, 112, 0.3); }
.btn-danger:hover { background: rgba(255, 84, 112, 0.1); border-color: var(--danger); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ===========================
   Containers / Sections
   =========================== */

.main { flex: 1; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }

.section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-dim);
  margin-bottom: 32px;
  font-size: 15px;
}

/* ===========================
   Hero
   =========================== */

.hero {
  padding: 96px 0 64px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 400px at 50% 0%, rgba(124, 92, 255, 0.15), transparent),
    radial-gradient(ellipse 600px 300px at 80% 20%, rgba(255, 95, 162, 0.08), transparent);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-block;
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text) 0%, var(--text) 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 18px;
  color: var(--text-dim);
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===========================
   Feature Grid
   =========================== */

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

.feature-card {
  padding: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 22px;
}

.feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-dim);
  font-size: 14px;
}

/* ===========================
   Pen Card (gallery)
   =========================== */

.pen-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.pen-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.pen-thumb {
  aspect-ratio: 16 / 10;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.pen-thumb iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
  background: white;
}

.pen-thumb-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.pen-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pen-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pen-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.pen-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
}

.pen-actions {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ===========================
   Form Elements
   =========================== */

.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: all var(--transition);
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); }

.form-group { margin-bottom: 16px; }

.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ===========================
   Empty State
   =========================== */

.empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 600;
}

.empty p { font-size: 14px; margin-bottom: 24px; }

/* ===========================
   Toast / Notifications
   =========================== */

.toast-container {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow);
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toast-in 240ms ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===========================
   Footer — mirrors the main taimurtools.com footer
   =========================== */

.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  margin-top: 48px;
  color: var(--text-dim);
}

.ftr { max-width: 1080px; margin: 0 auto; padding: 3rem 2rem 2rem; }

.ftr-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 3rem;
  flex-wrap: wrap;
}

.ftr-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.ftr-brand a { display: inline-flex; align-items: center; }
.ftr-logo {
  height: 40px;
  width: 40px;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  object-fit: contain;
  opacity: .9;
  transition: opacity .3s;
}
.ftr-brand a:hover .ftr-logo { opacity: 1; }

.ftr-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.ftr-tag { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.ftr-cols {
  display: flex;
  gap: clamp(1.5rem, 4vw, 3rem);
  flex-wrap: wrap;
}

.ftr-col { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.ftr-ct {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}
.ftr-col a {
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  transition: color .2s;
  font-weight: 400;
}
.ftr-col a:hover { color: var(--info); }

.ftr-div {
  height: .5px;
  background: rgba(255, 255, 255, .04);
  margin: 2rem 0 1.5rem;
}

.ftr-btm {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.ftr-cp { font-size: 13px; color: var(--text-muted); }

.ftr-socials { display: flex; gap: 8px; }
.ftr-socials a {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elev-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s;
}
.ftr-socials a:hover { background: var(--info); }
.ftr-socials a svg { width: 14px; height: 14px; fill: var(--text-muted); transition: fill .3s; }
.ftr-socials a:hover svg { fill: #fff; }

/* Light theme overrides */
[data-theme="light"] .ftr-div { background: rgba(0, 0, 0, .06); }
[data-theme="light"] .ftr-socials a { background: var(--bg-elev-2); }

/* Responsive */
@media (max-width: 720px) {
  .ftr-top { flex-direction: column; }
  .ftr-cols { flex-direction: column; gap: 1.5rem; }
  .ftr-btm { flex-direction: column; text-align: center; }
}

/* ===========================
   Modal
   =========================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in 160ms ease;
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  width: calc(100% - 48px);
  box-shadow: var(--shadow);
  animation: modal-in 200ms ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal h2 { font-size: 18px; font-weight: 600; }

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 760px) {
  .nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
    gap: 2px;
    margin: 0;
    transform: translateY(-110%);
    transition: transform 200ms ease;
  }
  .nav.open { transform: translateY(0); }
  .nav a { padding: 12px 16px; }
  .hamburger { display: inline-flex; }
  .header-inner { padding: 0 16px; }
  .hero { padding: 56px 0 40px; }
  .container { padding: 0 16px; }
  .section { padding: 40px 0; }
}

/* ===========================
   Utilities
   =========================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.hidden { display: none !important; }

/* ============================================================
   Shared site nav (.nav-wrap) integration with the editor shell
   ------------------------------------------------------------
   /assets/pill-nav.css makes .nav-wrap position:fixed (correct
   for the marketing site). Inside the editor we keep it IN FLOW
   (sticky) so gallery/editor content is never hidden beneath it,
   and we tint it to match the dark UI. The `html ` prefix raises
   specificity above pill-nav.css so these win regardless of load
   order; pill-nav.js leaves the editor's own nav links intact.
   ============================================================ */
html .nav-wrap{ position: sticky; top: 0; }

[data-theme="dark"] .nav-wrap{
  --nv-bg: rgba(15,17,21,.88);
  --nv-border: var(--border, rgba(255,255,255,.08));
  --nv-text: rgba(245,247,255,.72);
  --nv-text-strong: #fff;
  --nv-muted: rgba(245,247,255,.45);
  --nv-hover: rgba(255,255,255,.06);
  --nv-panel: #14171b;
  --nv-panel-border: rgba(255,255,255,.1);
  --nv-shadow: 0 14px 44px -14px rgba(0,0,0,.6);
}
[data-theme="dark"] .nav-wrap .btn-google{ background:#fff; color:#0e1020; }
