/* =============================================================
   OnlineClipboard — Design System
   app.css  · last updated 2026
   =============================================================
   TABLE OF CONTENTS
   1.  Design Tokens (CSS Variables)
   2.  CSS Reset
   3.  Global / Typography
   4.  Layout Utilities
   5.  Navigation
   6.  Components: Buttons
   7.  Components: Form Elements
   8.  Components: Cards
   9.  Components: Badges & Pills
   10. Components: Toast
   11. Skeleton Loaders
   12. Hero Section
   13. Clipboard Tool
   14. Features Section
   15. Tools Grid
   16. FAQ Section
   17. Footer
   18. Dark Mode
   19. Animations & Transitions
   20. Responsive Overrides
   ============================================================= */

@font-face {
  font-family: "ManropeVar";
  src: url("../../fonts/Manrope-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}


/* ─────────────────────────────────────────────────────────────
   1. Design Tokens
   ───────────────────────────────────────────────────────────── */
:root {
  /* Palette */
  --clr-primary:      #4F7EF7;
  --clr-primary-d:    #3564e0;
  --clr-primary-xs:   rgba(79,126,247,.10);
  --clr-accent:       #8B5CF6;
  --clr-accent-xs:    rgba(139,92,246,.10);
  --clr-success:      #10B981;
  --clr-danger:       #EF4444;
  --clr-warning:      #F59E0B;

  /* Surfaces */
  --bg-page:          #ffffff;
  --bg-surface:       #ffffff;
  --bg-surface-2:     #f8faff;
  --bg-nav:           rgba(255,255,255,.88);

  /* Text */
  --txt-head:         #0f172a;
  --txt-body:         #1f2937;
  --txt-muted:        #4b5563;
  --txt-inverse:      #ffffff;

  /* Borders */
  --border:           #e2e8f0;
  --border-focus:     var(--clr-primary);

  /* Shadows */
  --shadow-xs:        0 1px 3px rgba(0,0,0,.06);
  --shadow-sm:        0 2px 8px rgba(0,0,0,.08);
  --shadow-md:        0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:        0 8px 40px rgba(0,0,0,.14);

  /* Border radius */
  --r-sm:   6px;
  --r-md:  10px;
  --r-lg:  16px;
  --r-xl:  24px;
  --r-pill:9999px;

  /* Spacing scale */
  --sp-1:  .25rem;
  --sp-2:  .5rem;
  --sp-3:  .75rem;
  --sp-4:  1rem;
  --sp-5:  1.25rem;
  --sp-6:  1.5rem;
  --sp-8:  2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;

  /* Typography */
  --font-sans: "ManropeVar", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo,
               Consolas, "Courier New", monospace;
  --fs-body: 1rem;
  --fs-small: .875rem;
  --fs-button: .9375rem;
  --fs-h1: 2.125rem;
  --fs-h2: 1.75rem;
  --fs-h3: 1.375rem;
  --fs-h4: 1.125rem;
  --fs-h5: 1rem;
  --fs-h6: .9375rem;
  --lh-body: 1.65;
  --lh-head: 1.25;

  /* Motion */
  --ease:        cubic-bezier(.4,0,.2,1);
  --dur-fast:    .15s;
  --dur-normal:  .25s;
  --dur-slow:    .4s;

  /* Container */
  --container-max: 1120px;
  --container-pad: var(--sp-6);
}


/* ─────────────────────────────────────────────────────────────
   2. CSS Reset
   ───────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  background: var(--bg-page);
  color: var(--txt-body);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
a { color: #3564E0; text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 {
  color: var(--txt-head);
  font-weight: 700;
  line-height: var(--lh-head);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: var(--fs-h5); }
h6 { font-size: var(--fs-h6); }
p { font-size: var(--fs-body); }


/* ─────────────────────────────────────────────────────────────
   3. Global / Typography
   ───────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* Honeypot field */
.hp-field {
  position: absolute; left: -9999px;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

*:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}


/* ─────────────────────────────────────────────────────────────
   4. Layout Utilities
   ───────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--sp-16);
}

.section--sm {
  padding-block: var(--sp-10);
}

.section--sm:first-of-type {
  padding-top: 0;
  margin-top: -1rem;
}

#tool {
  margin-top: -1rem;
}

.section-alt {
  background: var(--bg-surface-2);
}

.section-label {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--clr-primary);
  margin-bottom: var(--sp-3);
}

.section-title {
  font-size: var(--fs-h2);
  font-weight: 800;
  color: var(--txt-head);
  margin-bottom: var(--sp-4);
}

.section-sub {
  font-size: var(--fs-body);
  color: var(--txt-muted);
  max-width: 56ch;
}

/* 2-col grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-6);
}

/* auto-fit 3-col grid */
.grid-auto-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}

/* 70 / 30 sidebar layout */
.layout-main-aside {
  display: grid;
  grid-template-columns: minmax(0,1fr) 300px;
  gap: var(--sp-8);
  align-items: start;
}

.layout-main-aside > * {
  min-width: 0;
}

.layout-aside {
  position: sticky;
  top: calc(64px + var(--sp-6));
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-center { text-align: center; }


/* ─────────────────────────────────────────────────────────────
   5. Navigation
   ───────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 300;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  height: 100%;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--txt-head);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-logo svg { width: 28px; height: 28px; flex-shrink: 0; }

.nav-logo .brand-accent { color: var(--clr-primary); }

.nav-logo:hover { text-decoration: none; color: var(--clr-primary); }

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-inline-start: auto;
}

.nav-links > li {
  position: relative;
}

.nav-links a,
.nav-tools-toggle {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-md);
  font-size: .9rem;
  font-weight: 600;
  color: var(--txt-muted);
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  line-height: 1.2;
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

.nav-links a:hover,
.nav-links a.active,
.nav-tools-toggle:hover,
.nav-tools-toggle.active,
.nav-item-has-dropdown.is-active > .nav-tools-toggle {
  color: var(--clr-primary);
  background: var(--clr-primary-xs);
  text-decoration: none;
}

.nav-item-has-dropdown {
  position: relative;
}

.nav-tools-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  text-decoration: none;
}

.nav-tools-chevron {
  transition: transform var(--dur-fast) var(--ease);
}

.nav-item-has-dropdown.open > .nav-tools-toggle .nav-tools-chevron,
.nav-item-has-dropdown:hover > .nav-tools-toggle .nav-tools-chevron,
.nav-item-has-dropdown:focus-within > .nav-tools-toggle .nav-tools-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: .35rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              visibility var(--dur-fast) var(--ease);
  z-index: 250;
}

.nav-item-has-dropdown:hover > .nav-submenu,
.nav-item-has-dropdown:focus-within > .nav-submenu,
.nav-item-has-dropdown.open > .nav-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Prevent hover gap flicker between trigger and dropdown */
.nav-item-has-dropdown::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: .45rem;
}

.nav-submenu a {
  display: block;
  padding: .55rem .7rem;
  border-radius: var(--r-sm);
  font-size: .875rem;
}

/* Theme Toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--txt-muted);
  transition: all var(--dur-fast) var(--ease);
  flex-shrink: 0;
  padding: 0;
  position: relative;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  flex: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.theme-toggle:hover {
  background: var(--bg-surface-2);
  color: var(--txt-head);
  border-color: var(--clr-primary);
}

/* Navigation actions container */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Mobile nav toggle */
.nav-menu-toggle {
  display: none;
  width: 36px; height: 36px;
  border: 1.5px solid var(--border);
  background: transparent;
  border-radius: var(--r-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--txt-muted);
  position: relative;
}

.nav-menu-icon {
  width: 18px;
  height: 14px;
  position: relative;
  display: block;
}

.nav-menu-icon .bar {
  position: absolute;
  left: 50%;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  transform-origin: center;
  transition: transform var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease),
              width var(--dur-fast) var(--ease);
}

.nav-menu-icon .bar--top { top: 0;   width: 18px; transform: translateX(-50%); }
.nav-menu-icon .bar--mid { top: 6px; width: 13px; transform: translateX(-50%); }
.nav-menu-icon .bar--bot { top: 12px; width: 16px; transform: translateX(-50%); }

.nav-menu-toggle.is-open .bar--top {
  width: 17px;
  transform: translateX(-50%) translateY(6px) rotate(45deg);
}

.nav-menu-toggle.is-open .bar--mid {
  opacity: 0;
  transform: translateX(-50%) scaleX(.6);
}

.nav-menu-toggle.is-open .bar--bot {
  width: 11px;
  transform: translateX(-50%) translateY(-6px) rotate(-45deg);
}

.nav-drawer-overlay {
  display: none;
}


/* ─────────────────────────────────────────────────────────────
   6. Components: Buttons
   ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: .625rem 1.25rem;
  border-radius: var(--r-md);
  border: 1.5px solid transparent;
  font-size: var(--fs-button);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur-fast) var(--ease);
  position: relative;
  text-decoration: none;
}

.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; pointer-events: none; }

/* Primary */
.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary);
  box-shadow: none;
}
.btn-primary:hover {
  background: var(--clr-primary-d);
  border-color: var(--clr-primary-d);
  box-shadow: none;
}

/* Requested CTA semantics: darker blue at rest, lighter blue on hover */
.btn-accent-cta {
  background: #3564E0;
  color: #fff;
  border-color: #3564E0;
  box-shadow: none;
}
.btn-accent-cta:hover {
  background: #4F7EF7;
  border-color: #4F7EF7;
  color: #fff;
  box-shadow: none;
}

/* Outline primary that fills solid blue on hover */
.btn-outline-primary-fill {
  background: transparent;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}
.btn-outline-primary-fill:hover {
  background: var(--clr-primary);
  border-color: var(--clr-primary);
  color: #fff;
}

.btn-qr-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin: .75rem auto 0;
  width: auto;
  max-width: 200px;
  white-space: nowrap;
}

.btn-qr-download svg { flex-shrink: 0; }

/* Secondary (outline) */
.btn-secondary {
  background: transparent;
  color: var(--txt-head);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-surface-2);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--clr-danger);
  border-color: var(--clr-danger);
}
.btn-danger:hover {
  background: var(--clr-danger);
  color: #fff;
}

/* Ghost (no border) */
.btn-ghost {
  background: transparent;
  color: var(--txt-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-surface-2);
  color: var(--clr-primary);
}

/* Sizes */
.btn-sm {
  padding: .375rem .875rem;
  font-size: var(--fs-small);
}
.btn-lg {
  padding: .875rem 2rem;
  font-size: var(--fs-h5);
  border-radius: var(--r-lg);
}
.btn-full { width: 100%; }

/* Loading state */
.btn[aria-busy="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  background-image: none;
}
.btn[aria-busy="true"]::before {
  content: '';
  width: 1em; height: 1em;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}


/* ─────────────────────────────────────────────────────────────
   7. Components: Form Elements
   ───────────────────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.field-label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--txt-head);
}

.field-hint {
  font-size: .8125rem;
  color: var(--txt-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: .625rem .875rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  color: var(--txt-head);
  font-size: .9375rem;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow  var(--dur-fast) var(--ease);
  appearance: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--clr-primary-xs);
}

.textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}

/* Select arrow */
.select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right .625rem center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* Input group (input + button side by side) */
.input-group {
  display: flex;
  gap: var(--sp-2);
}

.input-group .input { flex: 1; min-width: 0; }

/* Clipboard-specific field contrast (normal state only) */
#boardCode:not(:focus),
#manageCodeInput:not(:focus),
#firstEntryText:not(:focus),
#newEntryText:not(:focus),
#imageFetchCode:not(:focus),
#imageManageCodeInput:not(:focus) {
  border-color: #7c7c7c;
}

#boardCode::placeholder,
#manageCodeInput::placeholder,
#firstEntryText::placeholder,
#newEntryText::placeholder,
#imageFetchCode::placeholder,
#imageManageCodeInput::placeholder {
  color: #7c7c7c;
  opacity: 1;
}

/* Char counter */
.char-count {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--txt-muted);
}
.char-count.warn  { color: var(--clr-warning); }
.char-count.over  { color: var(--clr-danger);  }


/* ─────────────────────────────────────────────────────────────
   8. Components: Cards
   ───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: none;
}

.card-sm {
  padding: var(--sp-4);
  border-radius: var(--r-md);
}

.card-hover {
  transition: border-color var(--dur-normal) var(--ease),
              background var(--dur-normal) var(--ease);
}

.card-hover:hover {
  border-color: var(--clr-primary);
  background: var(--bg-surface-2);
}


/* ─────────────────────────────────────────────────────────────
   9. Components: Badges & Pills
   ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: .2em .7em;
  border-radius: var(--r-pill);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.badge-primary {
  background: var(--clr-primary-xs);
  color: var(--clr-primary);
}

.badge-danger {
  background: rgba(239,68,68,.1);
  color: var(--clr-danger);
}

.badge-success {
  background: rgba(16,185,129,.1);
  color: var(--clr-success);
}

.badge-count {
  background: var(--clr-primary);
  color: #fff;
  padding: .25rem .75rem;
  font-size: .8125rem;
}

.badge-count.limit {
  background: var(--clr-danger);
}


/* ─────────────────────────────────────────────────────────────
   10. Components: Toast
   ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--sp-6);
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + var(--sp-6)));
  background: var(--txt-head);
  color: var(--txt-inverse);
  padding: .75rem 1.25rem;
  border-radius: var(--r-md);
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  transition: transform var(--dur-normal) var(--ease),
              opacity var(--dur-normal) var(--ease);
  opacity: 0;
  visibility: hidden;
  z-index: 9999;
  max-width: min(90vw, 400px);
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}


/* ─────────────────────────────────────────────────────────────
   11. Skeleton Loaders
   ───────────────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(
    90deg,
    var(--bg-surface-2) 25%,
    var(--border)       50%,
    var(--bg-surface-2) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}

.skeleton-line {
  height: 1em;
  margin-bottom: var(--sp-2);
  border-radius: var(--r-sm);
}

.skeleton-line:last-child { width: 65%; }

.skeleton-entry {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-3);
}

.skeleton-entry .skeleton-line { margin-bottom: var(--sp-3); }

.skeleton-code-block {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
}

.skeleton-rect {
  height: 150px;
  border-radius: var(--r-md);
}


/* ─────────────────────────────────────────────────────────────
   12. Hero Section
   ───────────────────────────────────────────────────────────── */
.hero {
  padding-top: var(--sp-8);
  padding-bottom: var(--sp-6);
  text-align: center;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--clr-primary-xs);
  color: var(--clr-primary);
  border: 1px solid rgba(79,126,247,.2);
  padding: .35rem 1rem;
  border-radius: var(--r-pill);
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: var(--sp-5);
}

.hero__title {
  font-size: var(--fs-h1);
  font-weight: 800;
  line-height: var(--lh-head);
  letter-spacing: -.01em;
  color: var(--txt-head);
  margin-bottom: var(--sp-4);
}

.hero__title .gradient-text {
  color: var(--clr-primary);
}

.hero__sub {
  font-size: var(--fs-body);
  color: var(--txt-muted);
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: var(--sp-5);
  line-height: 1.7;
}

.hero__stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}

.hero__stat {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: .875rem;
  font-weight: 600;
  color: var(--txt-muted);
}

.hero__stat svg {
  width: 16px; height: 16px;
  color: var(--clr-success);
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────────────────────
   13. Clipboard Tool
   ───────────────────────────────────────────────────────────── */
.tool-card {
  background: var(--bg-surface);
  border: none;
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-4);
}

/* Section header row: title + retrieve input side by side */
.tool-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.tool-section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--txt-head);
  flex-shrink: 0;
  margin: 0;
}

.tool-retrieve-group {
  flex: 1;
  min-width: 260px;
  max-width: 440px;
}

/* Tool option row */
.tool-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}

/* Expiry selector */
.expiry-group {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  white-space: nowrap;
}

.expiry-group label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--txt-muted);
}

/* Board section (loaded state) */
.board-section {
  margin-top: var(--sp-4);
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.board-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--txt-head);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: 0;
}

.board-actions {
  display: flex;
  gap: var(--sp-2);
}

/* Manage code entry */
.manage-code-entry {
  margin-bottom: var(--sp-5);
}

/* Add entry section */
.add-entry-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: var(--sp-5);
}

.add-entry-section h3 {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--txt-head);
  margin-bottom: var(--sp-3);
}



/* Entries list */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* Entry card */
.entry-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: none;
  transition: border-color var(--dur-normal) var(--ease),
              background var(--dur-normal) var(--ease);
  position: relative;
  display: flex;
  flex-direction: column;
}

.entry-card:hover {
  border-color: var(--border);
  background: var(--bg-surface);
}

.entry-card.editing {
  cursor: default;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-xs);
}

.entry-card.editing .entry-header {
  position: relative;
  top: auto;
  right: auto;
  margin-bottom: var(--sp-3);
}

.entry-card.editing .btn-copy {
  display: none;
}

.entry-card.editing .entry-content {
  margin-top: 0;
  padding-right: 0;
}



.entry-header {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  display: flex;
  gap: var(--sp-2);
}

.entry-header .btn-copy {
  flex-shrink: 0;
}

.entry-number {
  display: none;
}

.entry-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
}

.entry-actions .btn {
  flex: 1;
  text-align: center;
}

.entry-actions .btn-copy {
  display: none;
}

.entry-content {
  font-size: .9375rem;
  color: var(--txt-body);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
  line-height: 1.65;
  margin-top: 2rem;
  margin-bottom: 0;
  padding-right: 60px;
}

/* Copied flash */
.entry-card.copied {
  border-color: var(--clr-success);
  background: rgba(16,185,129,.04);
}

/* Codes sidebar */
.codes-box {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.code-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  width: 100%;
  min-width: 0;
}

.code-row--codes {
  gap: 5px;
}

.code-item {
  display: block;
  width: 100%;
  min-width: 0;
}

.code-item .code-value {
  display: block;
  width: 100%;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.code-item .code-value:hover {
  background: var(--clr-primary);
  color: white;
}

.code-item .btn {
  flex-shrink: 0;
}

.code-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--txt-muted);
}

.code-value {
  font-family: var(--font-mono);
  background: var(--clr-primary-xs);
  color: var(--clr-primary);
  padding: .3rem .75rem;
  border-radius: var(--r-sm);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .08em;
  display: inline-block;
}

.code-value--link {
  display: block;
  width: 100%;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: hidden;
  line-height: 1.5;
}

.code-expiry {
  font-size: .875rem;
  font-weight: 600;
  color: var(--txt-muted);
}

/* QR box */
.qr-box {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  text-align: center;
  box-shadow: none;
}

.qr-box canvas {
  max-width: 160px;
  height: auto;
  margin-inline: auto;
  border-radius: var(--r-sm);
}

.qr-box p {
  font-size: .8rem;
  color: var(--txt-muted);
  margin-top: var(--sp-3);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--txt-muted);
  font-size: .9375rem;
}

.empty-state svg {
  width: 40px; height: 40px;
  margin-inline: auto;
  margin-bottom: var(--sp-3);
  opacity: .4;
}

/* Turnstile widget wrapper */
.turnstile-wrap { margin-bottom: var(--sp-4); }

/* Image Clipboard additions */
.upload-dropzone {
  display: block;
  width: 100%;
  border: 1.5px dashed var(--clr-primary);
  border-radius: var(--r-lg);
  background: var(--clr-primary-xs);
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--clr-primary-d);
  background: rgba(79, 126, 247, .16);
}
.upload-dropzone-sm {
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.upload-dropzone-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--clr-primary);
  color: var(--clr-primary);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-3);
}
.upload-dropzone-title {
  color: var(--txt-head);
  font-size: var(--fs-h5);
  font-weight: 700;
  margin-bottom: var(--sp-1);
}
.upload-dropzone-sub {
  color: var(--txt-muted);
  font-size: var(--fs-small);
}
.image-file-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-3);
}
.image-file-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--sp-3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  padding: var(--sp-2) var(--sp-3);
  min-width: 0;
}

.image-file-row > * {
  min-width: 0;
}

.image-file-preview {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  width: 100%;
  min-width: 0;
}

.image-thumbnail-preview {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.image-file-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  min-width: 0;
}

.image-file-info {
  min-width: 0;
}

.image-file-actions {
  margin-top: var(--sp-3);
}
.image-file-name {
  color: var(--txt-head);
  font-size: var(--fs-small);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-file-size {
  color: var(--txt-muted);
  font-size: var(--fs-small);
  white-space: nowrap;
}
.image-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--sp-4);
}
.image-item {
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  overflow: hidden;
}
.image-item-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}
.image-item-meta {
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
}
.image-item-name {
  color: var(--txt-head);
  font-size: var(--fs-small);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-item-size {
  color: var(--txt-muted);
  font-size: .75rem;
}
.image-item-actions {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
}
.image-item-actions .btn {
  flex: 1;
}

.file-board-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  padding: var(--sp-3);
}

.file-item-main {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  min-width: 0;
  flex: 1 1 320px;
}

.file-preview-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-md);
  background: var(--clr-primary-xs);
  color: var(--clr-primary);
  border: 1px solid rgba(79, 126, 247, .2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  flex-shrink: 0;
}

.file-item-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.file-item-name {
  color: var(--txt-head);
  font-size: var(--fs-small);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-sub {
  color: var(--txt-muted);
  font-size: .78rem;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.file-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--clr-primary-xs);
  color: var(--clr-primary-d);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.file-item-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

#uploadAdditionalImages {
  margin-top: 5px;
  margin-bottom: var(--sp-4);
}

#imageAddPreview {
  margin-top: var(--sp-4);
}

.image-file-name {
  min-width: 0;
}

.upload-dropzone-icon {
  border: none;
  background: transparent;
}

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .82);
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}
.image-modal.show {
  display: flex;
}
.image-modal-img {
  max-width: min(100%, 1100px);
  max-height: 90vh;
  border-radius: var(--r-md);
  object-fit: contain;
}
.image-modal-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
}

/* ─────────────────────────────────────────────────────────────
   14. Features Section
   ───────────────────────────────────────────────────────────── */
.features-section {
  background: var(--bg-surface-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.feature-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.feature-icon {
  width: 48px; height: 48px;
  background: var(--clr-primary-xs);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--clr-primary);
  flex-shrink: 0;
}

.feature-icon svg { width: 22px; height: 22px; }

.feature-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
}

.feature-card p {
  font-size: .9rem;
  color: var(--txt-muted);
  line-height: 1.7;
}


/* ─────────────────────────────────────────────────────────────
   15. Tools Grid
   ───────────────────────────────────────────────────────────── */
.tool-link-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  text-decoration: none;
  color: inherit;
}

.tool-link-card:hover { text-decoration: none; }

/* Clickable tool cards: only border highlight, keep bg unchanged */
.tool-link-card.card-hover:hover {
  border-color: var(--clr-primary);
  background: var(--bg-surface);
}

.tool-link-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.25rem;
}

.tool-link-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--sp-1);
}

.tool-link-card p {
  font-size: .875rem;
  color: var(--txt-muted);
  line-height: 1.55;
}


/* ─────────────────────────────────────────────────────────────
   16. FAQ Section
   ───────────────────────────────────────────────────────────── */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-width: 720px;
  margin-inline: auto;
}

.faq-item {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.faq-item:hover,
.faq-item[open] {
  border-color: var(--clr-primary);
}

.faq-question {
  width: 100%;
  padding: var(--sp-5);
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  font-size: .9375rem;
  font-weight: 700;
  color: var(--txt-head);
  cursor: pointer;
  text-align: left;
  transition: color var(--dur-fast) var(--ease);
}

.faq-question:hover,
.faq-item[open] .faq-question {
  background: transparent;
  color: var(--clr-primary);
}

.faq-question svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--txt-muted);
  transition: transform var(--dur-normal) var(--ease),
              color var(--dur-fast) var(--ease);
}

.faq-item:hover .faq-question svg,
.faq-item[open] .faq-question svg {
  color: var(--clr-primary);
}

.faq-item[open] .faq-question svg { transform: rotate(180deg); }

.faq-answer {
  padding: 0 var(--sp-5) var(--sp-5);
  font-size: .9rem;
  color: var(--txt-muted);
  line-height: 1.75;
  border-top: 1px solid var(--border);
  padding-top: var(--sp-4);
}


/* ─────────────────────────────────────────────────────────────
   17. Footer
   ───────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding-block: var(--sp-10);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8);
  margin-bottom: var(--sp-8);
}

.footer-brand p {
  font-size: .875rem;
  color: var(--txt-muted);
  margin-top: var(--sp-3);
  max-width: 32ch;
  line-height: 1.7;
}

.footer-col h3 {
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--txt-head);
  margin-bottom: var(--sp-4);
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.footer-col a {
  font-size: .875rem;
  color: var(--txt-muted);
  transition: color var(--dur-fast) var(--ease);
}

.footer-col a:hover {
  color: var(--clr-primary);
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  font-size: .8125rem;
  color: var(--txt-muted);
}


/* ─────────────────────────────────────────────────────────────
   21. Tool Pages (encoder/decoder/converter components)
   ───────────────────────────────────────────────────────────── */

/* Stats bar: char count + copy/download side by side */
.tool-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
  min-height: 2rem;
}

.tool-ctrl-btns {
  display: flex;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Monospace textarea (base64, url, html encoder) */
.textarea-mono {
  font-family: var(--font-mono);
  font-size: .875rem;
  color: var(--clr-primary);
  caret-color: var(--clr-primary);
  word-break: break-all;
  white-space: pre-wrap;
}

/* Grid of action/conversion buttons */
.tool-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}

.tool-action-grid--2col {
  grid-template-columns: repeat(2, 1fr);
}

/* Individual action button — inherits .btn base via HTML class combo */
.tool-action-btn {
  padding: .5rem .875rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--txt-head);
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
  text-align: center;
}

.tool-action-btn:hover {
  background: var(--bg-surface-2);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

.tool-action-btn.active,
.tool-action-btn[aria-pressed="true"] {
  background: var(--clr-primary-xs);
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

.tool-action-btn:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 2px;
}

/* Primary variant (large encode/decode buttons) */
.tool-action-btn--primary {
  background: #3564E0;
  color: #fff;
  border-color: #3564E0;
  padding: .625rem 1.25rem;
  font-size: var(--fs-button);
}

.tool-action-btn--primary:hover {
  background: #4F7EF7;
  border-color: #4F7EF7;
  color: #fff;
}

/* Tool breadcrumb */
.tool-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: .8125rem;
  color: var(--txt-muted);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}

.tool-breadcrumb a {
  color: var(--txt-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.tool-breadcrumb a:hover { 
  color: var(--clr-primary); 
}

.tool-breadcrumb a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tool-breadcrumb .sep {
  color: var(--txt-muted);
  opacity: 0.6;
  user-select: none;
  font-weight: 600;
}

[data-theme="dark"] .tool-breadcrumb .sep {
  opacity: 0.8;
  color: var(--txt-muted);
}

.tool-breadcrumb .current {
  color: var(--txt-body);
  font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────
   Tool Page: Features & Steps Sections
   ───────────────────────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-6);
}

.feature-card {
  padding: var(--sp-6);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all var(--dur-normal) var(--ease);
}

.feature-card:hover {
  border-color: var(--clr-primary);
  box-shadow: var(--shadow-sm);
}

.feature-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--sp-3);
  color: var(--txt-head);
}

.feature-card p {
  color: var(--txt-muted);
  font-size: .95rem;
  margin: 0;
}

.steps-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--sp-6);
  list-style: none;
  padding: 0;
  margin: 0;
}

.steps-list li {
  padding: var(--sp-6);
  background: var(--bg-surface-2);
  border-radius: var(--r-md);
  border-left: 3px solid var(--clr-primary);
}

.steps-list li h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--sp-3);
  color: var(--txt-head);
}

.steps-list li p {
  color: var(--txt-muted);
  margin: 0;
  font-size: .95rem;
}

.steps-list .step-number {
  font-weight: 600;
  color: var(--clr-primary);
  margin-bottom: var(--sp-2);
  font-size: 1.2rem;
}

/* Image Clipboard: How It Works layout */
.image-howto-grid {
  grid-template-columns: 1fr;
}

@media (min-width: 992px) {
  .image-howto-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ─────────────────────────────────────────────────────────────
   22. Prose / Legal pages
   ───────────────────────────────────────────────────────────── */
.prose {
  max-width: 72ch;
  margin-inline: auto;
}

.prose h1 { font-size: var(--fs-h1); margin-bottom: var(--sp-6); }
.prose h2 { font-size: var(--fs-h3); margin-top: var(--sp-10); margin-bottom: var(--sp-3); }
.prose h3 { font-size: var(--fs-h4); margin-top: var(--sp-6); margin-bottom: var(--sp-2); }
.prose p  { margin-bottom: var(--sp-4); color: var(--txt-body); line-height: var(--lh-body); }
.prose ul, .prose ol {
  padding-inline-start: var(--sp-6);
  margin-bottom: var(--sp-4);
  list-style: disc;
}
.prose li { margin-bottom: var(--sp-2); color: var(--txt-body); }
.prose a  { color: var(--clr-primary); text-decoration: underline; }
.prose strong { color: var(--txt-head); font-weight: 700; }

.prose-date {
  font-size: .875rem;
  color: var(--txt-muted);
  margin-bottom: var(--sp-8);
}

/* ─────────────────────────────────────────────────────────────
   23. Dark mode additions for new components
   ───────────────────────────────────────────────────────────── */
[data-theme="dark"] .tool-action-btn {
  border-color: var(--border);
  color: var(--txt-head);
}

[data-theme="dark"] .tool-action-btn:hover {
  background: rgba(79,126,247,.12);
}

[data-theme="dark"] .tool-action-btn.active {
  background: rgba(79,126,247,.15);
}

/* Non-clickable info cards (features): no hover visual change */
.features-section .card-hover:hover {
  border-color: var(--border);
  background: var(--bg-surface);
}

/* Toast readability fix in dark mode */
[data-theme="dark"] .toast {
  background: #f3f6fb;
  color: #0f172a;
}


/* ─────────────────────────────────────────────────────────────
   18. Dark Mode
   ───────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-page:      #111827;
  --bg-surface:   #172033;
  --bg-surface-2: #1f2937;
  --bg-nav:       rgba(23,32,51,.88);

  --txt-head:     #f8fafc;
  --txt-body:     #e5e7eb;
  --txt-muted:    #cbd5e1;

  --border:       #2d3748;

  --shadow-xs:    0 1px 3px rgba(0,0,0,.3);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.6);

  --clr-primary-xs:  rgba(79,126,247,.15);
  --clr-accent-xs:   rgba(139,92,246,.15);

  color-scheme: dark;
}

[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23768390' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .textarea {
  background: var(--bg-surface-2);
  color: var(--txt-head);
}

/* Dark mode: raise contrast for clipboard-specific fields */
[data-theme="dark"] #boardCode:not(:focus),
[data-theme="dark"] #manageCodeInput:not(:focus),
[data-theme="dark"] #firstEntryText:not(:focus),
[data-theme="dark"] #newEntryText:not(:focus),
[data-theme="dark"] #imageFetchCode:not(:focus),
[data-theme="dark"] #imageManageCodeInput:not(:focus) {
  border-color: #8f8f8f;
}

[data-theme="dark"] #boardCode::placeholder,
[data-theme="dark"] #manageCodeInput::placeholder,
[data-theme="dark"] #firstEntryText::placeholder,
[data-theme="dark"] #newEntryText::placeholder,
[data-theme="dark"] #imageFetchCode::placeholder,
[data-theme="dark"] #imageManageCodeInput::placeholder {
  color: #8f8f8f;
  opacity: 1;
}

/* Sun/moon icon visibility - using opacity for better control */
.theme-toggle .icon-sun  { opacity: 0; visibility: hidden; }
.theme-toggle .icon-moon { opacity: 1; visibility: visible; }
[data-theme="dark"] .theme-toggle .icon-sun  { opacity: 1; visibility: visible; }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; visibility: hidden; }


/* ─────────────────────────────────────────────────────────────
   19. Animations & Transitions
   ───────────────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes entrySlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}

.animate-fade { animation: fadeIn .3s var(--ease); }
.animate-scale { animation: none; }

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton { animation: none; background: var(--border); }
}


/* ─────────────────────────────────────────────────────────────
   20. Responsive Overrides
   ───────────────────────────────────────────────────────────── */

/* Tablet */
@media (max-width: 991px) {
  :root {
    --fs-h1: 1.875rem;
    --fs-h2: 1.5625rem;
    --fs-h3: 1.25rem;
    --fs-h4: 1.0625rem;
    --fs-h5: .9375rem;
    --fs-h6: .875rem;
  }

  .toast {
    width: 90vw;
    max-width: 90vw;
  }

  .layout-main-aside {
    grid-template-columns: 1fr;
  }

  .layout-aside {
    position: static;
  }

  .codes-box {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--sp-5);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .site-nav {
    gap: var(--sp-3);
  }

  .site-header {
    z-index: 200;
  }

  .nav-actions {
    margin-inline-start: auto;
    gap: var(--sp-3);
    flex-shrink: 0;
  }

  .nav-menu-toggle {
    display: inline-flex;
    order: 2;
  }

  .theme-toggle {
    order: 1;
  }

  .nav-links {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 64px;
    left: 0;
    width: min(84vw, 360px);
    height: calc(100dvh - 64px);
    padding: var(--sp-3) var(--sp-4) var(--sp-4);
    gap: var(--sp-2);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-105%);
    transition: transform var(--dur-normal) var(--ease);
    z-index: 260;
    margin-inline-start: 0;
    overflow-y: auto;
    pointer-events: auto;
    align-items: stretch;
  }

  .nav-links.open {
    transform: translateX(0);
  }

  .nav-links > li {
    width: 100%;
  }

  .nav-links a,
  .nav-tools-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .78rem .8rem;
    border-radius: var(--r-md);
    font-size: .95rem;
    color: var(--txt-body);
    text-align: left;
  }

  .nav-item-has-dropdown {
    display: flex;
    flex-direction: column;
  }

  .nav-tools-toggle {
    justify-content: space-between;
  }

  .nav-item-has-dropdown > .nav-tools-toggle {
    font-weight: 700;
  }

  .nav-submenu {
    position: static;
    min-width: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin-top: .2rem;
    gap: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--dur-normal) var(--ease);
  }

  .nav-item-has-dropdown.open > .nav-submenu {
    max-height: 420px;
  }

  .nav-submenu a {
    position: relative;
    display: block;
    margin-left: .7rem;
    padding: .65rem .8rem .65rem 1.55rem;
    color: var(--txt-muted);
    font-size: .9rem;
    background: transparent;
  }

  .nav-submenu a::before {
    content: '-';
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--txt-muted);
    transition: color var(--dur-fast) var(--ease),
                transform var(--dur-fast) var(--ease);
  }

  .nav-submenu a:hover::before,
  .nav-submenu a.active::before {
    content: '--';
    color: var(--clr-primary);
    transform: translateY(-50%) translateX(-3px);
  }

  .nav-submenu a:hover,
  .nav-submenu a.active {
    color: var(--clr-primary);
    background: transparent;
  }

  .nav-item-has-dropdown:hover:not(.open) > .nav-submenu,
  .nav-item-has-dropdown:focus-within:not(.open) > .nav-submenu {
    max-height: 0;
  }

  .nav-item-has-dropdown.open > .nav-tools-toggle .nav-tools-chevron {
    transform: rotate(180deg);
  }

  .nav-drawer-overlay {
    display: block;
    position: fixed;
    top: 64px;
    left: min(84vw, 360px);
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, .38);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-normal) var(--ease);
    z-index: 250;
  }

  .nav-drawer-overlay.open {
    opacity: 1;
    pointer-events: none;
  }

  body.nav-drawer-open {
    overflow: hidden;
  }

  body.nav-drawer-open .site-header {
    background: var(--bg-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-item-has-dropdown::after {
    display: none;
  }
}

/* Mobile */
@media (max-width: 767px) {
  :root {
    --container-pad: var(--sp-4);
    --fs-body: .9375rem;
    --fs-small: .8125rem;
    --fs-button: .875rem;
    --fs-h1: 1.625rem;
    --fs-h2: 1.375rem;
    --fs-h3: 1.125rem;
    --fs-h4: 1rem;
    --fs-h5: .9375rem;
    --fs-h6: .875rem;
  }

  .tool-card { padding: var(--sp-5); border-radius: var(--r-lg); }

  .tool-header-row {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .tool-retrieve-group { max-width: 100%; }

  .tool-options {
    flex-direction: column;
    align-items: stretch;
  }

  .expiry-group {
    justify-content: space-between;
    width: 100%;
  }

  .expiry-group .select { flex: 1; }

  .input-group { flex-direction: column; }

  .btn-full-mobile { width: 100%; }

  .board-header { flex-direction: column; align-items: stretch; }
  .board-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
  }
  .board-actions .btn {
    width: 100%;
    min-width: 0;
    padding-inline: .5rem;
  }

  .entry-header {
    position: absolute;
    top: var(--sp-4);
    right: var(--sp-4);
    left: auto;
    justify-content: flex-end;
  }
  .entry-actions { flex-direction: row; flex-wrap: nowrap; }
  .entry-actions .btn { flex: 1; min-width: 0; }

  .codes-box { flex-direction: column; }
  .code-expiry {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .hero__stats { gap: var(--sp-4); }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-6);
  }

  .footer-bottom { flex-direction: column; text-align: center; }

  .image-file-row {
    grid-template-columns: 1fr auto;
  }

  .image-file-row .btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .image-board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .image-item-actions {
    flex-direction: column;
  }

  .image-item-actions .btn {
    width: 100%;
  }

  .file-item {
    align-items: stretch;
  }

  .file-item-actions {
    width: 100%;
    flex-direction: column;
  }

  .file-item-actions .btn {
    width: 100%;
  }

  .grid-auto-3 { grid-template-columns: 1fr; }
}
