/* ============================================================
   aminalait.com — Personal Website
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Light default — Frost */
  --bg:          #f0f8ff;
  --bg-alt:      #e6f2fd;
  --bg-card:     #d9eafa;
  --border:      #b3d4f5;
  --accent:      #1d4ed8;
  --accent-dim:  #1e40af;
  --accent-glow: rgba(29,78,216,.10);
  --text:        #1e3a5f;
  --text-muted:  #4475a0;
  --text-dim:    #7bafd4;
  --green:       #15803d;
  --orange:      #b45309;
  --nav-bg:      rgba(240,248,255,.92);
  --glow:        rgba(29,78,216,.08);
  --font-sans:   'Inter', system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', 'Fira Code', monospace;
  --radius:      8px;
  --radius-lg:   12px;
  --max-w:       960px;
  --nav-h:       60px;
}

html[data-theme="dark"] {
  /* Dark — Cobalt */
  --bg:          #07111f;
  --bg-alt:      #0c1c2e;
  --bg-card:     #102233;
  --border:      #1c3444;
  --accent:      #38bdf8;
  --accent-dim:  #0ea5e9;
  --accent-glow: rgba(56,189,248,.15);
  --text:        #e1eaf3;
  --text-muted:  #8ba5b8;
  --text-dim:    #516272;
  --green:       #34d399;
  --orange:      #fbbf24;
  --nav-bg:      rgba(7,17,31,.88);
  --glow:        rgba(14,165,233,.16);
}

html { scroll-behavior: smooth; font-size: 16px; }

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

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

strong { color: var(--text); font-weight: 600; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.section { padding: 80px 0; }
.section--alt { background: var(--bg-alt); }

.section__title {
  font-size: 1.1rem;
  font-family: var(--font-mono);
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav__logo {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent);
}
.nav__links {
  list-style: none;
  display: flex;
  gap: 28px;
}
.nav__links a {
  font-size: .85rem;
  color: var(--text-muted);
  transition: color .2s;
}
.nav__links a:hover { color: var(--text); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + 40px) 24px 80px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, var(--glow) 0%, transparent 70%),
    var(--bg);
}
.hero__content { max-width: 640px; }
.hero__greeting {
  font-family: var(--font-mono);
  font-size: .9rem;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero__name {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  margin-bottom: 10px;
}
.hero__role {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  font-size: .85rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 28px;
}
.hero__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 36px;
}
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 500;
  font-family: var(--font-mono);
}
.badge--cert {
  background: rgba(63,185,80,.1);
  color: var(--green);
  border: 1px solid rgba(63,185,80,.3);
}
.badge--project {
  background: rgba(88,166,255,.1);
  color: var(--accent);
  border: 1px solid rgba(88,166,255,.3);
}

.hero__scroll-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 1.2rem;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(6px); }
}

/* ---------- About ---------- */
.about__grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: start;
}
.about__text p { color: var(--text-muted); margin-bottom: 16px; }
.about__text p:last-child { margin-bottom: 0; }
.about__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
  min-width: 100px;
}
.stat__value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 4px;
}
.stat__label {
  font-size: .72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ---------- Skills ---------- */
.skills__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}
.skill-group__title {
  font-size: .78rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.skill-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.skill-name {
  font-size: .88rem;
  color: var(--text-muted);
}
.skill-dots {
  display: flex;
  gap: 4px;
}
.skill-dots::before { content: ''; }

/* dots rendered by JS */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.dot--filled { background: var(--accent); }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 28px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 1px;
  background: var(--border);
}
.timeline__item {
  position: relative;
  margin-bottom: 48px;
}
.timeline__item:last-child { margin-bottom: 0; }
.timeline__marker {
  position: absolute;
  left: -24px;
  top: 8px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--bg);
}
.timeline__body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .2s;
}
.timeline__body:hover { border-color: var(--accent-dim); }
.timeline__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.timeline__role {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.timeline__badge {
  font-size: .68rem;
  font-family: var(--font-mono);
  background: rgba(210,153,34,.12);
  color: var(--orange);
  border: 1px solid rgba(210,153,34,.3);
  border-radius: 4px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 6px;
}
.timeline__company {
  font-size: .85rem;
  color: var(--text-muted);
}
.timeline__period {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-dim);
  white-space: nowrap;
  padding-top: 2px;
}
.timeline__industry {
  font-size: .75rem;
  font-family: var(--font-mono);
  color: var(--accent);
  opacity: .7;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.timeline__desc {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.timeline__bullets {
  padding-left: 18px;
  margin-bottom: 16px;
}
.timeline__bullets li {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.timeline__bullets li::marker { color: var(--accent); }
.timeline__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.timeline__tags span,
.project-card__tags span,
.blog-post-card__tags span {
  font-family: var(--font-mono);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}
.timeline__tags span,
.project-card__tags span { font-size: .72rem; padding: 2px 8px; }
.blog-post-card__tags span { font-size: .68rem; padding: 1px 6px; }

/* ---------- Certifications ---------- */
.certs__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: border-color .2s, transform .2s;
}
.cert-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}
.cert-card__icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.cert-card__code {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--green);
  letter-spacing: .08em;
  margin-bottom: 4px;
}
.cert-card__title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.cert-card__issuer {
  font-size: .8rem;
  color: var(--text-dim);
}

/* ---------- Languages ---------- */
.languages__grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
}
.lang { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px 16px; }
.lang__name { font-weight: 500; font-size: .9rem; }
.lang__level {
  font-size: .78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}
.lang__bar {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.lang__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 2px;
}

/* ---------- Contact ---------- */
.contact__intro {
  color: var(--text-muted);
  margin-bottom: 32px;
}
.contact__details { display: flex; flex-direction: column; gap: 16px; }
.contact__item { display: flex; gap: 16px; align-items: baseline; }
.contact__label {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
  min-width: 120px;
}
.contact__value { font-size: .9rem; color: var(--text-muted); }

/* ---------- Footer ---------- */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
}
.footer p {
  font-size: .8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.footer p:last-child { margin-bottom: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__stats { grid-template-columns: repeat(4, 1fr); }
  .skills__grid { grid-template-columns: 1fr; }
  .certs__grid { grid-template-columns: 1fr; }
  .nav__links { display: none; }
  .timeline__header { flex-direction: column; gap: 4px; }
  .timeline__period { padding-top: 0; }
  .lang { grid-template-columns: 100px 1fr; }
}

@media (max-width: 480px) {
  .about__stats { grid-template-columns: repeat(2, 1fr); }
  .hero__name { font-size: 2rem; }
}

/* ---------- Teaser link ---------- */
.teaser__link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--accent);
  transition: opacity .2s;
}
.teaser__link:hover { opacity: .75; text-decoration: none; }

/* ---------- Nav active link ---------- */
.nav__links a.nav__active { color: var(--accent); }

/* ---------- Nav right group & theme toggle ---------- */
.nav__right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .9rem;
  line-height: 1;
  padding: 5px 9px;
  transition: color .2s, border-color .2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Sub-hero (inner pages) ---------- */
.page-hero {
  padding: calc(var(--nav-h) + 60px) 24px 60px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, var(--glow) 0%, transparent 70%),
    var(--bg);
}
.page-hero__label {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--accent);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.page-hero__title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 14px;
}
.page-hero__sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Project cards ---------- */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: border-color .2s;
}
.project-card:hover { border-color: var(--accent-dim); }
.project-card + .project-card { margin-top: 40px; }

.project-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.project-card__title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}
.project-card__tagline {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.badge--status-active {
  background: rgba(63,185,80,.1);
  color: var(--green);
  border: 1px solid rgba(63,185,80,.3);
}
.badge--status-wip {
  background: rgba(210,153,34,.1);
  color: var(--orange);
  border: 1px solid rgba(210,153,34,.3);
}
.project-card__desc {
  font-size: .88rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.7;
}

/* Pipeline phases */
.pipeline {
  margin-bottom: 28px;
}
.pipeline__label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 16px;
}
.pipeline__phases {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pipeline__phase {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.pipeline__connector {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  padding-top: 2px;
}
.pipeline__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent);
  flex-shrink: 0;
}
.pipeline__line {
  width: 1px;
  height: 14px;
  background: var(--border);
  margin-top: 2px;
}
.pipeline__phase:last-child .pipeline__line { display: none; }
.pipeline__phase-num {
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--accent);
  opacity: .8;
  min-width: 60px;
  line-height: 1.4;
}
.pipeline__phase-name {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}
.pipeline__phase-detail {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.pipeline__decision {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--accent-glow);
  border: 1px dashed var(--accent-dim);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--accent);
  margin: 4px 0 4px 24px;
}

.project-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.project-card__tags + .teaser__link { margin-top: 20px; }

/* ---------- Blog ---------- */
.blog__posts { display: flex; flex-direction: column; gap: 24px; }
.blog__posts + .teaser__link { margin-top: 28px; }
.blog-post-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color .2s, transform .2s;
  text-decoration: none;
}
.blog-post-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}
.blog-post-card__meta {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: flex;
  gap: 16px;
}
.blog-post-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  transition: color .2s;
}
.blog-post-card:hover .blog-post-card__title { color: var(--accent); }
.blog-post-card__excerpt {
  font-size: .85rem;
  color: var(--text-muted);
}
.blog-post-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.blog-post-card__links { display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.blog-post-card__links a { font-size: .82rem; color: var(--accent); text-decoration: none; font-family: var(--font-mono); }
.blog-post-card__links a:hover { text-decoration: underline; }

/* ---------- Responsive (new) ---------- */
@media (max-width: 720px) {
  .project-card__header { flex-direction: column; gap: 8px; }
  .pipeline__phase { flex-wrap: wrap; }
}

/* ---------- SF Pipeline Diagram ---------- */
.sf-pipeline { margin-bottom: 28px; }

.sf-flow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.sf-conn {
  align-self: center;
  width: 2px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
  position: relative;
}
.sf-conn::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--border);
}
.sf-conn--sm { height: 14px; }
.sf-group__body .sf-conn::after,
.sf-loop .sf-conn::after { display: none; }
.sf-group__body .sf-conn--sm,
.sf-loop .sf-conn--sm { height: 12px; }

.sf-terminal {
  align-self: center;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 6px 20px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  color: var(--text-dim);
}
.sf-terminal--start { border-color: var(--accent); color: var(--accent); }
.sf-terminal--end   { border-color: var(--green);  color: var(--green);  }

.sf-node {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 11px 36px 11px 14px;
  position: relative;
}
.sf-node--wait { border-left-color: var(--orange); }
.sf-node__desc  { display: none; }

/* ⓘ info button */
.sf-info-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: .65rem;
  font-style: italic;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
}
.sf-info-btn:hover,
.sf-info-btn.is-active { color: var(--accent); border-color: var(--accent); }

/* Popover */
.sf-popover {
  position: fixed;
  z-index: 200;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.55;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  pointer-events: none;
  max-width: 360px;
}
.sf-popover code {
  font-family: var(--font-mono);
  font-size: .72rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
}

/* Service icon */
.sf-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-right: 6px;
  border-radius: 3px;
  vertical-align: middle;
}

/* Service colour coding */
.sf-node--lambda { border-left-color: #FF9900; }
.sf-node--batch  { border-left-color: #FF9900; }
.sf-node--glue   { border-left-color: #8C4FFF; }
.sf-node--athena { border-left-color: #8C4FFF; }

.sf-node__svc {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-dim);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}
.sf-node__title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.sf-node__desc {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.sf-node__desc code {
  font-family: var(--font-mono);
  font-size: .73rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 4px;
}

.sf-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sf-group__header {
  background: var(--bg-alt);
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: .68rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .09em;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .15s;
}
.sf-group__header:hover { background: var(--bg-card); }
.sf-group__header::after {
  content: '▾';
  font-size: .7rem;
  transition: transform .2s;
}
.sf-group.is-collapsed .sf-group__header::after {
  transform: rotate(-90deg);
}
.sf-group__body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  max-height: 2000px;
  transition: max-height .3s ease, padding .3s ease;
}
.sf-group.is-collapsed .sf-group__body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}
.sf-group__body > .sf-conn { align-self: center; }

.sf-decision {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 0 4px;
}
.sf-decision__diamond {
  width: 120px;
  height: 120px;
  background: var(--accent-glow);
  border: 2px solid var(--accent);
  transform: rotate(45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sf-decision__head {
  transform: rotate(-45deg);
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  white-space: nowrap;
  line-height: 1.3;
}
.sf-decision--sm .sf-decision__diamond { width: 90px; height: 90px; }
.sf-decision--sm .sf-decision__head   { font-size: .62rem; }
.sf-decision__branches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.sf-branch {
  font-family: var(--font-mono);
  font-size: .64rem;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid;
}
.sf-branch--yes  { color: var(--green);      border-color: var(--green);  background: var(--bg-card); }
.sf-branch--skip { color: var(--orange);     border-color: var(--orange); background: var(--bg-card); }
.sf-branch--loop { color: var(--text-muted); border-color: var(--border); background: var(--bg-card); }

.sf-loop {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.sf-loop > .sf-conn { align-self: center; }
.sf-loop__label {
  font-family: var(--font-mono);
  font-size: .6rem;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
}

/* Labeled connector */
.sf-conn--labeled { height: 32px; }
.sf-conn--labeled::before {
  content: attr(data-label);
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: .58rem;
  color: var(--text-dim);
  white-space: nowrap;
  letter-spacing: .04em;
  opacity: .85;
}

/* Phase breadcrumb */
.sf-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-bottom: 14px;
}
.sf-bc-step {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  letter-spacing: .04em;
}
.sf-bc-arrow {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-dim);
}

/* Scale callout bar */
.sf-scale-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  background: var(--accent-glow);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.sf-scale-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sf-scale-val {
  font-family: var(--font-mono);
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.sf-scale-lbl {
  font-family: var(--font-mono);
  font-size: .56rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.sf-scale-sep {
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* Runtime note */
.sf-runtime-note {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: .04em;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .sf-decision__branches { flex-direction: column; }
  .sf-scale-bar { gap: 6px 12px; }
  .sf-conn--labeled::before { display: none; }
}
