/* ... All your existing :root and card styles go here ... */
 :root {
      --bg: #f5f5f7;
      --bg-alt: #ffffff;
      --text: #111111;
      --text-muted: #666666;
      --accent: #2563eb;
      --accent-soft: rgba(37, 99, 235, 0.08);
      --border: #e0e0e5;
      --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
      --max-width: 1100px;
      --radius: 0; /* square corners */
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.5;
    }

    .page {
      min-height: 100vh;
      display: flex;
      flex-direction: column;
    }

    header {
      border-bottom: 1px solid var(--border);
      background: var(--bg-alt);
    }

    .nav {
      max-width: var(--max-width);
      margin: 0 auto;
      padding: 1rem 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 0.6rem;
    }

    .brand-mark {
      width: 28px;
      height: 28px;
      border: 2px solid var(--text);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.65rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      background: var(--bg-alt);
    }

    .brand-title {
      font-weight: 700;
      font-size: 1.1rem;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .brand-sub {
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .nav-right {
      font-size: 0.85rem;
      color: var(--text-muted);
    }

    main {
      flex: 1;
    }

    .hero {
      max-width: var(--max-width);
      margin: 0 auto;
      padding: 2.5rem 1.25rem 1rem;
    }

    .hero-eyebrow {
      font-size: 0.8rem;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--text-muted);
      margin-bottom: 0.75rem;
    }

    .hero-title {
      font-size: 2rem;
      line-height: 1.15;
      margin-bottom: 0.75rem;
    }

    .hero-title span {
      background: var(--accent-soft);
      padding: 0.15rem 0.3rem;
    }

    .hero-text {
      font-size: 0.95rem;
      max-width: 34rem;
      color: var(--text-muted);
      margin-bottom: 1.5rem;
    }

    .hero-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem 1.5rem;
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .hero-meta span {
      position: relative;
      padding-left: 0.75rem;
    }

    .hero-meta span::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0.55em;
      width: 6px;
      height: 1px;
      background: var(--border);
    }

    .frames-section {
      max-width: var(--max-width);
      margin: 0 auto;
      padding: 1.75rem 1.25rem 2.5rem;
    }

    .frames-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 1rem;
      margin-bottom: 1.25rem;
    }

    .frames-title {
      font-size: 0.9rem;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    .frames-sub {
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .frames-grid {
      display: grid;
      grid-template-columns: repeat(1, minmax(0, 1fr));
      gap: 1rem;
    }

    @media (min-width: 640px) {
      .frames-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (min-width: 960px) {
      .frames-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
      }
    }

    .frame-card {
      background: var(--bg-alt);
      border: 1px solid var(--border);
      box-shadow: var(--shadow-soft);
      padding: 1rem 1rem 0.9rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 0.75rem;
      min-height: 140px;
      transition: transform 0.12s ease, box-shadow 0.12s ease,
        border-color 0.12s ease;
    }

    .frame-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
      border-color: rgba(148, 163, 184, 0.9);
    }

    .frame-header-row {
      display: flex;
      justify-content: space-between;
      gap: 0.75rem;
      align-items: flex-start;
    }

    .frame-label {
      font-size: 0.75rem;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    .frame-id {
      font-size: 0.75rem;
      color: var(--text-muted);
    }

    .frame-title {
      font-size: 1rem;
      font-weight: 600;
      margin-top: 0.25rem;
    }

    .frame-desc {
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-top: 0.25rem;
    }

    .frame-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.75rem;
      margin-top: 0.5rem;
    }

    .frame-pill {
      font-size: 0.75rem;
      padding: 0.15rem 0.45rem;
      border: 1px dashed var(--border);
      text-transform: uppercase;
      letter-spacing: 0.12em;
      color: var(--text-muted);
    }

    .frame-button {
      font-size: 0.8rem;
      padding: 0.45rem 0.8rem;
      border: 1px solid var(--border);
      background: #f9fafb;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.12em;
      cursor: default;
      pointer-events: none;
      border-radius: var(--radius);
    }

    .frame-button.active {
      cursor: pointer;
      pointer-events: auto;
      color: #ffffff;
      background: var(--accent);
      border-color: var(--accent);
    }

    .frame-button.active:hover {
      filter: brightness(1.04);
    }

    footer {
      border-top: 1px solid var(--border);
      background: var(--bg-alt);
      font-size: 0.8rem;
      color: var(--text-muted);
    }

    .footer-inner {
      max-width: var(--max-width);
      margin: 0 auto;
      padding: 0.85rem 1.25rem 1.4rem;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      gap: 0.75rem;
    }

/* --- Modal UI --- */
.modal-overlay {
  display: none; /* Controlled by JS */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(17, 17, 17, 0.85); /* Slightly darker for focus */
  backdrop-filter: blur(5px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-container {
  background: var(--bg-alt);
  width: 100%;
  max-width: 1000px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#modal-title {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  flex: 1;
  overflow: hidden;
}

#tool-iframe {
  width: 100%;
  height: 100%;
  border: none;
}