/* ==========================================================================
   DARKMOON-INSPIRED STYLESHEET
   Fonts: Space Mono (headings/mono), Poppins (body), Cousine (UI)
   Palette: Black #000, Text #dceaf4, Surface #131313, Blue #2667ff
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Poppins:wght@300;400;500;600;700&family=Cousine:wght@400;700&display=swap');

/* --------------------------------------------------------------------------
   CSS VARIABLES
   -------------------------------------------------------------------------- */

:root {
  --bg: #000000;
  --surface: #131313;
  --sidebar-bg: #0a0a0a;
  --text: #dceaf4;
  --muted: #dceaf480;
  --border: #dceaf41a;
  --border-strong: #dceaf433;
  --accent: #2667ff;
  --accent-light: #87bfff;
  --accent-soft: #add7f6;

  --font-mono: 'Space Mono', 'Cousine', monospace;
  --font-body: 'Poppins', sans-serif;
  --font-ui: 'Cousine', monospace;

  --info-bg: #2667ff1a;
  --info-border: #2667ff33;
  --info-text: #87bfff;
  --warning-bg: #ff8c001a;
  --warning-border: #ff8c0033;
  --warning-text: #ffb366;
  --success-bg: #00c8531a;
  --success-border: #00c85333;
  --success-text: #66e89b;
  --error-bg: #ff3b3b1a;
  --error-border: #ff3b3b33;
  --error-text: #ff7b7b;

  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 72px;

  --radius: 8px;
  --radius-sm: 4px;

  --sidebar-w: 240px;
  --header-h: 56px;
}

/* --------------------------------------------------------------------------
   LIGHT MODE
   -------------------------------------------------------------------------- */

body.light {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --sidebar-bg: #e8edf2;
  --text: #0a0a0a;
  --muted: #0a0a0a80;
  --border: #0a0a0a12;
  --border-strong: #0a0a0a22;
  --accent: #2667ff;
  --accent-light: #1a4fc9;
  --accent-soft: #3b7dff;
  --info-bg: #2667ff10;
  --info-border: #2667ff25;
  --info-text: #1a4fc9;
  --warning-bg: #ff8c0010;
  --warning-border: #ff8c0025;
  --warning-text: #b35f00;
}

/* --------------------------------------------------------------------------
   RESET & BASE
   -------------------------------------------------------------------------- */

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

html {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  user-select: none;
  border-radius: 20px;
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY  --  light, airy, Darkmoon-like
   All headings: font-weight 400 (regular). Space Mono regular is already
   distinctive enough -- bold mono at large sizes looks heavy and crude.
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-mono);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--text);
}

h1 { font-size: clamp(32px, 5vw, 56px); }
h2 { font-size: clamp(24px, 3.5vw, 38px); }
h3 { font-size: clamp(18px, 2.4vw, 26px); margin-top: var(--space-lg); }
h4 { font-size: clamp(15px, 1.6vw, 20px); }
h5 { font-size: 14px; }
h6 { font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }

p {
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  color: var(--muted);
  display: block;
  margin-block-start: 1em;
  margin-block-end: 1em;
  margin-inline-start: 0px;
  margin-inline-end: 0px;
  unicode-bidi: isolate;
}


/* --------------------------------------------------------------------------
   LISTS  --  the reset kills default padding, so we restore it properly
   -------------------------------------------------------------------------- */

ul, ol {
  padding-left: 1.5em;
  margin-bottom: var(--space-md);
  line-height: 1.7;
  color: var(--text);
}

ul { list-style-type: disc; }
ol { list-style-type: decimal; }

ul ul { list-style-type: circle; margin-bottom: 0; }
ul ul ul { list-style-type: square; }
ol ol { list-style-type: lower-alpha; margin-bottom: 0; }

li {
  margin-bottom: 6px;
  padding-left: 4px;
}

li:last-child {
  margin-bottom: 0;
}

li > ul,
li > ol {
  margin-top: 6px;
}

/* Definition lists */
dl {
  margin-bottom: var(--space-md);
}

dt {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--text);
  margin-top: var(--space-sm);
}

dd {
  color: var(--muted);
  padding-left: 1.5em;
  margin-bottom: var(--space-xs);
  line-height: 1.7;
}

/* Horizontal rules */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

/* Blockquote */
blockquote {
  border-left: 3px solid var(--accent);
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-md) 0;
  color: var(--muted);
  font-style: italic;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}

blockquote p {
  margin-bottom: 0;
}

/* Strong / em */
strong, b {
  font-weight: 600;
  color: var(--text);
}

em, i {
  font-style: italic;
}

/* Small */
small {
  font-size: 0.85em;
  color: var(--muted);
}

/* Mark */
mark {
  background: var(--accent);
  color: #fff;
  padding: 1px 4px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   LAYOUT
   Desktop: fixed sidebar + scrollable content
   Mobile:  off-canvas drawer + sticky top bar
   -------------------------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   SIDEBAR  --  fixed on desktop, always visible while scrolling
   -------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: var(--space-lg) var(--space-md) var(--space-md);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-lg);
  flex-shrink: 0;
  user-select: none;
}

.logo img,
.logo svg {
  height: 24px;
  width: auto;
}

.logo span,
.logo strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

/* Navigation */
.sidebar nav {
  flex: 1;
  overflow-y: auto;
}

.sidebar nav a {
  display: block;
  padding: 7px 0 7px var(--space-sm);
  margin-bottom: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.sidebar nav a:hover {
  color: var(--text);
  border-left-color: var(--border-strong);
}

.sidebar nav a.active,
.sidebar nav a.w--current {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* --------------------------------------------------------------------------
   MOBILE TOP BAR + HAMBURGER
   Hidden on desktop, visible on mobile.
   -------------------------------------------------------------------------- */

.topbar {
  display: none; /* shown via media query */
  position: fixed;
  top: 0;
  z-index: 150;
  height: var(--header-h);
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-md);
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.topbar .logo {
  margin-bottom: 0;
}

/* Hamburger button */
.menu-btn {
  display: none; /* shown via media query */
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 40px;
  height: 40px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s;
}
.menu-btn:hover {
  border-color: var(--accent);
}

/* Three-line icon via pseudo + span */
.menu-btn span,
.menu-btn::before,
.menu-btn::after {
  content: '';
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: transform 0.25s, opacity 0.25s;
}
.menu-btn::before { top: 12px; }
.menu-btn span { top: 19px; }
.menu-btn::after { top: 26px; }

/* Animated X when open */
.menu-btn.open::before {
  top: 19px;
  transform: translateX(-50%) rotate(45deg);
}
.menu-btn.open span { opacity: 0; }
.menu-btn.open::after {
  top: 19px;
  transform: translateX(-50%) rotate(-45deg);
}

/* Backdrop overlay for mobile drawer */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 190;
  opacity: 0;
  transition: opacity 0.3s ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   THEME TOGGLE
   -------------------------------------------------------------------------- */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.switch {
  position: relative;
  width: 38px;
  height: 20px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.25s;
}
.slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 0.25s;
}

input:checked + .slider { background: var(--accent); }
input:checked + .slider::before {
  transform: translateX(18px);
  background: var(--bg);
}

/* --------------------------------------------------------------------------
   MAIN CONTENT
   -------------------------------------------------------------------------- */

.content {
  grid-column: 2;
  padding: var(--space-xl) var(--space-xl) var(--space-2xl);
  min-width: 0;
  overflow-wrap: break-word;
}

section {
  margin-bottom: var(--space-2xl);
}

section > h1,
section > h2,
section > h3 {
  margin-bottom: var(--space-md);
}

section > h4,
section > h5,
section > h6 {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

section > p {
  margin-bottom: var(--space-sm);
}

/* --------------------------------------------------------------------------
   ALERTS
   -------------------------------------------------------------------------- */

.alert {
  border-left: 3px solid;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--space-sm) var(--space-md);
  margin: var(--space-md) 0;
  font-size: 13px;
  line-height: 1.6;
}

.alert.info    { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info-text); }
.alert.warning { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning-text); }
.alert.success { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
.alert.error   { background: var(--error-bg);   border-color: var(--error-border);   color: var(--error-text); }

/* --------------------------------------------------------------------------
   TABLES
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-md) 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 300;
}

th {
  font-family: var(--font-mono);
  font-weight: 400;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--muted);
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

td {
  padding: var(--space-xs) var(--space-sm);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:hover td {
  background: var(--surface);
}

/* --------------------------------------------------------------------------
   CARDS / BLOCKS
   -------------------------------------------------------------------------- */

.card,
.block {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-md);
  transition: border-color 0.2s;
}

.card:hover,
.block:hover {
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   CHIPS / TAGS
   -------------------------------------------------------------------------- */

.chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 4px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.chip:hover,
.tag:hover {
  color: var(--text);
  border-color: var(--text);
}

.chip.filled,
.tag.filled {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */

.button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  user-select: none;
}

.button:hover,
.btn:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.button.primary,
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.button.primary:hover,
.btn.primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

.button.ghost,
.btn.ghost {
  border-color: transparent;
  color: var(--muted);
}
.button.ghost:hover,
.btn.ghost:hover {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

/* --------------------------------------------------------------------------
   FORMS
   -------------------------------------------------------------------------- */

label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
select,
textarea {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 300;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px var(--space-sm);
  width: 100%;
  line-height: 1.4;
  transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

/* --------------------------------------------------------------------------
   CODE BLOCKS
   -------------------------------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  margin-top: var(--space-lg);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */

.footer {
  margin-top: var(--space-2xl);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   SCROLLBAR
   -------------------------------------------------------------------------- */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* --------------------------------------------------------------------------
   UTILITY CLASSES
   -------------------------------------------------------------------------- */

.text-accent  { color: var(--accent); }
.text-muted   { color: var(--muted); }
.text-body    { font-family: var(--font-body); font-weight: 300; }
.text-mono    { font-family: var(--font-mono); text-transform: uppercase; }
.text-upper   { text-transform: uppercase; }
.text-normal  { text-transform: none; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }

.bg-surface { background: var(--surface); }
.bg-accent  { background: var(--accent); }

.border-top    { border-top: 1px solid var(--border); }
.border-bottom { border-bottom: 1px solid var(--border); }

.rounded    { border-radius: var(--radius); }
.rounded-sm { border-radius: var(--radius-sm); }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.flex-center  { justify-content: center; align-items: center; }
.flex-between { justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full    { width: 100%; }
.max-w-sm  { max-width: 400px; }
.max-w-md  { max-width: 600px; }
.max-w-lg  { max-width: 820px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   RESPONSIVE -- TABLET (max 1024px)
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 220px;
  }

  .content {
    padding: var(--space-lg) var(--space-lg) var(--space-xl);
  }

  .card, .block {
    padding: var(--space-sm);
  }
}

/* --------------------------------------------------------------------------
   RESPONSIVE -- MOBILE (max 768px)
   Sidebar becomes a sticky horizontal top bar. Always visible, never hidden.
   Text sizes INCREASE for readability on small screens.
   -------------------------------------------------------------------------- */

/* --------------------------------------------------------------------------
   RESPONSIVE -- MOBILE (max 768px)
   Sidebar becomes off-canvas drawer with burger menu
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  :root {
    --space-xl: 40px;
    --space-2xl: 64px;
    --space-lg: 32px;
    --space-md: 24px;
    --sidebar-w: min(82vw, 320px);
  }

  body {
    font-size: 16px;
    line-height: 1.7;
  }

  .layout {
    display: block;
    min-height: 100vh;
  }

  /* Topbar visible on mobile */
  .topbar {
    display: flex;
  }

  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Sidebar becomes hidden drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    height: 100vh;
    transform: translateX(-100%);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: var(--space-lg) var(--space-md) var(--space-md);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar nav {
    overflow: visible;
  }

  .sidebar-backdrop {
    display: block;
    pointer-events: none;
    opacity: 0;
  }

  .sidebar-backdrop.visible {
    pointer-events: auto;
    opacity: 1;
  }

  .theme-toggle {
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: var(--space-sm);
    margin-top: var(--space-md);
  }

  .content {
    grid-column: unset;
    padding: var(--space-lg) var(--space-md);
    max-width: 100%;
  }

  section {
    margin-bottom: var(--space-2xl);
  }

  section > h1,
  section > h2,
  section > h3 {
    margin-bottom: var(--space-lg);
  }

  section > h4,
  section > h5,
  section > h6 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
  }

  p,
  section > p {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: var(--space-md);
  }

  .card,
  .block {
    padding: var(--space-md);
    margin-bottom: var(--space-md);
  }

  .alert {
    font-size: 14px;
    line-height: 1.7;
    padding: var(--space-sm) var(--space-md);
    margin: var(--space-md) 0;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table {
    font-size: 14px;
    margin-bottom: var(--space-md);
  }

  th {
    font-size: 12px;
  }

  th,
  td {
    padding: 10px 12px;
  }

  pre {
    font-size: 13px;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    line-height: 1.7;
  }

  code {
    font-size: 13px;
  }

  .chip,
  .tag {
    font-size: 12px;
    padding: 6px 14px;
    min-height: 36px;
  }

  .button,
  .btn {
    font-size: 13px;
    padding: 12px 20px;
    min-height: 44px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px;
    padding: 14px var(--space-sm);
    margin-bottom: var(--space-sm);
  }

  label {
    font-size: 12px;
    margin-bottom: 6px;
    margin-top: var(--space-sm);
  }

  .footer {
    font-size: 12px;
    margin-top: var(--space-xl);
    padding: var(--space-md) 0;
  }

  .max-w-sm,
  .max-w-md,
  .max-w-lg {
    max-width: 100%;
  }

  ul,
  ol {
    font-size: 15px;
    line-height: 1.8;
    margin-bottom: var(--space-md);
    padding-left: 1.4em;
  }

  li {
    margin-bottom: 8px;
  }

  blockquote {
    font-size: 15px;
    line-height: 1.8;
    padding: var(--space-md);
    margin: var(--space-md) 0;
  }

  hr {
    margin: var(--space-lg) 0;
  }

  dl {
    margin-bottom: var(--space-md);
  }

  dt {
    font-size: 14px;
  }

  dd {
    font-size: 15px;
    line-height: 1.8;
  }

  /* Prevent body scroll when menu open */
  body.menu-open {
    overflow: hidden;
  }
}

/* --------------------------------------------------------------------------
   RESPONSIVE -- SMALL MOBILE (max 479px)
   Same philosophy: text stays readable, spacing stays generous.
   Only slightly tighten padding on the edges.
   -------------------------------------------------------------------------- */

@media (max-width: 479px) {
  :root {
    --space-md: 20px;
    --space-lg: 28px;
    --space-xl: 36px;
    --space-2xl: 52px;
  }

  body { font-size: 15px; }

  /* Paragraphs stay readable */
  p, section > p {
    font-size: 14px;
    line-height: 1.75;
    margin-bottom: var(--space-md);
  }

  /* Table */
  table { font-size: 13px; }
  th { font-size: 11px; }
  th, td { padding: 8px 10px; }

  /* Code */
  pre { font-size: 12px; padding: var(--space-sm); }
  code { font-size: 12px; }

  /* Buttons */
  .button, .btn {
    font-size: 12px;
    padding: 10px 16px;
  }

  /* Cards */
  .card, .block {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
  }

  /* Alerts */
  .alert {
    font-size: 13px;
    padding: var(--space-sm);
    margin: var(--space-sm) 0;
  }

  /* Lists */
  ul, ol {
    font-size: 14px;
    line-height: 1.75;
    padding-left: 1.3em;
  }

  li {
    margin-bottom: 6px;
  }

  blockquote {
    font-size: 14px;
    padding: var(--space-sm);
  }

  /* Footer */
  .footer { font-size: 11px; }
}

@media (max-width: 768px) and (orientation: landscape) {
  .content {
    padding: var(--space-md) var(--space-md);
  }
}

/* --------------------------------------------------------------------------
   TOUCH DEVICES
   -------------------------------------------------------------------------- */

@media (hover: none) and (pointer: coarse) {
  /* No hover effects on touch */
  .card:hover, .block:hover { border-color: var(--border); }
  tr:hover td { background: transparent; }
}

/* --------------------------------------------------------------------------
   FOCUS VISIBLE (keyboard navigation)
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   PRINT
   -------------------------------------------------------------------------- */

@media print {
  .sidebar, .topbar, .menu-btn, .sidebar-backdrop,
  .theme-toggle, .footer { display: none; }

  body { background: #fff; color: #000; font-size: 11px; }

  .layout { grid-template-columns: 1fr; }

  .content { max-width: 100%; padding: 0; }

  .alert { border: 1px solid #999; background: transparent; }

  a { color: #000; }
  a::after { content: ' (' attr(href) ')'; font-size: 9px; }

  pre {
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #ccc;
    background: #f9f9f9;
    color: #000;
  }

  .card, .block { break-inside: avoid; }
  table { display: table; }
}


.m3-btn {
  --md-on-primary: #ffffff;

  background: var(--md-primary);
  color: var(--md-on-primary);

  border: none;
  border-radius: 999px; /* pill shape M3 */
  padding: 10px 24px;

  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1px;

  cursor: pointer;
  position: relative;
  overflow: hidden;

  transition: 
    box-shadow 0.2s ease,
    transform 0.1s ease,
    background 0.2s ease;
}

/* Container responsive */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px; /* ESPACEMENT */
  justify-content: center;
  padding: 20px;
}

/* Bouton style M3 outline blanc */
.m3-btn {
  text-decoration: none;
  color: var(--text);

  border: 2px solid rgba(255,255,255,0.6);
  border-radius: 999px;

  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;

  transition: all 0.2s ease;

  backdrop-filter: blur(6px);
}

/* Hover */
.m3-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: #ffffff;
  transform: translateY(-1px);
}

/* Click */
.m3-btn:active {
  transform: scale(0.96);
}

/* Focus (accessibilité) */
.m3-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.5);
  outline-offset: 2px;
}