:root {
  --bg: #0d1117;
  --bg-alt: #10161f;
  --surface: #161d28;
  --border: #232c3a;
  --text: #e6edf3;
  --muted: #94a3b8;
  --accent: #f0b429;
  --accent-soft: rgba(240, 180, 41, 0.12);
  --green: #2ea886;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 14px;
  /* Potato FAB — brand colors on the dark theme */
  --fab-bg: #fef3c7;
  --fab-border: #b45309;
  --fab-text: #d97706;
}

/* Light theme — activated by <html data-theme="light"> (set by js/main.js,
   persisted in localStorage, falls back to system preference). */
html[data-theme="light"] {
  --bg: #faf7f0;
  --bg-alt: #f1ede3;
  --surface: #ffffff;
  --border: #e0dacb;
  --text: #22201a;
  --muted: #6b6455;
  --accent: #b45309;
  --accent-soft: rgba(180, 83, 9, 0.1);
  --green: #1f7a5f;
  --nav-bg: rgba(250, 247, 240, 0.86);
  /* Potato FAB adapts to light mode */
  --fab-bg: #fef3c7;
  --fab-border: #b45309;
  --fab-text: #d97706;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Kill the UA's square tap-flash everywhere (Android/iOS/Chrome paint it
     on touched children too, so it must be universal, not per-element). */
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  /* The barrel's 3D fan must never widen the page — a scrollbar appearing
     and vanishing is what made the layout below the carousel twitch. */
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--mono);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  font-size: 0.85em;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--nav-bg, rgba(13, 17, 23, 0.82));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.92rem;
  font-family: var(--mono);
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-cta {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 6px 16px;
  color: var(--accent) !important;
  transition: background 0.2s ease, transform 0.2s ease;
}

.nav-cta:hover {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.1rem;
  padding: 4px 10px;
  cursor: pointer;
}

.hero-kicker {
  font-family: var(--mono);
  color: var(--green);
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.accent {
  color: var(--accent);
}

.tagline {
  max-width: 720px;
  font-size: 1.08rem;
  color: var(--text);
  margin-bottom: 8px;
}

.hero-sub {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 26px;
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--mono);
  font-size: 0.95rem;
  border-radius: 10px;
  padding: 12px 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  color: #14100a;
  font-weight: 700;
  box-shadow: 0 6px 24px rgba(240, 180, 41, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 10px 30px rgba(240, 180, 41, 0.35);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

.hash {
  color: var(--green);
}

.section-lead {
  color: var(--muted);
  max-width: 640px;
  margin: -10px 0 32px;
}

.grid {
  display: grid;
  gap: 22px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(240, 180, 41, 0.45);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.card-body {
  padding: 26px;
}

.card h3 {
  font-size: 1.12rem;
  margin-bottom: 10px;
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.card-featured {
  border-color: rgba(240, 180, 41, 0.45);
  background:
    linear-gradient(160deg, rgba(240, 180, 41, 0.07), transparent 55%),
    var(--surface);
}

.card-pending {
  position: relative;
}

.feature-list {
  list-style: none;
  display: grid;
  gap: 8px;
}

.feature-list li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
  font-size: 0.92rem;
}

.feature-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.skill {
  text-align: left;
  padding: 24px;
}

.skill-icon {
  font-size: 1.6rem;
  display: inline-block;
  margin-bottom: 12px;
}

/* Real tool logos on the skill cards (Simple Icons glyphs, amber-tinted) */
.skill-icon-img {
  display: inline-block;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  filter: invert(61%) sepia(72%) saturate(530%) hue-rotate(352deg) brightness(96%) contrast(92%);
}

.skill h3 {
  font-family: var(--mono);
  font-size: 1rem;
}

.timeline {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 42px;
}

.timeline-item + .timeline-item {
  margin-top: 26px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 3px solid var(--accent);
}

.timeline-date {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 12px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-top: 8px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  /* No UA square tap-flash over the rounded corners (Android/iOS/Chrome) */
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .contact-card:hover {
    text-decoration: none;
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  }

  /* Press must keep the -4px lift. A bare `scale()` here has the same
     specificity as `:hover` and comes later, so it would win and the
     card would sink + shrink under the cursor on every click. */
  .contact-card:active {
    transform: translateY(-4px) scale(0.98);
  }
}

/* Touch has no hover lift, so the press is the only feedback it gets. */
@media (hover: none) {
  .contact-card:active {
    transform: scale(0.98);
  }
}

.telegram:hover,
.telegram:focus-visible {
  border-color: #26a69a;
}

.whatsapp:hover,
.whatsapp:focus-visible {
  border-color: #25d366;
}

.facebook:hover,
.facebook:focus-visible {
  border-color: #1877f2;
}

.email:hover,
.email:focus-visible {
  border-color: #ea4335;
}

.contact-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.contact-name {
  font-family: var(--mono);
  font-weight: 700;
}

.contact-handle {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  word-break: break-all;
}

.contact-note {
  font-size: 0.78rem;
  color: var(--muted);
}

.contact-outro {
  margin-top: 34px;
  color: var(--muted);
}

.footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
  background: var(--bg-alt);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .nav-toggle {
    display: block;
    order: 3;
    margin-left: 12px;
  }

  /* Keep the theme toggle beside the hamburger (nav-links is a dropdown here) */
  .theme-toggle {
    order: 2;
    margin-left: 0;
    width: 34px;
    height: 34px;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px 16px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links li {
    padding: 10px 0;
  }

  .nav-cta {
    display: inline-block;
    text-align: center;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 72px 0 64px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

.post {
  max-width: 760px;
  margin: 0 auto;
}

.back-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 28px;
}

.back-link:hover,
.post-nav a:hover {
  text-decoration: underline;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.reading-time {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.post-title {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.2;
  margin: 0;
}

.post-body {
  margin-top: 34px;
}

.post-body p {
  line-height: 1.75;
  font-size: 1.02rem;
  margin-bottom: 18px;
}

.post-body h2 {
  font-size: 1.45rem;
  margin: 38px 0 14px;
}

.post-body ul,
.post-body ol {
  display: grid;
  gap: 8px;
  padding-left: 22px;
  margin: 0 0 18px;
}

.post-body li::marker {
  color: var(--accent);
}

.post-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 18px;
}

.post-body pre code {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.post-nav a {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
}

.card .post-meta {
  margin-bottom: 10px;
}

/* ---- Blog slideshow ---- */
.slideshow {
  position: relative;
  margin-top: 8px;
}

.slideshow-track {
  position: relative;
}

.slideshow-track .slide {
  display: none;
}

.slideshow-track .slide.active {
  display: block;
  animation: ss-fade 0.45s ease;
}

@keyframes ss-fade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slideshow .ss-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 5;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.slideshow .ss-arrow:hover,
.slideshow .ss-arrow:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.slideshow .ss-prev { left: -16px; }
.slideshow .ss-next { right: -16px; }

.ss-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.ss-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--border);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.ss-dots button.active {
  background: var(--accent);
  transform: scale(1.3);
}

.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #14100a;
  padding: 8px 16px;
  z-index: 1000;
  border-radius: 0 0 var(--radius) var(--radius);
  font-family: var(--mono);
  font-size: 0.9rem;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.skip-to-content:focus {
  top: 0;
  transform: translateX(0);
}

@media (max-width: 720px) {
  .slideshow .ss-arrow { display: none; }
}

/* Prefers-reduced-motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Focus styles for accessibility */
button {
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input,
select,
textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  font-family: var(--sans);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Potato FAB Styles */
.potato-fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Rotating Ring */
.circular-text {
  position: absolute;
  width: 100%;
  height: 100%;
  animation: rotateText 12s linear infinite;
}

@keyframes rotateText {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Irregular Organic Potato Shape */
.potato-body {
  width: 52px;
  height: 52px;
  background: var(--fab-bg, #fef3c7);
  border: 2px solid var(--fab-border, #b45309);
  /* Asymmetric border-radius to mimic a potato blob */
  border-radius: 60% 40% 70% 30% / 40% 60% 30% 70%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.25);
  transition: all 0.3s ease;
}

/* Hover Effects */
.potato-fab:hover {
  transform: scale(1.12);
}

.potato-fab:hover .potato-body {
  background: #fde68a;
  box-shadow: 0 12px 28px rgba(180, 83, 9, 0.4);
  /* Slight morph on hover */
  border-radius: 40% 60% 30% 70% / 60% 30% 70% 40%;
}

.potato-fab:hover .circular-text {
  animation-duration: 6s; /* Spins faster on hover */
}

/* Ring text follows the theme (SVG fill overridden by CSS) */
.circular-text text {
  fill: var(--fab-text, #d97706);
}

/* Easter egg: potato spin when double-tapped to flip the theme */
.potato-fab.fab-spin {
  animation: fabSpin 0.65s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes fabSpin {
  from { transform: rotate(0deg) scale(1); }
  60%  { transform: rotate(300deg) scale(1.22); }
  to   { transform: rotate(360deg) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .circular-text { animation: none; }
  .potato-fab.fab-spin { animation: none; }
}

/* The tab bar is centred at the viewport bottom; the FAB is fixed to the
   bottom-right. They share the same band and collide around 481-700px, so
   lift the FAB above the bar for every width where the bar is visible. */
@media (max-width: 1099px) {
  .potato-fab {
    bottom: 92px;
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .potato-fab {
    right: 16px;
    width: 70px;
    height: 70px;
  }
  
  .potato-body {
    width: 40px;
    height: 40px;
  }
  
  .circular-text svg {
    width: 80px;
    height: 80px;
  }
}

/* --- Setup / install command section --- */
.setup-lead {
  text-align: center;
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.terminal {
  max-width: 720px;
  margin: 0 auto 14px;
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  text-align: left;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.terminal-dot.red    { background: #ff5f57; }
.terminal-dot.yellow { background: #febc2e; }
.terminal-dot.green  { background: #28c840; }

.terminal-title {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.terminal-potato {
  font-size: 0.95rem;
  animation: potato-bob 2.6s ease-in-out infinite;
  transform-origin: 50% 60%;
}

@keyframes potato-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(-8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-potato { animation: none; }
  .cursor { animation: none; }
}

.terminal-body {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  font-family: var(--mono);
}

.terminal-body .prompt {
  color: var(--green);
  font-weight: 700;
  user-select: none;
}

#install-cmd {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.92rem;
  color: var(--accent);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}

.cursor {
  display: inline-block;
  width: 9px;
  height: 1.15em;
  margin-left: 2px;
  background: var(--accent);
  animation: cursor-blink 1s step-end infinite;
  flex-shrink: 0;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease;
}

.copy-btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.copy-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.copy-btn.copied {
  background: var(--green);
  color: #ffffff;
}

.setup-note {
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .terminal-body {
    flex-wrap: wrap;
  }

  #install-cmd {
    white-space: normal;
    font-size: 0.78rem;
  }

  .copy-btn {
    justify-content: center;
    width: 100%;
  }
}

/* Theme toggle button (nav) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  text-decoration: none;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* FAB: profile photo fills the potato blob */
.potato-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  display: block;
}

/* ============================================================
   Template-inspired additions: shell, rail, bento, marquee,
   barrel carousel, tab bar, intro overlay, a11y menu.
   Theme tokens (colors) are untouched — potato theme stays.
   ============================================================ */
:root {
  /* Motion tokens (from the template's discipline) */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 180ms;
  --dur-med: 320ms;
  /* Accessibility text-size scale (set by the a11y menu) */
  --font-scale: 1;
}

html {
  font-size: calc(16px * var(--font-scale, 1));
}

/* Runtime reduce-motion switch (a11y menu) — mirrors the media query */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* ---------- Shell: rail + scrolling panel (desktop ≥1100px) ---------- */
.shell {
  display: block;
}

.rail {
  display: none;
}

.tabbar {
  display: none;
}

@media (min-width: 1100px) {
  .shell {
    display: flex;
    height: 100vh;
  }

  .rail {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 300px;
    flex-shrink: 0;
    height: 100vh;
    padding: 28px 22px;
    border-right: 1px solid var(--border);
    background: var(--bg-alt);
    overflow-y: auto;
  }

  .panel {
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow-y: auto;
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
  }
}

/* ---------- Rail contents ---------- */
.rail-id {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.rail-id:hover {
  text-decoration: none;
}

.rail-id:hover .rail-name {
  color: var(--accent);
}

.rail-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  padding: 3px;
  overflow: hidden;
  background: var(--accent-soft);
}

.rail-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.rail-name {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  transition: color var(--dur-fast) ease;
}

.rail-handle {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.rail-socials {
  display: flex;
  justify-content: center;
  gap: 10px;
  list-style: none;
}

.rail-socials a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) ease;
}

.rail-socials a:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
}

.rail-nav {
  flex: 1;
}

.rail-nav ul {
  list-style: none;
  display: grid;
  gap: 4px;
}

.rail-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: color var(--dur-fast) ease, background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.rail-nav a svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.rail-nav a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.rail-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(240, 180, 41, 0.35);
}

.rail-foot {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.rail .theme-toggle {
  margin-left: 0;
}

.a11y-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.a11y-trigger:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.a11y-trigger svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Hero + bento ---------- */
.hero-bento {
  position: relative;
  padding: 96px 0 84px;
  overflow: hidden;
  background: var(--bg);
}

.contour {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.6;
  pointer-events: none;
}

.hero-bento .hero-inner {
  position: relative;
  z-index: 1;
}

.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 44px;
}

.bento-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 128px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  grid-column: span 2;
  transition: transform var(--dur-med) var(--ease-out), border-color var(--dur-med) ease, box-shadow var(--dur-med) ease;
}

.bento-tile:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: rgba(240, 180, 41, 0.5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.bento-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.bento-icon {
  font-size: 1rem;
}

.bento-title {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.bento-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.bento-arrow {
  position: absolute;
  top: 14px;
  right: 16px;
  color: var(--muted);
  font-size: 1rem;
  transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}

.bento-tile:hover .bento-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.bento-featured {
  grid-column: span 2;
  grid-row: span 2;
  background:
    linear-gradient(160deg, rgba(240, 180, 41, 0.09), transparent 55%),
    var(--surface);
  border-color: rgba(240, 180, 41, 0.45);
}

.bento-featured .bento-title {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin-top: 4px;
}

.bento-reel-item {
  display: inline-block;
  font-family: var(--mono);
  font-size: 1.05rem;
  color: var(--green);
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.bento-reel-item.swap {
  opacity: 0;
  transform: translateY(6px);
}

.bento-cmd {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bento-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.bento-chips img {
  width: 22px;
  height: 22px;
  filter: invert(61%) sepia(72%) saturate(530%) hue-rotate(352deg) brightness(96%) contrast(92%);
}

.bento-chips i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(240, 180, 41, 0.3);
  border-radius: 999px;
  padding: 3px 10px;
}

@media (max-width: 680px) {
  .hero-bento {
    padding: 64px 0 56px;
  }

  .bento {
    grid-template-columns: 1fr;
  }

  .bento-tile,
  .bento-featured {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

/* ---------- Tools marquee ---------- */
.marquee {
  overflow: hidden;
  padding: 16px 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 36s linear infinite;
}

.marquee-seq {
  display: flex;
  align-items: center;
  gap: 34px;
  padding-right: 34px;
}

.marquee-seq i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Tool logos in the marquee — tinted to the amber accent (black SVG glyphs) */
.marquee-seq i img {
  width: 16px;
  height: 16px;
  filter: invert(61%) sepia(72%) saturate(530%) hue-rotate(352deg) brightness(96%) contrast(92%);
}

@keyframes marquee-scroll {
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

html.reduce-motion .marquee-track { animation: none; }

/* ---------- Featured projects slider
   The front card sits in normal flow (section height always fits it) and
   the others fade in on top. No 3D, no measuring, nothing to twitch. ---------- */
.barrel {
  max-width: 780px;
  margin: 0 auto 40px;
}

.barrel-stage {
  position: relative;
  touch-action: pan-y;
}

.barrel-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(26px);
  transition: opacity var(--dur-med) ease, transform var(--dur-med) var(--ease-out), visibility 0s linear var(--dur-med);
}

.barrel-slide.is-front {
  position: relative;
  inset: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  z-index: 2;
  transition: opacity var(--dur-med) ease, transform var(--dur-med) var(--ease-out);
}

.barrel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.barrel-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.barrel-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.barrel-dots {
  display: flex;
  gap: 10px;
}

.barrel-dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: var(--border);
  transition: background var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.barrel-dots button.active {
  background: var(--accent);
  transform: scale(1.3);
}

.barrel-hint {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 12px;
}

/* ---------- Mobile tab bar ---------- */
/* The bar and the FAB are fixed to the viewport, so the page needs bottom
   clearance or they sit on top of the last content (contact cards + footer).
   The padding goes on .footer, NOT body: body paints --bg while the footer
   paints --bg-alt, so padding body leaves a differently-coloured band under
   the footer. 180px clears the small-phone FAB (92 + 70) plus breathing room. */
@media (max-width: 1099px) {
  .footer {
    padding-bottom: 180px;
  }

  .tabbar {
    display: flex;
    position: fixed;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    gap: 2px;
    padding: 6px;
    background: var(--nav-bg, rgba(13, 17, 23, 0.86));
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    z-index: 60;
    transition: transform var(--dur-med) var(--ease-out), opacity var(--dur-med) ease;
  }

  .tabbar.tabbar-hidden {
    transform: translate(-50%, 90px);
    opacity: 0;
  }

  .tabbar a,
  .tabbar .tabbar-a11y {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 13px;
    /* .a11y-trigger hard-codes a 36x36 box — undo it so the A11y tab
       sizes like its siblings instead of a square stuck by Contact */
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 0.62rem;
    color: var(--muted);
    text-decoration: none;
    background: none;
    border: none;
    transition: color var(--dur-fast) ease, background var(--dur-fast) ease;
  }

  .tabbar a:hover,
  .tabbar a.active {
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
  }

  .tabbar svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

/* ---------- Intro boot overlay ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.intro.intro-done {
  opacity: 0;
  visibility: hidden;
}

.intro-term {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--muted);
}

.intro-line {
  margin: 6px 0;
}

.intro-line:first-child {
  color: var(--green);
}

.intro-bar {
  display: inline-block;
  width: 180px;
  height: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.intro-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  animation: intro-fill 1.1s var(--ease-out) forwards;
}

@keyframes intro-fill {
  to { width: 100%; }
}

body.intro-lock {
  overflow: hidden;
}

/* ---------- A11y menu ---------- */
.a11y-menu {
  position: fixed;
  bottom: 90px;
  right: 18px;
  width: 250px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
  z-index: 120;
}

@media (min-width: 1100px) {
  .a11y-menu {
    left: 24px;
    right: auto;
    bottom: 90px;
  }
}

.a11y-menu h3 {
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-bottom: 14px;
  color: var(--accent);
}

.a11y-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.9rem;
}

.a11y-row + .a11y-row {
  border-top: 1px solid var(--border);
}

.a11y-switch {
  position: relative;
  width: 42px;
  height: 23px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.a11y-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) ease;
}

.a11y-switch[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.a11y-switch[aria-checked="true"] .a11y-knob {
  transform: translateX(19px);
  background: var(--accent);
}

.a11y-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.a11y-stepper button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
}

.a11y-stepper button:hover {
  border-color: var(--accent);
}

#a11y-font-value {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  min-width: 42px;
  text-align: center;
}

[hidden] {
  display: none !important;
}

/* --- 404 page --- */
.notfound {
  padding: 96px 0 110px;
  background:
    radial-gradient(600px circle at 15% 20%, rgba(240, 180, 41, 0.07), transparent 60%),
    var(--bg);
}

.notfound-inner {
  max-width: 640px;
  text-align: center;
}

.notfound-inner .cta-row {
  justify-content: center;
}

.notfound-code {
  font-family: var(--mono);
  font-size: clamp(4.5rem, 14vw, 7.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 14px;
}

.notfound-title {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  margin-bottom: 14px;
}

.notfound-text {
  color: var(--muted);
  margin-bottom: 30px;
}

@media (max-width: 640px) {
  .notfound {
    padding: 64px 0 80px;
  }
}

/* ============ How It Works — interactive pipeline demos ============ */

.hiw {
  margin-top: 8px;
}

.hiw-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.hiw-switch-btn {
  font-family: var(--mono);
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--dur-fast, 0.15s) ease, border-color var(--dur-fast, 0.15s) ease, background var(--dur-fast, 0.15s) ease;
  font-size: 0.9rem;
  padding: 10px 16px;
}

.hiw-switch-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.hiw-switch-btn.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hiw-switch-btn:focus-visible,
.hiw-run:focus-visible,
.hiw-reset:focus-visible,
.hiw-gate-btn:focus-visible,
.hiw-lead-card input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hiw-setup {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 18px;
  margin-bottom: 18px;
}

.hiw-lead-card {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 14px;
}

.hiw-lead-card legend {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 6px;
}

.hiw-lead-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.hiw-lead-card input {
  width: 170px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.hiw-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hiw-run {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #141005;
  cursor: pointer;
  transition: filter var(--dur-fast, 0.15s) ease;
}

.hiw-run:hover {
  filter: brightness(1.08);
}

.hiw-run:disabled {
  opacity: 0.55;
  cursor: progress;
}

.hiw-reset {
  font-family: var(--mono);
  font-size: 0.88rem;
  padding: 11px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur-fast, 0.15s) ease, border-color var(--dur-fast, 0.15s) ease;
}

.hiw-reset:hover {
  color: var(--text);
  border-color: var(--accent);
}

.hiw-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.09) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow: hidden;
}

.hiw-flow {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
  outline: none;
}

.hiw-flow:focus-visible,
.hiw-pause:focus-visible,
.hiw-run:focus-visible,
.hiw-reset:focus-visible,
.hiw-gate-btn:focus-visible,
.hiw-slider:focus-visible,
.hiw-select:focus-visible,
.hiw-chip:focus-visible,
.hiw-lead-card input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hiw-pause {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(22, 29, 40, 0.75);
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--dur-fast, 0.15s) ease, border-color var(--dur-fast, 0.15s) ease;
}

.hiw-pause:hover {
  color: var(--text);
  border-color: var(--accent);
}

.hiw-pause[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.hiw-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 0 0;
  padding: 14px 18px;
  text-align: center;
}

.hiw-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hiw-metric-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.hiw-metric-value {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.hiw-metric-ok {
  color: var(--green);
}

.hiw-inspect {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  background: var(--surface);
  padding: 14px 16px 16px;
  transition: border-color var(--dur-fast, 0.15s) ease;
}

.hiw-ins-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.hiw-ins-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}

.hiw-ins-icon {
  font-size: 1rem;
}

.hiw-ins-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.hiw-ins-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-left: 2px;
}

.hiw-ins-desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 10px;
  max-width: 640px;
}

.hiw-console {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 26px;
}

.hiw-cgroup {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hiw-clabel {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted);
}

.hiw-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hiw-slider {
  appearance: none;
  width: 120px;
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.hiw-slider::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  transition: transform 0.1s ease;
}

.hiw-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.hiw-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.hiw-slider-val {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 36px;
}

.hiw-select-wrap {
  position: relative;
}

.hiw-select {
  appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 32px 8px 12px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
}

.hiw-select:hover {
  border-color: var(--accent);
}

.hiw-select-wrap::after {
  content: "▾";
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-58%);
  color: var(--muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.hiw-toggle {
  display: flex;
  gap: 6px;
}

.hiw-chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur-fast, 0.15s) ease, border-color var(--dur-fast, 0.15s) ease, background var(--dur-fast, 0.15s) ease;
}

.hiw-chip:hover {
  color: var(--text);
  border-color: var(--accent);
}

.hiw-chip.is-active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hiw-visual {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  min-height: 170px;
  overflow-x: auto;
}

.hiw-hint {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.hiw-log {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--muted);
}

.hiw-board {
  display: flex;
  gap: 10px;
  min-width: 520px;
}

.hiw-col {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px;
}

.hiw-col h4 {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--muted);
  margin-bottom: 8px;
}

.hiw-lead {
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  padding: 6px 8px;
  margin-bottom: 6px;
}

.hiw-lead.is-live {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}

.hiw-lead.is-old {
  opacity: 0.6;
}

.hiw-board-note {
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.hiw-model {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--green);
  margin-bottom: 10px;
}

.hiw-type {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  white-space: pre-wrap;
  min-height: 140px;
}

.hiw-type::after {
  content: "▌";
  color: var(--accent);
  animation: hiw-caret 1s steps(1) infinite;
}

.hiw-type.done::after {
  content: none;
}

@keyframes hiw-caret {
  50% { opacity: 0; }
}

.hiw-mail {
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}

.hiw-mail-head {
  display: flex;
  justify-content: flex-end;
  padding: 6px 12px;
  background: var(--accent-soft);
}

.hiw-mail-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--accent);
  border: 1px dashed var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
}

.hiw-mail-row {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 8px 12px 0;
}

.hiw-mail-body {
  white-space: pre-wrap;
  padding: 10px 12px 4px;
  font-size: 0.88rem;
}

.hiw-cta {
  display: inline-block;
  margin: 8px 12px 14px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #141005;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: default;
}

.hiw-gate {
  text-align: center;
  padding: 10px 0 2px;
}

.hiw-gate-text {
  font-size: 0.95rem;
  margin-bottom: 14px;
}

.hiw-gate-btn {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px 18px;
  border: none;
  border-radius: 10px;
  background: var(--green);
  color: #ffffff;
  cursor: pointer;
  transition: filter var(--dur-fast, 0.15s) ease;
}

.hiw-gate-btn:hover {
  filter: brightness(1.1);
}

.hiw-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
}

.hiw-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.86rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.hiw-bubble.show {
  opacity: 1;
  transform: none;
}

.hiw-bubble.ai {
  align-self: flex-start;
  background: var(--accent-soft);
  border-bottom-left-radius: 4px;
}

.hiw-bubble.cu {
  align-self: flex-end;
  background: var(--bg);
  border-bottom-right-radius: 4px;
}

.hiw-call {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  padding: 12px 14px;
}

.hiw-call-line {
  font-family: var(--mono);
  font-size: 0.9rem;
}

.hiw-call-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.hiw-json {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.hiw-cal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.hiw-hour {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
}

.hiw-hour.is-busy {
  background: var(--accent-soft);
  color: var(--text);
}

.hiw-hour.is-target {
  border-color: var(--green);
  color: var(--green);
  font-weight: 700;
}

.hiw-hour.is-bad {
  border-color: #e5534b;
  color: #e5534b;
}

.hiw-verdict {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.hiw-event {
  border: 1px solid var(--green);
  border-radius: 10px;
  background: rgba(46, 168, 134, 0.08);
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.hiw-tg {
  max-width: 520px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  background: var(--accent-soft);
  font-size: 0.9rem;
}



.hiw-status {
  margin-top: 14px;
  min-height: 1.4em;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
}

.hiw-note {
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .hiw-setup {
    flex-direction: column;
    align-items: stretch;
  }

  .hiw-lead-card label {
    flex: 1 1 40%;
  }

  .hiw-lead-card input {
    width: 100%;
  }

  .hiw-board {
    min-width: 480px;
  }
}

/* --- Unsubscribe page --- */
.unsub {
  padding: 96px 0 110px;
  background:
    radial-gradient(600px circle at 15% 20%, rgba(240, 180, 41, 0.07), transparent 60%),
    var(--bg);
}

.unsub-inner {
  max-width: 560px;
}

.unsub-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.unsub-lead {
  color: var(--muted);
  margin-bottom: 28px;
}

.unsub-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.unsub-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.unsub-input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.unsub-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.unsub-submit {
  align-self: flex-start;
  border: none;
  cursor: pointer;
}

.unsub-help {
  font-size: 0.85rem;
  color: var(--muted);
}

.unsub-legal {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Posts to the Make webhook from a hidden iframe. Kept in the layout (0x0)
   rather than display:none so the browsing context reliably loads and fires
   its load event; removed from the a11y tree so it is never announced. */
.unsub-frame {
  position: absolute;
  width: 0;
  height: 0;
  border: 0;
  visibility: hidden;
}

#done-state:focus {
  outline: none;
}
