/* Shoulder - Core Styles
   Shared base styles used across ALL pages
   ========================================================================== */

/* ==========================================================================
   CSS Variables, Reset, Body
   ========================================================================== */

:root {
  --bg: #0b0f19;
  --text: #e6e9f2;
  --muted: #a9b1c7;
  --muted2: #7e879f;
  --border: rgba(255,255,255,0.10);
  --border2: rgba(255,255,255,0.08);
  --good: #39d98a;
  --warn: #f7c948;
  --bad: #ff6b6b;
  --info: #64b5ff;
  --elevated: #ff6b6b;
  --moderate: #f7c948;
  --low: #64b5ff;
  --radius: 16px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  max-width: 100vw;
  overflow-x: clip;
  overflow-wrap: break-word;
  word-break: break-word;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 20% -10%, rgba(124,92,252,0.07), transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(255,107,107,0.04), transparent 50%);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.hidden { display: none; }

/* ==========================================================================
   Page Wrapper & Container
   ========================================================================== */

.page-wrapper {
  width: 100%;
  overflow-x: clip;
}

/* ==========================================================================
   Sitewide Beta Strip
   ========================================================================== */

.beta-strip {
  width: 100%;
  background: linear-gradient(90deg, rgba(57, 217, 138, 0.10), rgba(100, 181, 255, 0.06));
  border-bottom: 1px solid rgba(57, 217, 138, 0.20);
  font-size: 13px;
}

.beta-strip-inner {
  max-width: 1560px;
  margin: 0 auto;
  padding: 8px 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.beta-strip-pill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(57, 217, 138, 0.15);
  border: 1px solid rgba(57, 217, 138, 0.35);
  color: var(--good);
  flex-shrink: 0;
}

.beta-strip-text {
  color: var(--text);
  flex: 1;
  min-width: 200px;
}

.beta-strip-cta {
  color: var(--good);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.beta-strip-cta:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .beta-strip-inner {
    padding: 8px 14px;
    font-size: 12px;
  }
}

.container {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 10px;
}

@media (min-width: 480px) {
  .container { padding: 16px; }
}

@media (min-width: 768px) {
  .container { padding: 22px; }
}

@media (min-width: 1280px) {
  .container { padding: 22px 36px; }
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 0 12px;
  flex-wrap: wrap;
  row-gap: 10px;
}

.site-header.landing {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0;
}

.brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex: 0 0 auto;
}

.brand.centered {
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: url('/images/icon-192.png') center/cover no-repeat;
  flex-shrink: 0;
  margin-top: 2px;
}

.logo.large {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.titleblock .brand-title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.2px;
}

.titleblock p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 90ch;
}

/* Hamburger toggle — hidden on desktop */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
}

.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Animate to X when open */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.topactions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

/* Header inline search — compact pill on the right that expands horizontally on focus. */
.header-search {
  position: relative;
  flex: 0 0 240px;
  min-width: 0;
  margin: 0 0 0 auto;
  align-self: center;
  transition: flex-basis 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.header-search:focus-within,
.header-search:has(.header-search-input:not(:placeholder-shown)) {
  flex-basis: 460px;
}

.header-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 5px 5px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.14);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.45s ease;
}

.header-search:hover .header-search-box {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
}

.header-search:focus-within .header-search-box {
  background: rgba(11, 18, 36, 0.65);
  border-color: rgba(100, 181, 255, 0.45);
  box-shadow: 0 0 0 4px rgba(100, 181, 255, 0.08), 0 12px 26px rgba(0, 0, 0, 0.30);
}

.header-search-icon {
  flex-shrink: 0;
  color: var(--muted);
  opacity: 0.75;
  transition: color 0.4s ease, opacity 0.4s ease;
}

.header-search:focus-within .header-search-icon {
  color: #6cb1ff;
  opacity: 1;
}

.header-search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
  padding: 6px 0;
  text-overflow: ellipsis;
}

.header-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
  transition: opacity 0.4s ease;
}

.header-search:focus-within .header-search-input::placeholder {
  opacity: 0.55;
}

.header-search-submit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(100, 181, 255, 0.28), rgba(57, 217, 138, 0.18));
  border: 1px solid rgba(100, 181, 255, 0.30);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateX(6px);
  transition: max-width 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              padding 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.35s ease 0.1s,
              transform 0.45s ease;
}

.header-search:focus-within .header-search-submit,
.header-search:has(.header-search-input:not(:placeholder-shown)) .header-search-submit {
  max-width: 140px;
  padding: 6px 12px;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.header-search-submit:hover {
  background: linear-gradient(135deg, rgba(100, 181, 255, 0.40), rgba(57, 217, 138, 0.24));
}

.header-search-hint {
  position: absolute;
  top: calc(100% + 6px);
  left: 12px;
  right: 12px;
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.45s ease 0.05s, transform 0.45s ease 0.05s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 5;
}

.header-search:focus-within .header-search-hint {
  opacity: 0.85;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .site-header {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 8px;
  }
  .titleblock p { display: none; }
  .logo { width: 32px; height: 32px; border-radius: 10px; }
  .titleblock .brand-title { font-size: 14px; white-space: nowrap; }

  .brand {
    flex: 1 1 auto;
    order: 1;
  }

  .mobile-menu-toggle {
    display: flex;
    margin-left: auto;
    order: 2;
  }

  /* Mobile: search becomes a full-width second row. */
  .header-search {
    flex: 0 0 100%;
    order: 3;
    margin: 0;
  }

  .header-search:focus-within,
  .header-search:has(.header-search-input:not(:placeholder-shown)) {
    flex-basis: 100%;
  }

  /* Keep the hint absolutely positioned on mobile too so the header
     never grows in height when the search is focused. */
  .header-search-hint {
    white-space: normal;
  }

  .topactions {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    gap: 4px;
    padding-top: 12px;
    order: 4;
  }

  .topactions.open {
    display: flex;
  }

  .topactions .btn {
    width: 100%;
    justify-content: center;
    font-size: 14px;
    padding: 12px;
  }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  box-shadow: 0 10px 22px rgba(0,0,0,0.16);
  transition: background 0.15s;
}

.btn:hover {
  background: rgba(255,255,255,0.085);
}

.btn.primary {
  background: linear-gradient(135deg, rgba(100,181,255,0.22), rgba(57,217,138,0.14));
  border: 1px solid rgba(100,181,255,0.25);
}

.btn.btn-download {
  background: linear-gradient(135deg, rgba(57,217,138,0.18), rgba(57,217,138,0.08));
  border: 1px solid rgba(57,217,138,0.30);
  color: #6ee7a8;
  font-weight: 600;
}

.btn.btn-download:hover {
  background: linear-gradient(135deg, rgba(57,217,138,0.28), rgba(57,217,138,0.14));
}

.btn.secondary {
  background: rgba(255,255,255,0.04);
}

.btn.large {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-block;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,0.04);
  white-space: nowrap;
}

.badge.bad { color: #ffc2c2; border-color: rgba(255,107,107,0.3); background: rgba(255,107,107,0.1); }
.badge.critical { color: #fff; border-color: rgba(220,38,38,0.6); background: rgba(220,38,38,0.45); font-weight: 700; }
.badge.warn { color: #ffe08a; border-color: rgba(247,201,72,0.3); background: rgba(247,201,72,0.1); }
.badge.good { color: #aef5d2; border-color: rgba(57,217,138,0.3); background: rgba(57,217,138,0.1); }
.badge.info { color: #a6d4ff; border-color: rgba(100,181,255,0.3); background: rgba(100,181,255,0.1); }

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(15,22,41,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 16px 30px rgba(0,0,0,0.40);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.toast.show { opacity: 1; }

/* ==========================================================================
   Error Page
   ========================================================================== */

.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-page h1 {
  font-size: 72px;
  margin: 0 0 16px;
  color: var(--muted2);
}

.error-page h2 {
  font-size: 24px;
  margin: 0 0 12px;
}

.error-page p {
  color: var(--muted);
  margin: 0 0 24px;
}

body:has(.error-page--fun) {
  background: #49307A;
  color: #fff;
}

body:has(.error-page--fun) .site-header,
body:has(.error-page--fun) .site-footer {
  background: transparent;
}

.error-page--fun {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  text-align: center;
}

.error-page--fun .error-dragon {
  display: block;
  max-width: 100%;
  width: 560px;
  height: auto;
  margin: 0 auto 16px;
}

@media (max-width: 540px) {
  .error-page--fun .error-dragon {
    width: 360px;
  }
}

.error-page--fun .error-status {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.55);
  font-family: var(--mono);
}

.error-page--fun .error-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
  color: #fff;
}

.error-page--fun .error-message {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.75);
}

.error-page--fun .error-detail {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin: 4px 0 0;
}

.error-page--fun .error-stack-trace {
  text-align: left;
  max-width: 700px;
  margin: 16px auto 24px;
  padding: 16px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
  font-size: 11px;
  color: var(--muted);
}

.error-page--fun .error-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}


/* ==========================================================================
   Section Headers
   ========================================================================== */

section h3 {
  font-size: 18px;
  margin: 24px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border2);
}

section:first-child h3 {
  margin-top: 0;
}

/* ==========================================================================
   Text Utilities
   ========================================================================== */

.text-muted { color: var(--muted); font-size: 13px; }

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
  .stack-selector {
    border: 2px solid #ffffff;
    background: #000000;
  }

  .selector-tab {
    border: 2px solid #ffffff;
    color: #ffffff;
  }

  .selector-tab.active {
    background: #ffffff;
    color: #000000;
    border-color: #ffffff;
  }

  .context-bar {
    border: 2px solid #ffffff;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .selector-tab {
    transition: none;
    transform: none !important;
  }

  .selector-tab:hover {
    transform: none;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .stack-selector {
    background: none;
    border: 1px solid #ccc;
    box-shadow: none;
  }

  .selector-tab.active {
    background: #eee;
    color: #000;
    box-shadow: none;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 64px;
  padding: 48px 0 32px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: 48px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: url('/images/icon-192.png') center/cover no-repeat;
}

.footer-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.footer-tagline {
  font-size: 13px;
  color: var(--muted);
}

.footer-nav {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}

.footer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-section .footer-section-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.footer-section a {
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-section a:hover {
  color: var(--info);
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border2);
}

.copyright {
  font-size: 13px;
  color: var(--muted2);
}

@media (max-width: 768px) {
  .footer-content {
    flex-direction: column;
    gap: 32px;
  }

  .footer-nav {
    gap: 32px;
  }
}

/* ==========================================================================
   Skip Link (Accessibility)
   ========================================================================== */

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px 16px;
  background: var(--info);
  color: var(--bg);
  font-weight: 600;
  z-index: 1000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ==========================================================================
   Language Switcher
   ========================================================================== */

.lang-switcher {
  position: relative;
}

.lang-current {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.lang-current:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.lang-flag {
  font-size: 16px;
}

.lang-code {
  text-transform: uppercase;
  font-weight: 600;
  font-size: 12px;
}

.lang-chevron {
  transition: transform 0.15s;
}

.lang-current[aria-expanded="true"] .lang-chevron {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  min-width: 160px;
  padding: 8px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.15s;
  z-index: 200;
}

.lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s;
}

.lang-option:hover {
  background: rgba(255,255,255,0.06);
}

.lang-option.active {
  background: rgba(100,181,255,0.1);
}

.lang-name {
  flex: 1;
  font-size: 13px;
}

.lang-check {
  color: var(--good);
  font-size: 12px;
}

/* Footer language section */
.footer-languages {
  min-width: 120px;
}

.footer-languages .lang-dropdown {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 8px;
}

/* Header language switcher (compact) */
.header-lang-switcher {
  margin-left: auto;
}

.header-lang-switcher .lang-current {
  padding: 6px 10px;
}

.header-lang-switcher .lang-dropdown {
  right: 0;
  left: auto;
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 8px;
}

/* Fallback for legacy inline command hints that still render on some routes. */
.install-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.install-hint code {
  max-width: 100%;
}

@media (max-width: 640px) {
  .install-hint {
    align-items: stretch;
  }

  .install-hint code {
    flex: 1 1 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .install-hint .copy-btn {
    margin-left: auto;
  }
}
