/* ═══════════════════════════════════════════
   SYSTEMS PAGE
═══════════════════════════════════════════ */

.pg-hint {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--n-400);
  margin-top: 12px; letter-spacing: 0.04em;
  font-style: italic;
}

/* ── Sub-label (Low-code / Custom code) ───── */
.sub-label-row {
  margin-bottom: 12px;
}
.sub-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--teal);
  border-left: 3px solid var(--yellow);
  padding-left: 10px;
}

/* ── Section label row ─────────────────────── */
.section-label-row {
  display: flex; align-items: baseline; gap: 16px;
  margin-bottom: 16px;
}
.section-tag {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--n-400);
}
.section-tag-desc {
  font-size: 12px; color: var(--n-400);
  font-style: italic; font-weight: 300;
}

/* ── Filter bar ────────────────────────────── */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.filter-btn {
  padding: 7px 16px;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--n-600); background: var(--paper);
  border: 1px solid var(--n-200);
  cursor: pointer; letter-spacing: 0.02em;
  transition: all 0.12s;
}
.filter-btn:hover { border-color: var(--ink); color: var(--ink); }
.filter-btn.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ── Phase badges (front face) ─────────────── */
.card-phase {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid; margin-bottom: 4px;
}
.card-phase--concept    { background: var(--paper); color: var(--n-600); border-color: var(--n-300); }
.card-phase--prototype  { background: #FFF5D6; color: #7A5500; border-color: #E8C84A; }
.card-phase--active     { background: #E6F4F1; color: #1A5E4A; border-color: #4DB89A; }

/* ── Phase badges (back face) ──────────────── */
.back-phase {
  display: inline-flex;
  align-self: flex-start;
  width: fit-content;
  padding: 3px 10px;
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  flex-shrink: 0;
}
.back-phase--concept    { background: var(--n-100); color: var(--n-600); border: 1px solid var(--n-300); }
.back-phase--prototype  { background: #FFF5D6; color: #7A5500; border: 1px solid #E8C84A; }
.back-phase--active     { background: #E6F4F1; color: #1A5E4A; border: 1px solid #4DB89A; }

/* ── Systems grid ──────────────────────────── */
.systems-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 0;
}

/* ── Flip card ─────────────────────────────── */
.flip-card {
  perspective: 1200px;
  min-height: 320px;
  cursor: pointer;
  outline: none;
}
.flip-card:focus .flip-inner { box-shadow: 0 0 0 2px var(--yellow); }
.flip-card.is-hidden { display: none; }

.flip-inner {
  position: relative;
  width: 100%; height: 100%;
  min-height: 320px;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}
.flip-card.flipped .flip-inner { transform: rotateY(180deg); }

.flip-front,
.flip-back {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--ink);
  padding: 22px;
  display: flex; flex-direction: column;
}

/* Front */
.flip-front {
  background: var(--paper);
  justify-content: space-between;
}
.flip-front::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: var(--yellow);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.2s ease;
}
.flip-card:hover .flip-front::after { transform: scaleX(1); }

.card-problem {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(14px, 1.4vw, 17px);
  line-height: 1.35; color: var(--ink);
  flex: 1; padding: 8px 0;
}
.card-name {
  font-family: var(--serif); font-weight: 700;
  font-size: 13px; color: var(--teal);
  margin-top: 16px;
}
.card-flip-hint {
  font-size: 10px; color: var(--n-400);
  text-transform: uppercase; letter-spacing: 0.07em;
  margin-top: 6px;
}

/* Back */
.flip-back {
  background: var(--ink);
  color: var(--paper);
  transform: rotateY(180deg);
  gap: 10px;
  overflow-y: auto;
}

.back-header { border-bottom: 1px solid rgba(255,255,255,0.08); padding-bottom: 10px; }
.back-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.back-name {
  font-family: var(--serif); font-weight: 700;
  font-size: 18px; color: var(--yellow); line-height: 1;
}
.back-sub {
  font-size: 11px; color: rgba(255,255,255,0.4);
  letter-spacing: 0.03em; margin-top: 2px;
}
.back-location {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: rgba(255,255,255,0.3);
  margin-top: 6px; letter-spacing: 0.04em;
}
.back-location svg { opacity: 0.4; }

.back-section { display: flex; flex-direction: column; gap: 5px; }
.back-label {
  font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--yellow); opacity: 0.6;
}
.back-section p {
  font-size: 11.5px; line-height: 1.7;
  color: rgba(255,255,255,0.72); font-weight: 300;
}
.back-question {
  font-family: var(--serif) !important; font-weight: 700 !important;
  color: rgba(255,255,255,0.88) !important;
  font-size: 12px !important; line-height: 1.5 !important;
}

.back-footer {
  margin-top: auto; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
/* Override phase badge colors when inside dark flip-back */
.flip-back .back-phase--concept    { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); border-color: rgba(255,255,255,0.15); }
.flip-back .back-phase--prototype  { background: rgba(232,200,74,0.15); color: #FFD966; border-color: rgba(232,200,74,0.3); }
.flip-back .back-phase--active     { background: rgba(77,184,154,0.15); color: #7FD4BA; border-color: rgba(77,184,154,0.3); }

/* ── Project links ─────────────────────────── */
.back-link--active {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px;
  font-size: 11px; font-weight: 600;
  background: var(--yellow); color: var(--ink);
  border: 1px solid rgba(255,255,255,0.2);
  text-decoration: none; letter-spacing: 0.03em;
  margin-bottom: 8px;
  transition: opacity 0.15s;
}
.back-link--active:hover { opacity: 0.85; }

.back-link--inactive {
  display: inline-flex; align-items: center;
  padding: 5px 12px;
  font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.25);
  border: 1px dashed rgba(255,255,255,0.12);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
  cursor: default;
}
.back-tools { display: flex; flex-wrap: wrap; gap: 5px; }
.tool-tag {
  padding: 2px 8px; font-size: 10px; font-weight: 500;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.1);
}
.flip-back .card-flip-hint {
  font-size: 10px; color: rgba(255,255,255,0.2);
  margin-top: 6px;
}

/* ── Taught section ────────────────────────── */
.section-tag--large {
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-transform: none;
}

.taught-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.taught-card {
  border: 1px solid var(--n-200);
  border-top: none;
  border-left: 4px solid var(--teal);
  padding: 20px 28px;
  background: var(--paper);
  display: grid;
  grid-template-columns: 220px 1fr auto;
  align-items: center;
  gap: 24px;
}
.taught-card:first-child { border-top: 1px solid var(--n-200); }

.taught-header {
  display: flex; flex-direction: column;
  gap: 6px;
}
.taught-name {
  font-family: var(--serif); font-weight: 700;
  font-size: 15px; color: var(--ink);
}
.taught-location {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--n-400);
  letter-spacing: 0.03em;
}
.taught-desc {
  font-size: 13px; line-height: 1.7;
  color: var(--n-600); font-weight: 300;
  margin: 0;
}

/* Taught section tool tags */
.taught-card .tool-tag {
  background: var(--n-100);
  color: var(--n-600);
  border-color: var(--n-200);
}
.taught-card .back-tools { margin-top: 0 !important; }

/* ── CTA ───────────────────────────────────── */
.systems-cta {
  display: flex; align-items: center;
  justify-content: space-between;
  border: 1px solid var(--ink);
  padding: 28px 32px;
  background: var(--paper);
  flex-wrap: wrap; gap: 16px;
  margin-top: 48px;
}
.systems-cta p {
  font-family: var(--serif); font-weight: 700;
  font-size: 18px; color: var(--ink);
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1100px) { .systems-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .systems-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  {
  .taught-card { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 520px)  {
  .systems-grid { grid-template-columns: 1fr; }
  .flip-card, .flip-inner { min-height: 260px; }
  .systems-cta { flex-direction: column; align-items: flex-start; padding: 20px; }
}
