/* ═══════════════════════════════════════════════════════════
   RandomT Academy — Stylesheet partilhado
   ═══════════════════════════════════════════════════════════ */

:root {
  --red: #c4302b; --red-hover: #a82420; --red-subtle: #fdf1f0; --red-border: #f3c0be;
  --bg: #f2f2f5; --surface: #ffffff; --surface-2: #f8f8fa;
  --border: #e5e5ea; --text: #1a1a1a; --text-muted: #555560; --text-faint: #999;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', Menlo, monospace;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05); --shadow-md: 0 4px 14px rgba(0,0,0,.07);
}
[data-theme="dark"] {
  --bg: #0f0f11; --surface: #1a1a1f; --surface-2: #22222a; --border: #2e2e38;
  --text: #e8e8ec; --text-muted: #9090a0; --text-faint: #55555f;
  --red: #e05555; --red-hover: #ed7070; --red-subtle: #2a1515; --red-border: #5a2222;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.30); --shadow-md: 0 4px 14px rgba(0,0,0,.40);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.65; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: var(--radius-sm); }

code {
  font-family: var(--font-mono); font-size: .875em;
  background: var(--surface-2); padding: .15em .4em;
  border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text);
}
pre {
  background: #111118; color: #d8d8e8; border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; overflow-x: auto; font-family: var(--font-mono);
  font-size: .875rem; line-height: 1.65; border: 1px solid #2a2a38; margin: 1rem 0;
}
[data-theme="dark"] pre { background: #0a0a10; border-color: #1e1e2a; }
pre code { background: none; border: none; padding: 0; font-size: inherit; color: inherit; }
.kw { color: #c792ea; } .str { color: #c3e88d; } .cmt { color: #637777; font-style: italic; }
.fn { color: #82aaff; } .num { color: #f78c6c; } .ann { color: #ffcb6b; }

p { font-size: .95rem; color: var(--text-muted); line-height: 1.75; margin-bottom: .75rem; max-width: 74ch; }
ul.doc-list { margin: .5rem 0 1rem 1.3rem; }
ul.doc-list li { font-size: .93rem; color: var(--text-muted); line-height: 1.7; margin-bottom: .3rem; }
ul.doc-list li strong { color: var(--text); }

/* ─── HEADER ─── */
.site-header {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .9rem 2rem; max-width: 1280px; margin: auto; gap: 1rem; }
.brand-link { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: .95rem; color: var(--red); }
.brand-sub { font-size: .72rem; color: var(--text-faint); letter-spacing: .04em; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-link { font-size: .82rem; color: var(--text-muted); transition: color .15s; }
.header-link:hover { color: var(--text); }
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); display: grid; place-items: center; color: var(--text-muted); transition: background .15s, color .15s; }
.theme-btn:hover { background: var(--border); color: var(--text); }

/* ─── LAYOUT ─── */
.page-layout { max-width: 1180px; margin: 2rem auto; padding: 0 1.5rem 5rem; display: grid; grid-template-columns: 248px 1fr; gap: 2rem; align-items: start; }
@media (max-width: 860px) { .page-layout { grid-template-columns: 1fr; } .sidebar { display: none; } }

/* ─── SIDEBAR ─── */
.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); position: sticky; top: 80px; }
.nav-group-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-faint); margin: 1.2rem 0 .4rem; display: block; }
.nav-group-label:first-child { margin-top: 0; }
.sidebar ul { list-style: none; }
.sidebar li { margin-bottom: 1px; }
.sidebar a { font-size: .875rem; color: var(--text-muted); display: flex; align-items: center; justify-content: space-between; padding: .35rem .6rem; border-radius: var(--radius-md); transition: background .12s, color .12s; }
.sidebar a:hover { background: var(--surface-2); color: var(--text); }
.sidebar a.active { background: var(--red-subtle); color: var(--red); font-weight: 600; border: 1px solid var(--red-border); }
[data-theme="dark"] .sidebar a.active { background: var(--red-subtle); }
.badge { font-size: .68rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .05rem .5rem; color: var(--text-faint); white-space: nowrap; }
.nav-child { padding-left: 1.4rem !important; }
.nav-disabled { opacity: .5; pointer-events: none; }

/* ─── CONTENT PANE ─── */
.content-pane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2.25rem; box-shadow: var(--shadow-md); }

/* ─── PAGE ELEMENTS ─── */
.breadcrumb { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-faint); margin-bottom: 1.25rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-muted); } .breadcrumb a:hover { color: var(--red); }
.page-eyebrow { display: flex; align-items: center; gap: .5rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--red); margin-bottom: .75rem; }
.page-title { font-size: 1.85rem; font-weight: 700; line-height: 1.15; letter-spacing: -.025em; margin-bottom: .6rem; }
.page-lead { font-size: 1rem; color: var(--text-muted); line-height: 1.7; margin-bottom: 2rem; max-width: 68ch; }
.section-h2 { font-size: 1.25rem; font-weight: 700; margin: 2.5rem 0 .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--border); color: var(--text); }
.section-h3 { font-size: 1rem; font-weight: 700; margin: 1.75rem 0 .5rem; color: var(--text); }

/* ─── CALLOUTS ─── */
.callout { border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin: 1.25rem 0; font-size: .9rem; line-height: 1.6; }
.callout-info   { background: #e9f7ff; border: 1px solid #b3e0ff; color: #004085; }
.callout-warn   { background: #fff8e1; border: 1px solid #ffe082; color: #6d4c00; }
.callout-danger { background: var(--red-subtle); border: 1px solid var(--red-border); color: var(--red); }
[data-theme="dark"] .callout-info  { background: #0d2233; border-color: #1a4060; color: #7ec8f5; }
[data-theme="dark"] .callout-warn  { background: #221a00; border-color: #5a4000; color: #f5d070; }
.callout strong { display: block; margin-bottom: .3rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; opacity: .8; }

/* ─── TAGS ─── */
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.25rem; }
.tag { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; padding: .2rem .6rem; border-radius: 999px; border: 1px solid; }
.tag-arch { background: #f0f4ff; color: #3050c8; border-color: #c0cdf5; }
.tag-sec  { background: var(--red-subtle); color: var(--red); border-color: var(--red-border); }
.tag-jwt  { background: #f0fff4; color: #186e38; border-color: #b3e8c8; }
.tag-sql  { background: #fdf4ff; color: #7c3aad; border-color: #ddb3f5; }
[data-theme="dark"] .tag-arch { background: #0d1533; color: #7090f0; border-color: #1e3070; }
[data-theme="dark"] .tag-jwt  { background: #0a1f14; color: #4fc880; border-color: #1a5030; }
[data-theme="dark"] .tag-sql  { background: #1a0a2a; color: #c070f0; border-color: #4a1a7a; }

/* ─── CARD GRID ─── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1rem; margin: 1rem 0; }
.mini-card { border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-lg); padding: 1.25rem; }
.mini-card-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint); margin-bottom: .5rem; }
.mini-card-title { font-size: .98rem; font-weight: 700; margin-bottom: .4rem; color: var(--text); }
.mini-card p { font-size: .875rem; margin-bottom: 0; }

/* ─── STEP FLOW ─── */
.step-flow { display: grid; gap: .75rem; margin: 1rem 0; }
.step-row { display: grid; grid-template-columns: 36px 1fr; gap: .875rem; align-items: start; padding: .875rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; font-size: .85rem; display: grid; place-items: center; flex-shrink: 0; }
.step-body strong { display: block; font-size: .93rem; margin-bottom: .2rem; color: var(--text); }
.step-body p { font-size: .875rem; margin-bottom: 0; }

/* ─── TABLE ─── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; min-width: 540px; }
th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: .8rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
td { padding: .875rem 1rem; font-size: .875rem; color: var(--text-muted); border-top: 1px solid var(--border); vertical-align: top; }
td strong { color: var(--text); }

/* ─── BLUEPRINT LIST ─── */
.blueprint-list { list-style: none; }
.blueprint-item { padding: 1.5rem 0; border-top: 1px solid var(--border); }
.blueprint-item:first-child { border-top: none; padding-top: 0; }
.blueprint-item-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.blueprint-item h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: .3rem; color: var(--text); }
.blueprint-item h3 a:hover { color: var(--red); text-decoration: underline; }
.blueprint-item p { font-size: .9rem; margin-bottom: 0; }

/* ─── DOC NAV ─── */
.doc-nav { display: flex; justify-content: space-between; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); gap: 1rem; flex-wrap: wrap; }
.doc-nav a { font-size: .875rem; color: var(--text-muted); display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); transition: border-color .15s, color .15s; }
.doc-nav a:hover { border-color: var(--red); color: var(--red); }
.doc-nav a.next { margin-left: auto; }

/* ─── FOOTER ─── */
.site-footer { text-align: center; padding: 2.5rem 1.5rem; font-size: .8rem; color: var(--text-faint); border-top: 1px solid var(--border); background: var(--surface); margin-top: 4rem; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { text-decoration: underline; color: var(--red); }

.divider { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }



@media (max-width: 640px) {
  .header-inner { padding: .8rem 1rem; }
  .page-layout  { padding: 0 .875rem 4rem; }
  .content-pane { padding: 1.5rem; }
  .page-title   { font-size: 1.45rem; }
  .doc-nav      { flex-direction: column; }
  .doc-nav a.next { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }