/* ===========================================================
   PyGUI Guide — Shared Stylesheet
   A modern, responsive design system for the website.
   =========================================================== */

:root {
  /* Color palette */
  --bg: #0e1117;
  --bg-soft: #161b22;
  --bg-card: #1b2230;
  --bg-elevated: #222b3a;
  --border: #2a3342;
  --border-soft: #232b38;

  --text: #e6edf3;
  --text-muted: #9aa7b8;
  --text-dim: #6b7787;

  --primary: #4f9cf9;
  --primary-soft: #2d6fd4;
  --accent: #ffd43b;       /* python yellow */
  --accent-2: #3776ab;     /* python blue */
  --green: #3fb950;
  --red: #f85149;
  --purple: #bc8cff;
  --orange: #ffa657;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.25);

  --maxw: 1180px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

/* ----------------------- Reset ----------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 98px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------- Layout ----------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

section { padding: 64px 0; }

.section-tight { padding: 40px 0; }

/* ----------------------- Navbar ----------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(14, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  font-size: 1.1rem;
}
.brand span.accent { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0; padding: 0;
}
.nav-links a {
  display: block;
  padding: 10px 18px;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1.28rem;
  transition: all 0.15s ease;
}
.nav-links a:hover { background: var(--bg-card); color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: var(--bg-card); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ----------------------- Hero ----------------------- */
.hero {
  position: relative;
  padding: 96px 0 72px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(1200px 400px at 50% -10%, rgba(79, 156, 249, 0.18), transparent 60%),
    radial-gradient(800px 400px at 80% 20%, rgba(255, 212, 59, 0.10), transparent 55%);
}
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.15;
  margin: 0 0 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent-2), var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  max-width: 760px;
  margin: 0 auto 28px;
  font-size: 1.15rem;
  color: var(--text-muted);
}
.hero .eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

/* ----------------------- Buttons ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover { background: var(--primary-soft); }
.btn-ghost { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-elevated); }
.btn-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ----------------------- Typography ----------------------- */
h2.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.section-sub {
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 0 36px;
  font-size: 1.05rem;
}
.text-center { text-align: center; }
.center-block { margin-left: auto; margin-right: auto; }

h3 { font-size: 1.3rem; margin: 28px 0 12px; }
h4 { font-size: 1.08rem; margin: 22px 0 8px; color: var(--text); }

p { margin: 0 0 16px; }

ul.clean { list-style: none; padding: 0; margin: 0; }

/* prose blocks */
.prose { max-width: 860px; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose strong { color: #fff; }

/* ----------------------- Cards & Grid ----------------------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-soft);
  box-shadow: var(--shadow);
}
.card .icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--bg-elevated);
  font-size: 1.4rem;
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.card p { color: var(--text-muted); margin: 0; font-size: 0.96rem; }

.card-link { color: inherit; }
.card-link:hover { text-decoration: none; }

/* ----------------------- Code blocks ----------------------- */
.code-wrap {
  position: relative;
  background: #0b0f15;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 18px 0;
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
}
.code-head .dots { display: flex; gap: 6px; }
.code-head .dots i {
  width: 11px; height: 11px; border-radius: 50%; display: inline-block;
}
.code-head .dots i:nth-child(1){ background:#ff5f56; }
.code-head .dots i:nth-child(2){ background:#ffbd2e; }
.code-head .dots i:nth-child(3){ background:#27c93f; }
.code-head .lang { font-family: var(--mono); }
.copy-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px;
  padding: 3px 10px; cursor: pointer; font-size: 0.78rem;
  transition: all 0.15s ease;
}
.copy-btn:hover { color: var(--text); border-color: var(--primary); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.6;
  color: #d4dae3;
}
code { font-family: var(--mono); }
:not(pre) > code {
  background: var(--bg-elevated);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.88em;
  color: var(--orange);
}

/* simple syntax tokens */
.tok-kw { color: #ff7b72; }
.tok-str { color: #a5d6ff; }
.tok-com { color: #8b949e; font-style: italic; }
.tok-fn { color: #d2a8ff; }
.tok-num { color: #79c0ff; }
.tok-cls { color: #ffa657; }

/* ----------------------- Tables ----------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  min-width: 640px;
}
thead th {
  background: var(--bg-elevated);
  text-align: left;
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); color: var(--text-muted); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(79,156,249,0.05); }
td strong, th strong { color: var(--text); }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.pill-green { background: rgba(63,185,80,0.15); color: var(--green); }
.pill-red { background: rgba(248,81,73,0.15); color: var(--red); }
.pill-yellow { background: rgba(255,212,59,0.15); color: var(--accent); }
.pill-blue { background: rgba(79,156,249,0.15); color: var(--primary); }

/* ----------------------- Callouts ----------------------- */
.callout {
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin: 20px 0;
  border-left: 4px solid var(--primary);
  background: var(--bg-soft);
}
.callout .label { font-weight: 700; margin-bottom: 4px; display: block; }
.callout p { margin: 0; color: var(--text-muted); }
.callout-tip { border-left-color: var(--green); }
.callout-tip .label { color: var(--green); }
.callout-warn { border-left-color: var(--orange); }
.callout-warn .label { color: var(--orange); }
.callout-info { border-left-color: var(--primary); }
.callout-info .label { color: var(--primary); }
.callout-danger { border-left-color: var(--red); }
.callout-danger .label { color: var(--red); }

/* ----------------------- Library headers ----------------------- */
.lib-block { margin-bottom: 56px; scroll-margin-top: 98px; }
.lib-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}
.lib-badge {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  border-radius: 14px;
  font-size: 1.6rem;
  font-weight: 800;
  color: #0b0f15;
  flex-shrink: 0;
}
.lib-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }

/* ----------------------- TOC / sidebar ----------------------- */
.layout-split { display: grid; grid-template-columns: 240px 1fr; gap: 40px; align-items: start; }
.toc {
  position: sticky;
  top: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 18px;
}
.toc h4 { margin: 0 0 12px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin-bottom: 2px; }
.toc a {
  display: block;
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-left: 2px solid transparent;
}
.toc a:hover, .toc a.active { background: var(--bg-elevated); color: var(--text); text-decoration: none; }

/* ----------------------- Stats ----------------------- */
.stat-row { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 28px;
  text-align: center;
  min-width: 160px;
}
.stat .num { font-size: 2rem; font-weight: 800; color: var(--accent); }
.stat .label { color: var(--text-muted); font-size: 0.9rem; }

/* ----------------------- Footer ----------------------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 48px 0 32px;
  margin-top: 40px;
}
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }
.footer h5 { margin: 0 0 14px; font-size: 0.95rem; color: var(--text); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; }
.footer a { color: var(--text-muted); font-size: 0.92rem; }
.footer a:hover { color: var(--primary); }
.footer .muted { color: var(--text-dim); font-size: 0.9rem; }
.footer-bottom {
  margin-top: 36px; padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  color: var(--text-dim); font-size: 0.88rem;
}

/* ----------------------- Lib page nav ----------------------- */
.lib-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.lib-nav a { color: var(--text-muted); font-weight: 500; }
.lib-nav a:hover { color: var(--primary); text-decoration: none; }
.lib-nav .back { color: var(--text-dim); font-size: 0.92rem; }

/* ----------------------- External links (from webpage_links.xlsx) ----------------------- */
.external-links {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}
.external-links .section-title { font-size: 1.35rem; margin-bottom: 8px; }
.external-links .section-sub { margin-bottom: 24px; font-size: 0.95rem; }
.external-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 18px;
}
.external-link-item {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.4;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.external-link-item:hover {
  color: var(--primary);
  border-color: var(--primary-soft);
  background: var(--bg-elevated);
  text-decoration: none;
}

/* ----------------------- Misc ----------------------- */
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  color: var(--text-muted);
}
.divider { height: 1px; background: var(--border); margin: 40px 0; border: 0; }
.muted { color: var(--text-muted); }
.fade-up { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.fade-up.show { opacity: 1; transform: translateY(0); }

.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0; }
.pros-cons .box { border-radius: var(--radius-sm); padding: 18px; border: 1px solid var(--border); }
.pros-cons .pros { background: rgba(63,185,80,0.06); border-color: rgba(63,185,80,0.3); }
.pros-cons .cons { background: rgba(248,81,73,0.06); border-color: rgba(248,81,73,0.3); }
.pros-cons h4 { margin: 0 0 10px; }
.pros-cons ul { margin: 0; padding-left: 20px; }
.pros-cons li { margin-bottom: 6px; font-size: 0.93rem; }

/* ----------------------- Responsive ----------------------- */
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .layout-split { grid-template-columns: 1fr; }
  .toc { display: none; }
}
@media (max-width: 680px) {
  .nav-links {
    position: absolute;
    top: 76px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    gap: 4px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pros-cons { grid-template-columns: 1fr; }
  section { padding: 48px 0; }
}
