/* Inputs: Static FINCHIP markup and theme tokens.
 * Outputs: protocol presentation and responsive states.
 * Role: Preserves the supplied Finch visual system for the independent homepage. */
/* Migrated from v18. Responsive integration overrides live in styles.css. */

    :root {
      color-scheme: light;
      --ink: oklch(0.18 0.01 260);
      --muted: oklch(0.52 0.012 260);
      --faint: oklch(0.68 0.012 260);
      --line: oklch(0.9 0.012 285);
      --paper: oklch(0.992 0.004 250);
      --surface: oklch(0.998 0.002 250);
      --accent: oklch(0.64 0.22 26);
      --accent-soft: oklch(0.96 0.025 26);
      --accent-rgb: 245 61 61;
      --ease: cubic-bezier(0.22, 1, 0.36, 1);
    }

    * { box-sizing: border-box; }



    .protocol-section {
      min-height: 100svh;
      display: flex;
      align-items: center;
      overflow: hidden;
      padding: clamp(30px, 4.5vh, 54px) clamp(20px, 4vw, 76px);
      background:
        radial-gradient(circle at 50% 54%, rgb(var(--accent-rgb) / 0.045), transparent 28%),
        radial-gradient(circle at 1px 1px, oklch(0.72 0.018 250 / 0.09) 1px, transparent 1.2px),
        var(--paper);
      background-size: auto, 14px 14px, auto;
      transition: background-color 320ms var(--ease);
    }

    .protocol-frame {
      width: min(100%, 1320px);
      margin-inline: auto;
    }

    .protocol-header {
      display: grid;
      justify-items: center;
      text-align: center;
    }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      min-height: 36px;
      padding: 0 19px;
      border: 1px solid oklch(0.88 0.01 260);
      border-radius: 999px;
      background: oklch(0.998 0.002 250 / 0.94);
      box-shadow: 0 4px 14px oklch(0.2 0.01 260 / 0.06);
      color: oklch(0.58 0.015 260);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.16em;
    }

    .protocol-header h1 {
      margin: clamp(18px, 2.5vh, 28px) 0 0;
      font-size: clamp(34px, 3.5vw, 60px);
      font-weight: 500;
      letter-spacing: -0.058em;
      line-height: 0.98;
      text-wrap: balance;
    }

    .protocol-header > p {
      max-width: 760px;
      margin: 20px 0 0;
      color: var(--muted);
      font-size: clamp(15px, 1.2vw, 20px);
      line-height: 1.5;
    }

    .protocol-navigation {
      width: min(100%, 1040px);
      margin: clamp(24px, 3.2vh, 36px) auto 0;
    }

    .protocol-tabs {
      display: grid;
      grid-template-columns: repeat(8, minmax(0, 1fr));
      gap: 6px;
      padding: 5px;
      border: 1px solid var(--line);
      border-radius: 16px;
      background: oklch(0.975 0.005 260 / 0.9);
    }

    .protocol-tab {
      min-height: 50px;
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      align-items: center;
      padding: 8px 18px;
      border: 1px solid transparent;
      border-radius: 11px;
      background: transparent;
      color: var(--faint);
      cursor: pointer;
      text-align: left;
      transition:
        color 280ms var(--ease),
        background-color 280ms var(--ease),
        border-color 280ms var(--ease),
        box-shadow 280ms var(--ease);
    }

    .protocol-tab:hover {
      color: var(--muted);
      background: oklch(0.998 0.002 250 / 0.78);
    }

    .protocol-tab[aria-selected="true"] {
      border-color: oklch(0.86 0.02 260);
      background: var(--surface);
      color: var(--ink);
      box-shadow: 0 5px 14px oklch(0.2 0.01 260 / 0.07);
    }

    .protocol-tab:focus-visible {
      outline: 2px solid var(--tab-accent, var(--accent));
      outline-offset: 2px;
    }

    .tab-label {
      display: grid;
      gap: 1px;
    }

    .protocol-tab strong {
      color: color-mix(in oklch, var(--tab-accent) 80%, var(--ink));
      font-size: 12px;
      font-weight: 700;
    }

    .protocol-tab small {
      color: var(--muted);
      font-size: 9px;
      line-height: 1.25;
    }

    .protocol-workspace {
      position: relative;
      margin-top: 30px;
      border: 1px solid var(--line);
      border-radius: 26px;
      background: var(--surface);
      box-shadow: 0 18px 60px oklch(0.26 0.02 260 / 0.04);
      isolation: isolate;
    }

    .protocol-workspace::before {
      content: "";
      position: absolute;
      z-index: -1;
      inset: 0;
      border-radius: inherit;
      background: radial-gradient(ellipse at 82% 22%, rgb(var(--accent-rgb) / 0.07), transparent 40%);
      pointer-events: none;
    }

    .protocol-shell {
      display: grid;
      grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
      grid-template-rows: 174px 156px auto;
      grid-template-areas: "info market" "flow flow" "source source";
      column-gap: 48px;
      row-gap: 32px;
      padding: 38px 42px 25px;
      transition: opacity 180ms var(--ease), transform 180ms var(--ease);
    }

    .protocol-shell.is-leaving { opacity: 0; transform: translateY(7px); }

    .active-info { grid-area: info; align-self: center; }

    .protocol-kicker {
      display: inline-flex;
      align-items: center;
      gap: 9px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.06em;
    }

    .protocol-kicker::before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent);
    }

    .active-info h2 {
      margin: 12px 0 0;
      font-size: clamp(29px, 2.8vw, 42px);
      font-weight: 600;
      letter-spacing: -0.045em;
      line-height: 1.12;
    }

    .active-info p {
      max-width: 64ch;
      margin: 15px 0 0;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.65;
    }

    @media (min-width: 901px) {
      .protocol-shell[data-protocol="erc-8444"] .active-info h2 {
        font-size: clamp(26px, 2.15vw, 32px);
      }
    }

    .protocol-diagram {
      --node-size: 64px;
      --axis-y: 32px;
      grid-area: market;
      position: relative;
      align-self: center;
      min-width: 0;
      padding-block: 20px 12px;
      isolation: isolate;
    }

    .diagram-steps {
      position: relative;
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .diagram-steps::before {
      content: "";
      position: absolute;
      z-index: -1;
      top: var(--axis-y);
      right: 16.666%;
      left: 16.666%;
      height: 1px;
      background: rgb(var(--accent-rgb) / 0.1);
    }

    .diagram-connector {
      position: absolute;
      z-index: -1;
      top: calc(20px + var(--axis-y));
      right: 16.666%;
      left: 16.666%;
      height: 1px;
      overflow: hidden;
      pointer-events: none;
    }

    .diagram-connector::after {
      content: "";
      position: absolute;
      inset: 0 0 0 -11px;
      background: repeating-linear-gradient(90deg, rgb(var(--accent-rgb) / 0.7) 0 4px, transparent 4px 11px);
      animation: connector-flow 1.8s linear infinite;
    }

    @keyframes connector-flow {
      to { transform: translateX(11px); }
    }

    .diagram-step {
      position: relative;
      display: flex;
      min-width: 0;
      flex-direction: column;
      align-items: center;
      text-align: center;
    }

    .diagram-step::before,
    .diagram-step::after {
      content: "";
      position: absolute;
      z-index: -1;
      top: var(--axis-y);
      left: 50%;
      width: 108px;
      height: 108px;
      border: 1px solid rgb(var(--accent-rgb) / 0.06);
      border-radius: 50%;
      transform: translate(-50%, -50%);
      pointer-events: none;
    }

    .diagram-step::after {
      width: 154px;
      height: 154px;
      border-style: dashed;
      border-color: rgb(var(--accent-rgb) / 0.12);
      background: radial-gradient(circle, rgb(var(--accent-rgb) / 0.055), transparent 68%);
      opacity: 0;
      animation: ring-expand 7.2s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
    }

    .diagram-step:nth-child(2)::after { width: 190px; height: 190px; animation-delay: -2.4s; }
    .diagram-step:nth-child(3)::after { animation-delay: -4.8s; }

    @keyframes ring-expand {
      0% { transform: translate(-50%, -50%) scale(0.58); opacity: 0; }
      14% { transform: translate(-50%, -50%) scale(0.72); opacity: 0.7; }
      76%, 100% { transform: translate(-50%, -50%) scale(1.13); opacity: 0; }
    }

    .diagram-tile {
      position: relative;
      z-index: 1;
      display: grid;
      place-items: center;
      width: var(--node-size);
      height: var(--node-size);
      margin-bottom: 14px;
      border: 1px solid color-mix(in oklch, var(--accent) 7%, var(--line));
      border-radius: 14px;
      background: linear-gradient(145deg, var(--surface) 32%, color-mix(in srgb, var(--surface) 88%, var(--accent-soft)));
      box-shadow: 0 5px 16px rgb(var(--accent-rgb) / 0.05), inset 0 1px 1px var(--surface);
    }

    .diagram-tile::before,
    .diagram-tile::after {
      content: "";
      position: absolute;
      top: 50%;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--surface);
      box-shadow: 0 0 5px rgb(var(--accent-rgb) / 0.14);
      transform: translateY(-50%);
    }

    .diagram-tile::before { left: -4px; }
    .diagram-tile::after { right: -4px; }
    .diagram-step:first-child .diagram-tile::before,
    .diagram-step:last-child .diagram-tile::after { display: none; }

    .diagram-icon {
      width: 42px;
      height: 42px;
      overflow: visible;
      filter: drop-shadow(0 3px 3px rgb(var(--accent-rgb) / 0.13));
    }

    .diagram-icon .icon-light { stop-color: color-mix(in srgb, var(--accent) 38%, var(--surface)); }
    .diagram-icon .icon-dark { stop-color: var(--accent); }
    .diagram-icon .icon-detail { stroke: var(--surface); stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }

    .diagram-step strong {
      display: block;
      max-width: 100%;
      padding-inline: 5px;
      color: var(--ink);
      font-size: 13px;
      font-weight: 700;
      line-height: 1.4;
      letter-spacing: -0.025em;
    }

    .diagram-step small {
      display: block;
      margin-top: 3px;
      color: var(--muted);
      font-size: 11px;
      line-height: 1.4;
    }

    .diagram-arrow {
      position: absolute;
      z-index: 2;
      top: calc(20px + var(--axis-y));
      display: grid;
      place-items: center;
      width: 32px;
      height: 32px;
      border: 1px solid var(--surface);
      border-radius: 50%;
      background: color-mix(in oklch, var(--surface) 82%, var(--accent-soft));
      box-shadow: 0 0 0 5px rgb(var(--accent-rgb) / 0.025);
      color: var(--accent);
      transform: translate(-50%, -50%);
    }

    .diagram-arrow svg { width: 16px; height: 16px; }
    .diagram-arrow.is-first { left: 33.333%; }
    .diagram-arrow.is-second { left: 66.666%; }

    .diagram-highlight {
      position: absolute;
      inset: 0;
      border-radius: inherit;
      background: radial-gradient(ellipse at 50% 65%, rgb(var(--accent-rgb) / 0.2), transparent 80%);
      opacity: 0.15;
      pointer-events: none;
    }

    .is-leaving .diagram-connector::after,
    .is-leaving .diagram-step::after { animation-play-state: paused; }

    .flow-strip {
      grid-area: flow;
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      padding-top: 25px;
      border-top: 1px solid var(--line);
    }

    .flow-card {
      min-width: 0;
      display: grid;
      grid-template-rows: 27px 38px auto;
      align-content: start;
      padding: 0 23px;
    }

    .flow-card:first-child { padding-left: 0; }
    .flow-card:last-child { padding-right: 0; }
    .flow-card + .flow-card { border-left: 1px solid var(--line); }

    .node-icon {
      color: var(--accent);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
    }

    .flow-card strong {
      display: block;
      max-width: 24ch;
      font-size: 15px;
      font-weight: 700;
      letter-spacing: -0.025em;
      line-height: 1.35;
      text-wrap: balance;
    }

    .flow-card p {
      max-width: 32ch;
      margin: 8px 0 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.6;
    }

    .source-rail {
      grid-area: source;
      justify-self: start;
      display: inline-flex;
      align-items: center;
      gap: 9px;
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
      text-decoration: none;
      transition: color 200ms var(--ease);
    }

    .source-rail:hover { color: var(--accent); }
    .source-rail:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 3px; }
    .source-arrow { color: var(--accent); font-size: 16px; }

    @media (max-width: 1050px) {
      .protocol-shell { column-gap: 24px; padding: 30px; }
      .active-info h2 { font-size: 28px; }
      .active-info p { font-size: 13px; line-height: 1.6; }
      .flow-card { padding-inline: 16px; }
      .flow-card strong { font-size: 14px; }
      .flow-card p { font-size: 11px; }
      .protocol-diagram { --node-size: 58px; }
      .diagram-tile { margin-block: 3px 14px; }
      .diagram-step strong { font-size: 11px; }
      .diagram-step small { font-size: 10px; }
    }

    @media (max-width: 900px) {
      .protocol-section { padding: 30px 20px; }
      .protocol-header h1 { font-size: clamp(30px, 5vw, 40px); line-height: 1.08; }
      .protocol-shell { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "info" "market" "flow" "source"; padding: 28px; row-gap: 25px; }
      .protocol-diagram { --node-size: 64px; width: min(100%, 560px); justify-self: center; }
      .diagram-tile { margin-top: 0; }
      .diagram-step strong { font-size: 13px; }
      .diagram-step small { font-size: 11px; }
      .flow-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 24px; }
      .flow-card { padding: 0 18px; grid-template-rows: 26px 40px auto; }
      .flow-card:nth-child(odd) { padding-left: 0; border-left: 0; }
      .flow-card:nth-child(even) { padding-right: 0; }
      .flow-card strong { font-size: 14px; }
      .flow-card p { font-size: 12px; }
      .active-info p { font-size: 13px; }
      .protocol-tab { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 9px 10px; }
      .protocol-tab strong { font-size: 11px; }
      .protocol-tab small { font-size: 9px; }
    }

    @media (max-width: 600px) {
      .protocol-tabs {
        grid-template-columns: repeat(8, minmax(84px, 1fr));
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
      }
    }

    @media (max-width: 420px) {
      .protocol-section { padding: 26px 16px; }
      .protocol-shell { padding: 25px 22px; }
      .active-info h2 { font-size: 28px; }
      .flow-card { padding-inline: 12px; grid-template-rows: 26px 56px auto; }
      .flow-card strong { font-size: 13px; }
      .flow-card p { font-size: 11px; }
      .source-rail { font-size: 11px; }
      .protocol-diagram { --node-size: 52px; }
      .diagram-tile { border-radius: 12px; margin-block: 6px 12px; }
      .diagram-icon { width: 34px; height: 34px; }
      .diagram-step strong { min-height: 30px; padding-inline: 3px; font-size: 10px; line-height: 1.4; }
      .diagram-step small { max-width: 12ch; font-size: 9px; }
      .diagram-arrow { width: 23px; height: 23px; box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 0.025); }
      .diagram-arrow svg { width: 13px; height: 13px; }
      .diagram-step::before { width: 90px; height: 90px; }
      .diagram-step::after { width: 125px; height: 125px; }
      .diagram-step:nth-child(2)::after { width: 150px; height: 150px; }
    }

    @media (prefers-reduced-motion: reduce) {
      .diagram-connector::after { animation: none; }
      .diagram-step::after {
        animation: none;
        opacity: 0.35;
        transform: translate(-50%, -50%);
      }

      .protocol-shell,
      .protocol-tab,
      .flow-card,
      .source-rail {
        transition-duration: 0.01ms;
      }

    }
