/*
 * Swing Catalyst — Custom Theme for Hugo Relearn
 *
 * Overrides Relearn defaults with brand styling.
 * Colors use Relearn's --INTERNAL-* variables for automatic dark/light support.
 * Custom --sc-* tokens provide consistent accent values.
 *
 * Relearn loads variant CSS files (theme-sc-light.css / theme-sc-dark.css)
 * which define the full color palette. This file only adds custom components
 * and styling enhancements.
 */

/* ================================================================
   CUSTOM TOKENS
   ================================================================ */

:root {
  /* Brand accent — reference tokens (used in custom components) */
  --sc-accent: var(--INTERNAL-PRIMARY-color);
  --sc-accent-hover: var(--INTERNAL-PRIMARY-HOVER-color);

  /* Easing */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes sc-fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sc-card-enter {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sc-ball-arc {
  0% { transform: translate(0, 0); opacity: 1; }
  30% { transform: translate(60px, -80px); opacity: 1; }
  60% { transform: translate(120px, -20px); opacity: 0.8; }
  80% { transform: translate(160px, 40px); opacity: 0.5; }
  100% { transform: translate(200px, 60px); opacity: 0; }
}

@keyframes sc-scroll-hint {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.6; }
  50% { transform: translateX(-50%) translateY(6px); opacity: 1; }
}

@keyframes sc-bounce-in {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.9); }
  100% { opacity: 1; transform: scale(1); }
}

/* 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;
  }
}

/* ================================================================
   CONTENT FADE-IN
   ================================================================ */

#R-body-inner,
#body-inner {
  animation: sc-fade-in-up 0.4s var(--ease-out);
}

/* ================================================================
   TYPOGRAPHY — Inter body + Source Serif 4 headings
   Inspired by Anthropic support: clean, spacious, editorial
   ================================================================ */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-feature-settings: "kern" 1, "liga" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  color: var(--INTERNAL-MAIN-TEXT-color);
}

h1, h2, h3, h4, h5, h6,
.sc-section-title {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
}

.sc-card__title,
.sc-quick-link__text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#R-body-inner, #body-inner {
  line-height: 1.65;
  font-size: 0.9375rem; /* 15px — clean reading size */
}

/* Content width for readability */
#R-body .flex-block-wrapper {
  max-width: 48rem;
}

#R-body-inner p, #body-inner p {
  margin-bottom: 1.25em;
}

#R-body-inner h1,
#body-inner h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  font-size: 1.75rem;
  margin-top: 0;
  margin-bottom: 1.25rem;
  border-bottom: none;
  padding-bottom: 0;
}

#R-body-inner h2, #body-inner h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  font-size: 1.35rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

#R-body-inner h3, #body-inner h3 {
  font-weight: 600;
  line-height: 1.35;
  font-size: 1.1rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

/* Suppress animated underlines on nav/button elements */
nav a::after,
.btn::after,
button::after,
.sc-card::after,
.sc-quick-link::after,
.sc-cta__button::after,
.sc-hero a::after {
  display: none !important;
}

/* ================================================================
   SELECTION & FOCUS
   ================================================================ */

::selection {
  background-color: color-mix(in srgb, var(--sc-accent) 30%, transparent);
}

*:focus-visible {
  outline: 2px solid var(--sc-accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc-accent) 15%, transparent);
}

/* ================================================================
   IMAGES
   ================================================================ */

#R-body-inner img,
#body-inner img {
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: zoom-in;
}

#R-body-inner img:hover,
#body-inner img:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ================================================================
   HERO SECTION — always dark branded background (#151926)
   ================================================================ */

.sc-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  margin: -1rem -0.8rem 0;
  overflow: hidden;
  background: var(--sc-hero-bg);
}

.sc-hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 30% 20%, var(--sc-hero-gradient-a) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, var(--sc-hero-gradient-b) 0%, transparent 50%);
  pointer-events: none;
  z-index: 1;
}

.sc-hero__content {
  position: relative;
  z-index: 2;
  animation: sc-fade-in-up 0.6s var(--ease-out);
}

.sc-hero__title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 0.8rem;
  border: none !important;
  padding: 0 !important;
}

.sc-hero__logo {
  height: clamp(2.8rem, 7vw, 4.5rem);
  width: auto;
  filter: drop-shadow(0 4px 20px var(--sc-hero-gradient-a));
}

.sc-hero__subtitle {
  color: var(--sc-hero-text-muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
  font-weight: 400;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

.sc-hero__search {
  display: flex;
  align-items: center;
  max-width: 540px;
  margin: 0 auto;
  background: var(--sc-hero-search-bg);
  border: 1px solid var(--sc-hero-search-border);
  border-radius: 12px;
  padding: 0.8rem 1.2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sc-hero__search:focus-within {
  border-color: var(--INTERNAL-PRIMARY-color);
  box-shadow: 0 0 0 4px var(--sc-hero-gradient-a), 0 4px 16px rgba(0, 0, 0, 0.08);
}

.sc-hero__search-label {
  color: var(--sc-hero-text-muted);
  display: flex;
  align-items: center;
  margin-right: 0.6rem;
}

.sc-hero__search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--sc-hero-text);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

.sc-hero__search-input::placeholder {
  color: var(--sc-hero-text-muted);
}

.sc-hero__particles {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

.sc-hero__particles canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.sc-hero__scroll {
  display: none; /* Hidden — compact hero doesn't need scroll hint */
}

.sc-hero__scroll svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* ================================================================
   HOME CONTENT AREA — warm off-white background
   ================================================================ */

.sc-home-content {
  padding: 1.5rem 2rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ================================================================
   HOMEPAGE LAYOUT — hide sidebar, full width
   ================================================================ */

body.sc-homepage #R-body .flex-block-wrapper {
  max-width: 100%;
  padding: 0;
}

body.sc-homepage #R-topbar {
  background: transparent;
  box-shadow: none;
}

body.sc-homepage #R-sidebar,
body.sc-homepage #sidebar,
body.sc-homepage aside {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
}

body.sc-homepage #R-body,
body.sc-homepage #R-body-inner,
body.sc-homepage #body-inner,
body.sc-homepage main {
  max-width: 100%;
  margin-left: 0 !important;
  padding-left: 0;
  width: 100% !important;
}

body.sc-homepage .topbar-sidebar-divider {
  display: none !important;
}

body.sc-homepage #R-main-overlay {
  display: none !important;
}

body.sc-homepage #R-body-overlay {
  display: none !important;
}

/* ================================================================
   HIDE RELEARN'S BUILT-IN SIDEBAR SELECTORS
   (we use our own fixed top-right controls instead)
   ================================================================ */

li.R-languageswitcher,
li.R-variantswitcher {
  display: none !important;
}

/* ================================================================
   GLOBAL CONTROLS — language + theme selectors (all pages, top-right)
   ================================================================ */

.sc-global-controls {
  position: fixed;
  top: 0.6rem;
  right: 1rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sc-global-controls__select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--sc-controls-bg);
  border: 1px solid var(--sc-controls-border);
  border-radius: 6px;
  padding: 0.3rem 1.6rem 0.3rem 0.65rem;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--sc-controls-text);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: none;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.sc-global-controls__select:hover {
  border-color: var(--INTERNAL-PRIMARY-color);
  color: var(--INTERNAL-MAIN-TEXT-color);
}

.sc-global-controls__select:focus {
  outline: none;
  border-color: var(--INTERNAL-PRIMARY-color);
  box-shadow: 0 0 0 2px var(--sc-hero-gradient-a);
}

/* ================================================================
   GETTING STARTED CTA
   ================================================================ */

.sc-cta {
  margin: 2.5rem 0;
  animation: sc-fade-in-up 0.6s var(--ease-out) 0.1s both;
}

.sc-cta__content {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--sc-accent) 10%, transparent) 0%, color-mix(in srgb, var(--sc-accent) 3%, transparent) 100%);
  border: 1.5px solid color-mix(in srgb, var(--sc-accent) 25%, transparent);
  border-radius: 12px;
}

.sc-cta__icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.sc-cta__text {
  flex: 1;
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.8;
  font-size: 0.9rem;
  line-height: 1.4;
}

.sc-cta__text strong {
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 1;
}

.sc-cta__button {
  display: inline-block;
  flex-shrink: 0;
  padding: 0.6rem 1.5rem;
  background: var(--sc-accent);
  color: #fff !important;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none !important;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--sc-accent) 30%, transparent);
  transition: all 0.3s var(--ease-spring);
  white-space: nowrap;
}

.sc-cta__button:hover {
  background: var(--sc-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--sc-accent) 40%, transparent);
}

/* ================================================================
   CATEGORY CARDS
   ================================================================ */

.sc-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  padding: 0 0 1.5rem;
}

.sc-card {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--INTERNAL-MAIN-BG-color);
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 12%, transparent);
  border-radius: 12px;
  text-decoration: none !important;
  color: var(--INTERNAL-MAIN-TEXT-color) !important;
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition: transform 0.4s var(--ease-spring), box-shadow 0.3s ease, border-color 0.3s ease;
  animation: sc-card-enter 0.5s var(--ease-out) calc(var(--index, 0) * 0.08s) both;
}

.sc-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--sc-accent), var(--sc-accent-hover), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sc-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--sc-accent) 30%, transparent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.sc-card:hover::before {
  opacity: 1;
}

.sc-card__icon {
  color: var(--sc-accent);
  margin-bottom: 0.8rem;
  transition: transform 0.4s var(--ease-spring);
}

.sc-card:hover .sc-card__icon {
  transform: scale(1.15);
}

.sc-card__title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--INTERNAL-MAIN-TEXT-color);
}

.sc-card__desc {
  font-size: 0.84rem;
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.6;
  margin: 0 0 0.8rem;
  flex: 1;
  line-height: 1.5;
}

.sc-card__count {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--sc-accent);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.7rem;
  background: color-mix(in srgb, var(--sc-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--sc-accent) 20%, transparent);
  border-radius: 20px;
}

/* Accent variant for Getting Started card */
.sc-card--accent {
  border-color: color-mix(in srgb, var(--sc-accent) 30%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--sc-accent) 8%, transparent) 0%, var(--INTERNAL-MAIN-BG-color) 60%);
}

.sc-card--accent::before {
  opacity: 1;
}

.sc-card--accent:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), 0 0 40px color-mix(in srgb, var(--sc-accent) 18%, transparent);
}

/* ================================================================
   SECTION TITLES & QUICK LINKS
   ================================================================ */

.sc-section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--INTERNAL-MAIN-TEXT-color);
  margin: 0 0 1.2rem;
  letter-spacing: -0.02em;
  border: none !important;
  padding: 0 !important;
}

.sc-quick-links {
  padding: 0 0 2rem;
  animation: sc-fade-in-up 0.6s var(--ease-out) 0.3s both;
}

.sc-quick-links__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.sc-quick-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 1rem;
  background: var(--INTERNAL-MAIN-BG-color);
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 12%, transparent);
  border-radius: 8px;
  text-decoration: none !important;
  color: var(--INTERNAL-MAIN-TEXT-color) !important;
  transition: all 0.25s var(--ease-smooth);
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
  overflow: hidden;
}

.sc-quick-link::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--sc-accent);
  border-radius: 8px 0 0 8px;
  transition: width 0.25s var(--ease-smooth);
}

.sc-quick-link:hover {
  border-color: color-mix(in srgb, var(--sc-accent) 30%, transparent);
  background: color-mix(in srgb, var(--sc-accent) 6%, transparent);
  transform: translateX(4px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.sc-quick-link:hover::before {
  width: 3px;
}

.sc-quick-link__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.sc-quick-link__icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--sc-accent);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ================================================================
   POPULAR ARTICLES
   ================================================================ */

.sc-popular {
  padding: 1.5rem 0 1.5rem;
  border-top: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 12%, transparent);
  animation: sc-fade-in-up 0.6s var(--ease-out) 0.3s both;
}

.sc-popular__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

/* ================================================================
   FEEDBACK WIDGET
   ================================================================ */

.sc-feedback {
  margin-top: 3rem;
  padding: 1.5rem;
  background: var(--INTERNAL-MAIN-BG-color);
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 12%, transparent);
  border-radius: 12px;
  text-align: center;
}

.sc-feedback__title {
  font-size: 0.95rem;
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.65;
  margin: 0 0 0.8rem;
}

.sc-feedback__buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.sc-feedback__btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 20%, transparent);
  border-radius: 8px;
  color: var(--INTERNAL-MAIN-TEXT-color);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.sc-feedback__btn:hover {
  border-color: var(--sc-accent);
  color: var(--sc-accent);
}

.sc-feedback__btn.voted {
  background: color-mix(in srgb, var(--sc-accent) 15%, transparent);
  border-color: var(--sc-accent);
  color: var(--sc-accent);
  pointer-events: none;
}

.sc-feedback__btn .icon {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
}

.sc-feedback__btn:hover .icon {
  transform: scale(1.2);
}

.sc-feedback__thanks {
  color: var(--sc-accent);
  font-weight: 500;
  display: none;
  margin-top: 0.8rem;
  animation: sc-fade-in-up 0.3s var(--ease-out);
}

/* ================================================================
   IMAGE LIGHTBOX
   ================================================================ */

.sc-lightbox {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 2rem;
}

.sc-lightbox.active {
  opacity: 1;
}

.sc-lightbox img {
  max-width: 95%;
  max-height: 95%;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.3s ease;
  cursor: default;
  border: none !important;
}

.sc-lightbox.active img {
  transform: scale(1);
}

.sc-lightbox__close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: var(--INTERNAL-PRIMARY-color);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.sc-lightbox__close:hover {
  background: var(--INTERNAL-PRIMARY-HOVER-color);
  transform: scale(1.1);
}

/* ================================================================
   404 PAGE
   ================================================================ */

.sc-404 {
  text-align: center;
  padding: 3rem 1rem;
}

.sc-404 h1 {
  font-size: 6rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--sc-accent) 0%, var(--sc-accent-hover) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
  line-height: 1;
  border: none !important;
}

.sc-404 h2 {
  font-size: 1.5rem;
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.65;
  border: none !important;
  font-weight: 400;
}

.sc-404__animation {
  position: relative;
  height: 80px;
  margin: 2rem auto;
  max-width: 300px;
}

.sc-404__ball {
  width: 20px;
  height: 20px;
  background: radial-gradient(circle at 40% 40%, #fff 0%, var(--sc-accent) 40%, var(--sc-accent-hover) 100%);
  border-radius: 50%;
  position: absolute;
  left: 20px;
  top: 30px;
  animation: sc-ball-arc 3s ease-in-out infinite;
}

.sc-404__ground {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 20%, transparent), var(--sc-accent), color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 20%, transparent), transparent);
}

.sc-404__actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.sc-404__actions .btn {
  background-color: var(--sc-accent);
  border: 2px solid var(--sc-accent);
  border-radius: 6px;
  color: #fff;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s var(--ease-spring);
}

.sc-404__actions .btn:hover {
  background-color: var(--sc-accent-hover);
  border-color: var(--sc-accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px color-mix(in srgb, var(--sc-accent) 40%, transparent);
}

.sc-404__actions .btn-outline {
  background-color: transparent;
  color: var(--sc-accent);
}

.sc-404__actions .btn-outline:hover {
  background-color: var(--sc-accent);
  color: #fff;
}

/* ================================================================
   KEYBOARD SHORTCUTS MODAL
   ================================================================ */

.sc-shortcuts-modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.sc-shortcuts-modal.active {
  display: flex;
}

.sc-shortcuts-modal__content {
  background: var(--INTERNAL-MAIN-BG-color);
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 20%, transparent);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  animation: sc-bounce-in 0.3s var(--ease-out);
}

.sc-shortcuts-modal__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--INTERNAL-MAIN-TEXT-color);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sc-shortcuts-modal__close {
  background: none;
  border: none;
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.5;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem;
}

.sc-shortcut-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 10%, transparent);
}

.sc-shortcut-row:last-child {
  border-bottom: none;
}

.sc-shortcut-row__desc {
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.65;
  font-size: 0.9rem;
}

.sc-shortcut-row__key {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 20%, transparent);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--INTERNAL-MAIN-TEXT-color);
  font-family: monospace;
  font-size: 0.8rem;
}

/* ================================================================
   RELATED ARTICLES
   ================================================================ */

.sc-related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 12%, transparent);
}

.sc-related__title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--INTERNAL-MAIN-TEXT-color);
  opacity: 0.65;
  margin: 0 0 1rem;
  border: none !important;
  padding: 0 !important;
}

.sc-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.sc-related__item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.8rem;
  background: var(--INTERNAL-MAIN-BG-color);
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 12%, transparent);
  border-radius: 8px;
  text-decoration: none !important;
  color: var(--INTERNAL-MAIN-TEXT-color) !important;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  line-height: 1.3;
}

.sc-related__item:hover {
  border-color: color-mix(in srgb, var(--sc-accent) 30%, transparent);
  background: color-mix(in srgb, var(--sc-accent) 5%, transparent);
  transform: translateY(-2px);
}

.sc-related__icon {
  flex-shrink: 0;
  font-size: 1rem;
}

/* ================================================================
   STICKY TABLE OF CONTENTS
   ================================================================ */

#R-navigation {
  position: sticky;
  top: 3.5rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ================================================================
   SIDEBAR — refined typography
   ================================================================ */

#R-sidebar,
#sidebar {
  font-size: 0.875rem;
}

#R-sidebar .padding,
#sidebar .padding {
  padding-top: 1.5rem;
}

/* Sidebar menu items */
#R-sidebar ul li,
#sidebar ul li {
  line-height: 1.5;
}

/* Table styling — clean borders */
#R-body-inner table,
#body-inner table {
  font-size: 0.875rem;
  border-collapse: collapse;
}

#R-body-inner th,
#body-inner th {
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

/* Lists — tighter spacing */
#R-body-inner li,
#body-inner li {
  margin-bottom: 0.3em;
}

/* Code — subtle background */
#R-body-inner code,
#body-inner code {
  font-size: 0.85em;
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

/* ================================================================
   PREV/NEXT NAVIGATION — hidden for KB (non-linear articles)
   ================================================================ */

.topbar-button-prev,
.topbar-button-next {
  display: none;
}

/* ================================================================
   SEARCH RESULTS — fix text cutoff
   ================================================================ */

#R-searchresults .searchresults,
#R-searchresults .autocomplete-suggestion {
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
}

#R-searchresults {
  overflow-x: hidden;
}

/* ================================================================
   BACK TO TOP BUTTON
   ================================================================ */

.sc-back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--INTERNAL-MAIN-TEXT-color) 15%, transparent);
  background: var(--INTERNAL-MAIN-BG-color);
  color: var(--INTERNAL-MAIN-TEXT-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease, border-color 0.2s ease;
}

.sc-back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.sc-back-to-top:hover {
  background: var(--sc-accent);
  border-color: var(--sc-accent);
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--sc-accent) 35%, transparent);
}

.sc-back-to-top svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ================================================================
   READING PROGRESS BAR
   ================================================================ */

.sc-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sc-accent-hover), var(--sc-accent));
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ================================================================
   PRINT STYLES
   ================================================================ */

@media print {
  header, nav, aside, footer,
  .sc-progress, .sc-feedback, .sc-lightbox,
  .sc-shortcuts-modal, .search, button, .btn {
    display: none !important;
  }

  main, article, #body-inner, #R-body-inner {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  body {
    font-size: 11pt;
    color: #000 !important;
  }

  h1 { color: #000 !important; border-bottom-color: #FF5C00 !important; font-size: 18pt; }
  h2 { color: #000 !important; border-bottom-color: #ccc !important; font-size: 14pt; }

  a { color: #FF5C00 !important; text-decoration: underline !important; }

  img {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    max-width: 100%;
  }

  table { page-break-inside: avoid; }

  pre {
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
    white-space: pre-wrap;
  }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 1024px) {
  .sc-categories { grid-template-columns: repeat(2, 1fr); }
  .sc-hero { padding: 2rem 1.5rem 1.5rem; }
  .sc-hero__logo { height: clamp(2.4rem, 6vw, 3.4rem); }
  .sc-home-content { padding: 1.2rem 1.5rem; }
}

@media (max-width: 768px) {
  .sc-hero { padding: 2rem 1rem 1.5rem; }
  .sc-hero__logo { height: clamp(2rem, 5vw, 2.8rem); }
  .sc-categories { grid-template-columns: 1fr; }
  .sc-quick-links__grid, .sc-popular__grid { grid-template-columns: 1fr; }
  .sc-section-title { font-size: 1.3rem; }
  .sc-404 h1 { font-size: 4rem; }
  .sc-home-content { padding: 1rem 1rem; }
  .sc-global-controls { top: 0.4rem; right: 0.5rem; }
  .sc-global-controls__select { font-size: 0.68rem; padding: 0.25rem 1.4rem 0.25rem 0.5rem; }
}

@media (max-width: 480px) {
  .sc-hero { padding: 1.5rem 0.75rem 1.2rem; }
  .sc-hero__subtitle { font-size: 0.9rem; }
  .sc-hero__search { padding: 0.5rem 0.8rem; }
  .sc-card { padding: 1.2rem; }
  .sc-related__grid { grid-template-columns: 1fr; }
  .sc-global-controls { top: 0.3rem; right: 0.3rem; gap: 0.25rem; }
}
