/* ==========================================================================
   schools.app — Design System & Global Styles
   Token-driven, theme-aware (light / dark / system). Keep components on tokens.
   ========================================================================== */

/* --- Design tokens: LIGHT (default) ------------------------------------- */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg-app: #fafafa;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-dropzone: #f6f6f7;
  --bg-subtle: #f4f4f5;        /* tonal fills / hover */

  /* Text */
  --text-main: #111111;
  --text-sub: #525252;
  --text-muted: #6e6e6e;       /* AA-safe on #fff and #fafafa (~5:1) */

  /* Borders */
  --border-color: #eaeaea;
  --border-strong: #d4d4d4;
  --border-focus: #111111;

  /* Brand (monochrome) + on-color */
  --primary: #111111;
  --primary-hover: #2b2b2b;
  --on-primary: #ffffff;
  --primary-glow: rgba(0, 0, 0, 0.04);

  /* Functional accent (links, focus ring) — the one chromatic note */
  --accent: #2563eb;
  --accent-tint: rgba(37, 99, 235, 0.10);
  --focus-ring: #2563eb;

  /* Status */
  --danger: #dc2626;
  --danger-tint: rgba(220, 38, 38, 0.10);
  --success: #059669;
  --warning: #d97706;
  --warning-tint: rgba(217, 119, 6, 0.10);

  /* Type */
  --font-sans: 'Inter', 'Inter Fallback', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* Motion */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px -6px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 30px -8px rgba(0, 0, 0, 0.12);

  /* Layout */
  --header-h: 65px;
  --content-max: 1040px;
}

/* --- Design tokens: DARK ------------------------------------------------- */
/* Applied automatically when the OS prefers dark AND the user hasn't forced light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg-app: #0e1014;
    --bg-card: #171a21;
    --bg-input: #1b1f27;
    --bg-dropzone: #14171d;
    --bg-subtle: #1f232b;

    --text-main: #f4f5f7;
    --text-sub: #c3c8d2;
    --text-muted: #9aa1ad;

    --border-color: #272b33;
    --border-strong: #3a3f49;
    --border-focus: #f4f5f7;

    --primary: #f4f5f7;
    --primary-hover: #e4e6ea;
    --on-primary: #14171d;
    --primary-glow: rgba(255, 255, 255, 0.06);

    --accent: #60a5fa;
    --accent-tint: rgba(96, 165, 250, 0.14);
    --focus-ring: #60a5fa;

    --danger: #f87171;
    --danger-tint: rgba(248, 113, 113, 0.14);
    --success: #34d399;
    --warning: #fbbf24;
    --warning-tint: rgba(251, 191, 36, 0.14);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px -8px rgba(0, 0, 0, 0.6);
    --shadow-md: 0 10px 34px -10px rgba(0, 0, 0, 0.7);
  }
}

/* Manual override: forced dark (wins over system light). */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-app: #0e1014;
  --bg-card: #171a21;
  --bg-input: #1b1f27;
  --bg-dropzone: #14171d;
  --bg-subtle: #1f232b;

  --text-main: #f4f5f7;
  --text-sub: #c3c8d2;
  --text-muted: #9aa1ad;

  --border-color: #272b33;
  --border-strong: #3a3f49;
  --border-focus: #f4f5f7;

  --primary: #f4f5f7;
  --primary-hover: #e4e6ea;
  --on-primary: #14171d;
  --primary-glow: rgba(255, 255, 255, 0.06);

  --accent: #60a5fa;
  --accent-tint: rgba(96, 165, 250, 0.14);
  --focus-ring: #60a5fa;

  --danger: #f87171;
  --danger-tint: rgba(248, 113, 113, 0.14);
  --success: #34d399;
  --warning: #fbbf24;
  --warning-tint: rgba(251, 191, 36, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px -8px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 10px 34px -10px rgba(0, 0, 0, 0.7);
}

/* --- Reset & base ------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

a { color: inherit; }

/* Accessible focus ring (keyboard only) */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* Screen-reader-only helpers */
.sr-only,
.sr-only-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip link */
.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transform: translateY(-120%);
  background: var(--primary);
  color: var(--on-primary);
  padding: 0.65rem 1rem;
  border-radius: 0 0 var(--radius-md) 0;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--transition-fast);
}
.skip-link:focus { transform: translateY(0); }

/* --- Layout ------------------------------------------------------------- */
#app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(1.75rem, 4vw, 3rem) clamp(1rem, 4vw, 1.5rem) clamp(3.5rem, 8vw, 6rem);
}

/* --- Header / navigation ------------------------------------------------ */
.site-header {
  background-color: color-mix(in srgb, var(--bg-app) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-nav {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0.85rem clamp(1rem, 4vw, 1.5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--text-main);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.nav-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-btn-item {
  display: inline-block;
  background: none;
  border: none;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-sub);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.nav-btn-item:hover { background-color: var(--bg-subtle); color: var(--text-main); }
.nav-btn-item.active { background-color: var(--primary-glow); color: var(--text-main); font-weight: 600; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Language select + theme toggle */
.lang-switcher {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.6rem center;
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  border-radius: var(--radius-pill);
  padding: 0.4rem 1.6rem 0.4rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  cursor: pointer;
}
.lang-switcher:hover { border-color: var(--border-strong); color: var(--text-main); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-sub);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--text-main); }
.icon-btn svg { width: 18px; height: 18px; display: block; }

/* Theme toggle: show the icon for the action the user can take */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* Hamburger (hidden on desktop) */
.nav-toggle { display: none; }

/* Mobile navigation */
@media (max-width: 820px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: var(--radius-md);
    cursor: pointer;
  }
  .nav-toggle svg { width: 20px; height: 20px; }

  .nav-cluster {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 1rem clamp(1rem, 4vw, 1.5rem) 1.25rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
  }
  .nav-cluster.open { transform: translateY(0); opacity: 1; pointer-events: auto; }

  .nav-links { flex-direction: column; align-items: stretch; gap: 0.15rem; }
  .nav-btn-item { padding: 0.7rem 0.9rem; font-size: 0.98rem; border-radius: var(--radius-md); }
  .nav-actions { justify-content: space-between; padding-top: 0.5rem; border-top: 1px solid var(--border-color); }
  .lang-switcher { flex: 1; }
}

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2.5rem clamp(1rem, 4vw, 1.5rem);
}
.footer-content {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-text { color: var(--text-muted); font-size: 0.82rem; }
.footer-inner { max-width: var(--content-max); margin: 0 auto; }
.footer-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem 1rem;
  padding-bottom: 2rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
}
.footer-col h3 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.8rem; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 0.45rem; }
.footer-col a { color: var(--text-sub); text-decoration: none; font-size: 0.88rem; }
.footer-col a:hover { color: var(--text-main); text-decoration: underline; }

/* --- Tool header -------------------------------------------------------- */
.tool-header { margin-bottom: 2.5rem; text-align: center; }
.tool-header h1 {
  font-size: clamp(1.6rem, 4vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}
.tool-header p {
  color: var(--text-sub);
  font-size: 0.97rem;
  max-width: 620px;
  margin: 0 auto;
}

/* --- Card --------------------------------------------------------------- */
.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 4vw, 2.5rem);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}
.tool-card h2 {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

/* --- Dropzone ----------------------------------------------------------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  border: 1.5px dashed var(--border-strong);
  background-color: var(--bg-dropzone);
  border-radius: var(--radius-md);
  padding: clamp(2.25rem, 8vw, 4rem) clamp(1rem, 4vw, 2rem);
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.dropzone:hover, .dropzone.drag-over, .dropzone:focus-within {
  border-color: var(--text-main);
  background-color: var(--primary-glow);
}
.dropzone-icon { color: var(--text-muted); transition: var(--transition-fast); display: flex; }
.dropzone-icon svg { width: 32px; height: 32px; }
.dropzone:hover .dropzone-icon, .dropzone:focus-within .dropzone-icon { color: var(--text-main); transform: translateY(-2px); }
.dropzone p { font-size: 0.95rem; color: var(--text-sub); font-weight: 500; }
.dropzone span { font-size: 0.8rem; color: var(--text-muted); }

.file-input-hidden { display: none; }

/* --- File queue --------------------------------------------------------- */
.file-queue { margin-top: 1.75rem; display: flex; flex-direction: column; gap: 0.6rem; }
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  transition: var(--transition-fast);
}
.file-row:hover { border-color: var(--border-strong); }
.file-info { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.file-icon { color: var(--text-muted); flex-shrink: 0; }
.file-name { font-size: 0.9rem; font-weight: 500; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; }
.file-actions { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.2;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-full { width: 100%; }

.btn-primary { background-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background-color: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background-color: transparent;
  color: var(--text-sub);
  border-color: var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { color: var(--text-main); border-color: var(--text-main); }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-tonal {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-tonal:hover:not(:disabled) { border-color: var(--border-strong); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-icon:hover { background-color: var(--bg-subtle); color: var(--text-main); }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-icon.delete:hover { background-color: var(--danger-tint); color: var(--danger); }

/* Comfortable touch targets on touch devices */
@media (pointer: coarse) {
  .btn-icon { min-width: 44px; min-height: 44px; }
  .file-actions { gap: 0.5rem; }
}

/* --- Forms -------------------------------------------------------------- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1.4rem;
  margin-bottom: 1.75rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-main);
  background-color: var(--bg-input);
  transition: var(--transition-fast);
}
.form-input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
}

/* Range + color inputs on-brand */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
}
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
  padding: 2px;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

/* --- Image to PDF grid -------------------------------------------------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}
.image-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition-fast);
}
.image-card:hover { border-color: var(--border-strong); }
.image-preview-wrapper {
  aspect-ratio: 1;
  width: 100%;
  overflow: hidden;
  position: relative;
  background-color: #0b0b0b;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform 0.2s ease; }
.image-card-controls {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
}
.image-card-controls .btn-icon { width: 26px; height: 26px; font-size: 0.9rem; }

/* --- Word Counter ------------------------------------------------------- */
.wordcounter-layout { display: grid; grid-template-columns: 2.2fr 1fr; gap: 1.75rem; }
.textarea-wrapper { display: flex; flex-direction: column; }
.word-textarea {
  width: 100%;
  min-height: 320px;
  padding: 1.4rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  color: var(--text-main);
  background-color: var(--bg-input);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}
.word-textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--primary-glow); }

.counter-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.25rem; }
.counter-stat-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}
.counter-stat-box:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.counter-stat-box h3 { font-size: 1.5rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.counter-stat-box span { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.03em; }

.density-card h2, .density-card h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-main); margin-bottom: 1rem; border: none; padding: 0; }
.density-list { display: flex; flex-direction: column; gap: 0.7rem; }
.density-row { display: flex; justify-content: space-between; font-size: 0.85rem; border-bottom: 1px dotted var(--border-color); padding-bottom: 0.25rem; }
.density-word { color: var(--text-sub); font-weight: 500; }
.density-count { font-weight: 600; color: var(--text-main); }

/* --- GPA calculator rows ------------------------------------------------ */
.gpa-course-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 0.85rem; align-items: center; }
.gpa-head { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); }
.gpa-head span { font-weight: 600; font-size: 0.78rem; color: var(--text-sub); text-transform: uppercase; letter-spacing: 0.03em; }

/* --- Landing page ------------------------------------------------------- */
.hero { text-align: center; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem); }
.hero-badge {
  display: inline-block;
  background: var(--bg-subtle);
  color: var(--text-sub);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}
.hero-title {
  font-size: clamp(2.2rem, 6vw + 0.5rem, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
  overflow-wrap: break-word;
}
.hero-desc { font-size: clamp(1rem, 2.5vw, 1.15rem); color: var(--text-sub); max-width: 640px; margin: 0 auto; line-height: 1.6; }

.section-title { font-size: clamp(1.5rem, 4vw, 1.9rem); font-weight: 700; text-align: center; letter-spacing: -0.01em; color: var(--text-main); }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
.feature-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.feature-card .feat-icon { display: flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--bg-subtle); color: var(--text-main); margin-bottom: 1.1rem; }
.feature-card .feat-icon svg { width: 24px; height: 24px; }
.feature-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); margin-bottom: 0.4rem; }
.feature-card p { color: var(--text-sub); font-size: 0.92rem; line-height: 1.5; flex: 1; margin-bottom: 1rem; }
.feature-card .feat-cta { color: var(--accent); font-weight: 600; font-size: 0.88rem; }

.benefit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; text-align: center; }
.benefit .b-icon { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: var(--radius-md); background: var(--bg-subtle); color: var(--text-main); margin-bottom: 1rem; }
.benefit h4 { font-size: 1.08rem; color: var(--text-main); margin-bottom: 0.5rem; }
.benefit p { font-size: 0.92rem; color: var(--text-sub); line-height: 1.5; }

.faq-list { display: flex; flex-direction: column; gap: 0.85rem; max-width: 760px; margin: 0 auto; }
.faq-item { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 1.3rem 1.5rem; }
.faq-item h4 { font-size: 1.02rem; color: var(--text-main); margin-bottom: 0.4rem; }
.faq-item p { color: var(--text-sub); font-size: 0.92rem; line-height: 1.55; }

.cta-card {
  text-align: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: clamp(2.5rem, 6vw, 3.5rem) 1.5rem;
}
.cta-card h2 { font-size: clamp(1.5rem, 4vw, 2rem); color: var(--text-main); margin-bottom: 0.75rem; }
.cta-card p { color: var(--text-sub); margin-bottom: 1.75rem; font-size: 1.02rem; }

/* --- Toast / status notifications -------------------------------------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 4vw, 2rem);
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--text-muted);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  pointer-events: auto;
  animation: toast-in 0.25s ease;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.is-leaving { animation: toast-out 0.2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Inline warning banner */
.warning-alert {
  background: var(--warning-tint);
  border: 1px solid transparent;
  border-left: 4px solid var(--warning);
  color: var(--text-main);
  padding: 0.9rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

/* --- Spinner ------------------------------------------------------------ */
.spinner {
  border: 2px solid color-mix(in srgb, var(--on-primary) 30%, transparent);
  border-top-color: var(--on-primary);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Text diff (Text Compare) ------------------------------------------- */
.diff-line { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; white-space: pre-wrap; word-break: break-word; padding: 2px 8px; border-radius: 3px; }
.diff-add { background: rgba(5, 150, 105, 0.15); }
.diff-del { background: rgba(220, 38, 38, 0.15); }
:root[data-theme="dark"] .diff-add, .diff-add { background: rgba(52, 211, 153, 0.16); }
:root[data-theme="dark"] .diff-del, .diff-del { background: rgba(248, 113, 113, 0.16); }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .wordcounter-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .counter-stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .gpa-course-row { grid-template-columns: 1fr 1fr auto; }
  .gpa-course-row .course-name { grid-column: 1 / -1; }
  .gpa-head { display: none; }
}

/* --- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .counter-stat-box:hover, .feature-card:hover { transform: none; }
}

/* --- Performance & responsive hardening --------------------------------- */
/* Never let media cause horizontal overflow on small screens. */
img, video { max-width: 100%; height: auto; }
canvas, svg { max-width: 100%; }
/* Self-hosted Inter (latin) — no render-blocking third-party font chain. */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/inter-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/inter-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('/assets/fonts/inter-800.woff2') format('woff2'); }
/* Metric-matched fallback so the Inter web-font swap shifts ~0 (less CLS). */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Segoe UI'), local('Roboto'), local('Helvetica Neue'), local('Arial');
  size-adjust: 107%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}
/* Break long translated compound words instead of overflowing tight columns. */
.feature-card h3, .section-title, .footer-col a, .footer-col h3, .hero-title, .nav-btn-item { overflow-wrap: break-word; }
@media (pointer: coarse) {
  .lang-switcher, .icon-btn { min-height: 44px; }
}

/* --- RTL (Arabic) ------------------------------------------------------- */
html[dir="rtl"] { direction: rtl; text-align: right; }
html[dir="rtl"] .logo-img { margin-right: 0; margin-left: 0.5rem; }
html[dir="rtl"] .lang-switcher { background-position: left 0.6rem center; padding: 0.4rem 0.8rem 0.4rem 1.6rem; }
html[dir="rtl"] select.form-input { background-position: left 0.7rem center; padding-right: 0.9rem; padding-left: 2rem; }
html[dir="rtl"] .toast { border-left: 1px solid var(--border-color); border-right: 4px solid var(--text-muted); }
html[dir="rtl"] .warning-alert { border-left: 1px solid transparent; border-right: 4px solid var(--warning); }
