/* =========================================
   THEME TOKENS (Design System)
   ========================================= */

/* Light mode defaults */
:root {
  --bg-primary: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-surface-soft: rgba(255, 255, 255, 0.85);

  --text-primary: #0f172a;
  --text-secondary: #475569;

  --border-subtle: rgba(15, 23, 42, 0.08);

  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);

  --shadow-soft: 0 8px 28px rgba(2, 6, 23, 0.08);
}

/* Dark mode overrides */
html.dark-mode {
  --bg-primary: #0b0d10;
  --bg-surface: #111418;
  --bg-surface-soft: rgba(20, 25, 32, 0.75);

  --text-primary: rgba(255, 255, 255, 0.92);
  --text-secondary: rgba(226, 232, 240, 0.70);

  --border-subtle: rgba(255, 255, 255, 0.10);

  --accent: #7aa2ff;
  --accent-soft: rgba(120, 160, 255, 0.20);

  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* Minimal modern search bar styles */
.linear-book-search-form {
  margin: 0 auto;
  max-width: 320px;
  background: none;
}

.linear-book-search-wrapper {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  padding: 0.25rem 0.5rem;
  gap: 0.25rem;
}

.linear-book-search-input {
  border: none;
  background: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border-radius: 2rem;
  outline: none;
  flex: 1;
}

.linear-book-search-btn {
  background: url('data:image/svg+xml;utf8,<svg fill="none" stroke="%23000" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>') center/1.1rem 1.1rem no-repeat;
  border: none;
  padding: 0.25rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  text-indent: -9999px;
  overflow: hidden;
}
.linear-book-search-btn:hover {
  background: #f0f0f0;
}

/* Search page layout: center form and widen input */
.path-search .main-content__container {
  min-height: calc(100vh - 240px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.path-search .view-search {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.path-search .views-exposed-form {
  width: 100%;
  display: flex;
  justify-content: center;
}

.path-search .views-exposed-form .form-item-keys {
  width: min(720px, 90vw);
  margin: 0 auto;
}

.path-search .views-exposed-form .form-item-keys input,
.path-search .views-exposed-form input[type="search"],
.path-search .views-exposed-form .form-search {
  width: 100%;
  max-width: 700px;
  border-radius: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.85rem 1.4rem;
  border: 1px solid rgba(10, 20, 40, 0.18);
  background: #ffffff;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
}

.path-search .views-exposed-form .form-actions {
  margin-left: 0.75rem;
  display: flex;
  align-items: center;
}

.path-search .views-exposed-form .form-actions .form-submit,
.path-search .views-exposed-form .form-actions input[type="submit"] {
  border-radius: 0;
  padding: 0.8rem 1.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 18px rgba(12, 84, 193, 0.18);
}

.path-search .views-exposed-form .form-actions .form-submit:hover,
.path-search .views-exposed-form .form-actions input[type="submit"]:hover {
  filter: brightness(0.98);
}

.path-search .views-exposed-form input::placeholder {
  color: rgba(10, 20, 40, 0.5);
}

/* Minimal Olivero-friendly overrides for Linear Book */

/* Single-row top header layout */
.site-header__inner__container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

.site-header .region--header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

.site-header .header-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
}

.site-header .header-nav .menu,
.site-header .header-nav .menu__item,
.site-header .header-nav .menu__link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

.site-header .header-nav .menu {
  padding: 0;
  margin: 0;
  list-style: none;
}

.site-header .header-nav .menu__item {
  margin: 0;
}

/* Keep header compact */
.site-header__inner {
  padding-block: 0.5rem;
}

/* Float the sticky header toggle */
.sticky-header-toggle {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  z-index: 20;
}

.site-branding__logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.site-branding__inner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#block-linear-book-site-branding {
  padding: 0;
  margin: 0;
  justify-content: flex-start;
}

/* Keep branding block aligned with container width */
.site-branding {
  margin-inline: 0;
  padding-inline: var(--container-padding, 1.5rem);
  background-image: none;
}

#block-linear-book-site-branding.site-branding {
  padding-inline: 0;
}

#block-linear-book-site-branding .site-branding__inner {
  max-width: var(--max-width, 84rem);
  margin-inline: 0;
  width: 100%;
  padding: 0;
  justify-content: flex-start;
}

.site-logo-mathjax {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  justify-content: flex-start;
}

.site-logo-mathjax__tex {
  font-size: 5rem;
  line-height: 1;
  color: #000;
}

.site-logo-math {
  display: inline-flex;
  align-items: center;
  font-size: 1.5rem;
  line-height: 1;
}

.linear-book-toggle {
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border-radius: 999px;
  border: 1px solid var(--color--gray-300, #d3d3d3);
  background-color: var(--color--white, #fff);
  color: var(--color--gray-900, #1a1a1a);
  font-size: 1.2rem;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  position: relative;
  z-index: 10;
  padding: 0.25rem 0.5rem;
  box-shadow: none;
}

.linear-book-toggle:hover {
  background-color: var(--color--gray-100, #f6f6f6);
  border-color: var(--color--gray-400, #c5c5c5);
}

/* Put the toggle next to logo in the branding */
.site-branding__inner .linear-book-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  min-height: 0;
}

/* Satellite icon: transparent, no border/shadow */
.site-branding__inner .linear-book-toggle,
.site-branding__inner .linear-book-toggle .icon-sun {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

.site-branding__inner .linear-book-toggle__label,
.site-branding__inner .linear-book-toggle__slash {
  font-size: 1rem;
  line-height: 1;
}

html.dark-mode .linear-book-toggle {
  background-color: rgba(0, 0, 0, 0.7);
  color: #f1f3f6;
}

.site-branding__inner .linear-book-toggle:hover {
  background-color: #e0e0e0;
}

.site-branding__inner .linear-book-toggle svg,
.site-branding__inner .linear-book-toggle .icon-sun,
.site-branding__inner .linear-book-toggle .icon-moon {
  fill: #333;
  stroke: #333;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  visibility: visible !important;
  opacity: 1 !important;
  font-size: 2.6rem;
  line-height: 1;
}

/* Tornado (sun) icon color */
.site-branding__inner .linear-book-toggle .icon-sun {
  color: #3b82f6;
  fill: currentColor;
  stroke: currentColor;
  animation: satellite-bob 8s ease-in-out infinite, satellite-spin 60s linear infinite;
  transform-origin: 50% 50%;
}

@keyframes satellite-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes satellite-spin {
  0% { rotate: 0deg; }
  100% { rotate: 360deg; }
}

/* Dark mode toggle: remove white tile look */
.dark-switch,
.dark-switch button,
.dark-switch-toggle,
.olivero-dark-switch button {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}

header svg,
header .icon {
  fill: currentColor;
  color: inherit;
}

/* Remove background from icon-only header buttons */
header button,
header .button,
header [role="button"] {
  background: transparent;
  box-shadow: none;
  border: none;
}

/* Header nav alignment */
.site-header #header-nav,
.site-header .header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

/* Make search icon not look like a random square */
#block-linear-book-meili-search {
  margin-left: 0;
}

/* Hero block image visibility */
.ex1-hero__art {
  display: block;
  margin-top: 1.5rem;
}

.ex1-hero__art img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Front hero: left text, right art */
.ex1-heroWrap {
  padding-block: clamp(2rem, 5vw, 4rem);
}

.ex1-heroHead {
  max-width: 62rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.ex1-heroHead .ex1-title {
  margin: 0 0 0.75rem;
}

.ex1-heroHead .ex1-subtitle {
  margin: 0;
}

.ex1-heroInner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 3.5rem);
}

.ex1-heroText {
  flex: 1 1 52%;
  min-width: 0;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  background: #5e7cff;
  color: #ffffff;
  padding: 14px 26px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(94, 124, 255, 0.45);
}

.btn-primary:hover {
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 14px 26px;
  border-radius: 14px;
  text-decoration: none;
}

.btn-tertiary {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 14px 10px;
}

.ex1-heroArt {
  flex: 1 1 48%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.ex1-heroArt img,
.ex1-heroArt svg,
.ex1-heroArt picture {
  max-width: min(520px, 100%);
  height: auto;
  display: block;
}

/* Feature grid below hero */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  max-width: 1100px;
  margin: 100px auto;
  padding: 0 40px;
}

.feature-card {
  padding: 28px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
}

.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}

.feature-card h3 {
  margin-bottom: 12px;
  font-size: 20px;
}

.feature-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

@media (max-width: 900px) {
  .ex1-heroInner {
    flex-direction: column;
    align-items: flex-start;
  }

  .ex1-heroArt {
    width: 100%;
    justify-content: center;
  }
}

/* Hero block image visibility */
.ex1-hero__art {
  display: block;
  margin-top: 1.5rem;
}

.ex1-hero__art img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Moon icon color */
.site-branding__inner .linear-book-toggle .icon-moon {
  color: #f2c94c;
  fill: currentColor;
  stroke: currentColor;
}

.site-branding__inner .linear-book-toggle .icon-sun,
.site-branding__inner .linear-book-toggle .icon-moon {
  margin: 0 0.15rem;
}

/* Light mode: show only sun */
.site-branding__inner .linear-book-toggle .icon-sun {
  display: inline-flex !important;
}

.site-branding__inner .linear-book-toggle .icon-moon {
  display: none !important;
}

/* Dark mode: show only moon */
html.dark-mode .site-branding__inner .linear-book-toggle .icon-sun {
  display: none !important;
}

html.dark-mode .site-branding__inner .linear-book-toggle .icon-moon {
  display: inline-flex !important;
}

/* Global safety net */

/* Never allow fixed widths on mobile */
@media (max-width: 768px) {
  .region-content,
  .book-content {
    width: 100%;
    max-width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
  }
}

/* MathJax overflow handling */
.book-content mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: block;
}

/* Keep MathJax inline in header/branding */
.site-header mjx-container,
.site-branding mjx-container,
.site-logo-math mjx-container {
  display: inline-block !important;
  overflow: visible !important;
  max-width: none !important;
}

/* === FORCE MathJax logo size === */
.ex1-branding__math mjx-container {
  font-size: clamp(56px, 8vw, 120px) !important;
  line-height: 1 !important;
  margin: 0 !important;
}

/* SVG-specific scaling (extra safety) */
.ex1-branding__math mjx-container svg {
  height: auto !important;
  width: auto !important;
}

/* ===== Dark mode toggle: ICON ONLY ===== */
.ex1-dark-toggle {
  all: unset;
  cursor: pointer;
  font-size: 34px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 12px;
}

.ex1-dark-toggle::before,
.ex1-dark-toggle::after {
  content: none !important;
}

.ex1-dark-toggle:hover {
  transform: scale(1.12);
}

html.dark-mode .ex1-dark-toggle {
  filter: brightness(1.1);
}

.block-search-wide__controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* Remove underline + inline artifacts from logo link */
.ex1-branding__logoLink {
  text-decoration: none !important;
  border-bottom: none !important;
}

/* Prevent MathJax baseline underline space */
.ex1-branding__math {
  text-decoration: none !important;
}

/* Safety: kill any inherited decoration */
.ex1-branding__math *,
.ex1-branding__math mjx-container {
  text-decoration: none !important;
}

/* Code blocks */
pre,
code {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre;
}

/* Inline code break if needed */
code {
  word-break: break-word;
}

/* Icons + logo + slider spacing */
@media (max-width: 768px) {
  header .header-inner {
    gap: 0.5rem;
  }
}

/* Images never exceed screen width */
img,
svg {
  max-width: 100%;
  height: auto;
}

/* Restore content container padding for proper left margin (e.g., Home) */
.layout-container,
.container,
.main-content__container,
.region-content,
.node__content,
.page-title,
.breadcrumb {
  max-width: var(--max-width, 84rem);
  margin-inline: auto;
  padding-inline: var(--container-padding, 1.5rem);
  box-sizing: border-box;
}

/* Hero buttons: enforce styling on front page */
.ex1-home .hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.ex1-home .hero-buttons .btn-primary {
  background: #5e7cff;
  color: #ffffff;
  padding: 14px 26px;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(94, 124, 255, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ex1-home .hero-buttons .btn-primary:hover {
  transform: translateY(-2px);
}

.ex1-home .hero-buttons .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #ffffff;
  padding: 14px 26px;
  border-radius: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ex1-home .hero-buttons .btn-tertiary {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  padding: 14px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

