/* SoftWay site shell v5 — mobile-first header, project hub and in-page navigation.
   Loaded after style.css; style.css still provides cards, showcase and footer styles. */

:root { --header-h: 60px; --radius: 16px; }
body { --accent: var(--accent-cyan); }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 52px); }
body { -webkit-text-size-adjust: 100%; }
img { max-width: 100%; height: auto; }
.container { padding: 0 1rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

.skip-link { position: absolute; left: -999px; top: 0; z-index: 200; background: var(--accent-cyan); color: #000; padding: .5rem 1rem; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }

/* ---------- Header: logo · projects menu · theme ---------- */
.sw-header {
  position: sticky; top: 0; z-index: 100; height: var(--header-h);
  background: rgba(10, 14, 23, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
}
body.light-theme .sw-header { background: rgba(248, 250, 252, 0.9); }
.sw-header .container { height: 100%; display: flex; align-items: center; gap: .5rem; }
.sw-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--text-main); margin-right: auto; min-width: 0; }
.sw-brand img { height: 32px; width: 32px; flex: none; }
.sw-brand strong { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.sw-brand strong span { color: var(--accent-cyan); }
/* Project links — one per project, right side of the header */
.sw-nav { display: flex; align-items: center; gap: .7rem; margin: 0 .25rem 0 .75rem; }
.sw-nav a {
  position: relative; display: flex; align-items: center; height: var(--header-h);
  font-size: .84rem; font-weight: 600; color: var(--text-muted); text-decoration: none; white-space: nowrap; transition: color .2s;
}
.sw-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform .25s ease;
}
.sw-nav a:hover, .sw-nav a[aria-current="page"] { color: var(--text-main); }
.sw-nav a[aria-current="page"]::after { transform: scaleX(1); }
.sw-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (min-width: 360px) {
  .sw-brand strong { font-size: 1.3rem; }
  .sw-nav { gap: .9rem; margin-right: .35rem; }
  .sw-nav a { font-size: .9rem; }
  .sw-header .sw-icon-btn { width: 40px; height: 40px; }
}
@media (min-width: 640px) { .sw-nav { gap: 1.75rem; margin-right: 1rem; } .sw-nav a { font-size: .95rem; } }
.sw-icon-btn {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border-color); background: var(--bg-glass); color: var(--text-main); font-size: 1.05rem;
}

/* ---------- In-page section chips (project pages) ---------- */
.sw-subnav {
  position: sticky; top: var(--header-h); z-index: 90;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
}
.sw-subnav ul {
  position: relative; list-style: none; display: flex; gap: 1.25rem; overflow-x: auto;
  padding: 0 1rem; max-width: 1280px; margin: 0 auto; scrollbar-width: none;
}
.sw-subnav ul::-webkit-scrollbar { display: none; }
.sw-subnav a {
  position: relative; display: block; white-space: nowrap; padding: .7rem 0;
  font-size: .875rem; font-weight: 500; letter-spacing: .01em;
  color: var(--text-muted); text-decoration: none; transition: color .2s;
}
.sw-subnav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transition: transform .25s ease;
}
.sw-subnav a:hover { color: var(--text-main); }
.sw-subnav a.active { color: var(--text-main); }
.sw-subnav a.active::after { transform: scaleX(1); }
.sw-subnav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Narrow screens: fade the right edge to hint that the tabs scroll; removed once they fit */
.sw-subnav ul { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 2rem; }
@media (min-width: 561px) { .sw-subnav ul { -webkit-mask-image: none; mask-image: none; padding-right: 1rem; } }
@media (min-width: 640px) { .sw-subnav ul { gap: 2rem; padding: 0 1.5rem; } }

/* ---------- Hero ---------- */
.sw-hero { padding: 1.75rem 0 1.25rem; text-align: center; }
.sw-hero .hero-title { font-size: clamp(1.9rem, 7vw, 3.6rem); margin: .6rem 0 .8rem; }
.sw-hero .hero-subtitle { font-size: clamp(1rem, 3.6vw, 1.2rem); margin: 0 auto 1.4rem; max-width: 720px; }
.sw-hero .hero-subtitle:last-child { margin-bottom: 0; }
.sw-hero-logo { width: clamp(96px, 26vw, 150px); margin: 0 auto .5rem; filter: drop-shadow(0 10px 30px rgba(0,0,0,.35)); }
.sw-actions { display: flex; flex-direction: column; gap: .7rem; align-items: stretch; max-width: 360px; margin: 0 auto; }
.sw-actions .btn, .sw-actions .btn-github { justify-content: center; padding: .85rem 1.4rem; }
@media (min-width: 640px) {
  .sw-hero { padding: 3rem 0 1.5rem; }
  .sw-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; max-width: none; }
}
.badge-pill { max-width: 100%; white-space: normal; }

/* ---------- Project hub cards (landing) ---------- */
.sw-projects { display: grid; gap: 1rem; }
@media (min-width: 720px) { .sw-projects { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; } }
@media (min-width: 1100px) { .sw-projects.has-3 { grid-template-columns: repeat(3, 1fr); } }
.sw-project {
  --accent: var(--accent-cyan);
  position: relative; display: flex; flex-direction: column; gap: .9rem; padding: 1.4rem;
  border-radius: var(--radius); border: 1px solid var(--border-color); background: var(--bg-card);
  text-decoration: none; color: var(--text-main); transition: transform .2s, border-color .2s, box-shadow .2s;
}
.sw-project:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 16px 40px color-mix(in srgb, var(--accent) 18%, transparent); }
.sw-project-head { display: flex; align-items: center; gap: 1rem; }
.sw-project-head img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.sw-project h3 { font-family: var(--font-heading); font-size: 1.5rem; line-height: 1.1; }
.sw-project .sw-kicker { color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sw-project p { color: var(--text-muted); font-size: .97rem; }
.sw-project ul { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; }
.sw-project li { font-size: .78rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--border-color); color: var(--text-muted); }
.sw-project .sw-go { margin-top: auto; font-weight: 700; color: var(--accent); }
.sw-project.soon { border-style: dashed; justify-content: center; align-items: center; text-align: center; min-height: 160px; color: var(--text-muted); }
.sw-project.soon:hover { transform: none; box-shadow: none; }

.theme-foxy { --accent: var(--accent-cyan); }
.theme-samurai { --accent: var(--accent-amber); }

/* ---------- Compact lists ---------- */
.sw-list { display: grid; gap: .8rem; }
@media (min-width: 640px) { .sw-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .sw-list { grid-template-columns: repeat(3, 1fr); } }
.sw-item { display: flex; gap: .9rem; padding: 1rem; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border-color); }
.sw-item .ic { font-size: 1.4rem; line-height: 1; flex: none; }
.sw-item h3 { font-size: 1rem; margin-bottom: .2rem; font-family: var(--font-heading); }
.sw-item p { font-size: .9rem; color: var(--text-muted); }

.sw-steps { counter-reset: s; display: grid; grid-template-columns: minmax(0, 1fr); gap: .8rem; list-style: none; }
.sw-steps li { min-width: 0; counter-increment: s; position: relative; padding: 1rem 1rem 1rem 3.4rem; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border-color); }
.sw-steps li::before { content: counter(s); position: absolute; left: 1rem; top: 1rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--accent); color: #0A0E17; }
.sw-steps h3 { font-size: 1rem; margin-bottom: .25rem; }
.sw-steps p { font-size: .9rem; color: var(--text-muted); }
.sw-steps pre, .sw-code { margin-top: .6rem; padding: .7rem .9rem; border-radius: 8px; background: #050810; color: #E2E8F0; font: .8rem/1.5 var(--font-mono); overflow-x: auto; }

/* "More technical details" link to the project's GitHub repository */
.sw-repo {
  display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; padding: 1rem 1.1rem;
  border: 1px solid var(--border-color); border-radius: 14px; background: var(--bg-card);
  color: var(--text-main); text-decoration: none; transition: border-color .2s, transform .2s;
}
.sw-repo:hover { border-color: var(--accent); transform: translateY(-2px); }
.sw-repo svg { flex: none; width: 32px; height: 32px; }
.sw-repo strong { display: block; font-family: var(--font-heading); font-size: 1.05rem; }
.sw-repo small { display: block; color: var(--text-muted); font-size: .88rem; line-height: 1.4; }
.sw-repo .sw-repo-url { color: var(--accent); font-size: .85rem; font-weight: 600; }
.sw-repo .sw-repo-arrow { margin-left: auto; color: var(--accent); font-size: 1.2rem; }

/* FAQ — visible Q&A that mirrors FAQPage JSON-LD */
.sw-faq { display: grid; gap: .6rem; max-width: 860px; margin: 0 auto; }
.sw-faq details { border: 1px solid var(--border-color); border-radius: 12px; background: var(--bg-card); padding: .2rem 1rem; }
.sw-faq summary { cursor: pointer; font-weight: 600; padding: .8rem 0; }
.sw-faq p { color: var(--text-muted); padding-bottom: .9rem; font-size: .95rem; }

/* Mobile tweaks for legacy components */
.section { padding: 3rem 0; }
@media (min-width: 768px) { .section { padding: 4rem 0; } }
.section-header { margin-bottom: 2rem; }
.section-title { font-size: clamp(1.5rem, 5.5vw, 2.5rem); }
.showcase-tabs-nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.showcase-tab-btn { white-space: nowrap; flex: none; }
.code-editor-content { max-height: 70vh; }
.comparison-table-wrapper { -webkit-overflow-scrolling: touch; }
.cross-promo-card h3 { color: var(--text-main) !important; }
body.light-theme .cross-promo-card { background: var(--bg-card); box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
/* Demo + code grid: tracks may shrink below their content's min width, so nothing is clipped on phones */
.side-by-side-wrapper { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .side-by-side-wrapper { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.live-app-pane, .java-code-pane { min-width: 0; }
.live-app-pane { padding: 1rem .75rem; }
.live-app-pane > * { max-width: 100%; }
.samurai-sim-card { padding: 1rem; }
.triage-stats { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 480px) { .triage-stats { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .live-app-pane { padding: 1.5rem 1rem; } .samurai-sim-card { padding: 1.5rem; } }
.copy-code-btn { min-height: 36px; padding: .4rem .9rem; }
.live-app-pane .btn, .live-app-pane button { min-height: 40px; min-width: 40px; }
.step-type-pill { font-size: .75rem; }
.chart-bar-val, .chart-bar-lbl { font-size: .75rem; }
.live-app-pane input[type="checkbox"] { width: 24px; height: 24px; flex: none; }

.sw-contact { text-align: center; max-width: 720px; }

/* ---------- Footer ---------- */
.sw-footer { border-top: 1px solid var(--border-color); padding: 2rem 0 1.5rem; font-size: .9rem; color: var(--text-muted); }
.sw-footer .grid { display: grid; gap: 1.5rem; }
@media (min-width: 720px) { .sw-footer .grid { grid-template-columns: 2fr 1fr 1fr; } }
.sw-footer h2 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-main); margin-bottom: .6rem; }
.sw-footer ul { list-style: none; display: grid; gap: 0; }
.sw-footer a { display: inline-block; padding: .4rem 0; color: var(--text-muted); text-decoration: none; }
.sw-footer a:hover { color: var(--accent-cyan); }
.sw-footer .bottom { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-color); font-size: .8rem; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
