@layer reset, base, layout, components, responsive;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
  body,
  h1,
  h2,
  h3,
  p,
  pre {
    margin: 0;
  }
  button,
  a {
    -webkit-tap-highlight-color: transparent;
  }
  button {
    font: inherit;
    cursor: pointer;
  }
  button,
  input {
    color: inherit;
  }
}

@layer base {
  :root {
    color-scheme: light;
    --paper: #faf9f6;
    --ink: #272a2c;
    --muted: #62676b;
    --line: #deded8;
    --rust: #a83228;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-synthesis: none;
  }
  body {
    font-size: 15px;
    line-height: 1.65;
  }
  a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
  }
  a:hover {
    color: var(--rust);
  }
  :focus-visible {
    outline: 2px solid var(--rust);
    outline-offset: 5px;
  }
  ::selection {
    background: #f0d2ca;
    color: #332b27;
  }
  h1,
  h2,
  h3 {
    font-weight: 600;
  }
  h2 {
    font-size: 21px;
    line-height: 1.4;
    letter-spacing: -0.025em;
  }
  h3 {
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: -0.015em;
  }
  code {
    font-family: var(--mono);
  }
  [hidden] {
    display: none !important;
  }
}

@layer layout {
  .page-width {
    width: min(1040px, calc(100% - 96px));
    margin-inline: auto;
  }
  .site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 94px;
    border-bottom: 1px solid var(--line);
  }
  .site-header nav {
    display: flex;
    align-items: center;
    gap: 29px;
    font-size: 14px;
  }
  .site-header nav a {
    text-decoration: none;
  }
  .intro {
    padding: 67px 0 49px;
  }
  .intro h1 {
    margin-top: 19px;
    font-size: clamp(36px, 4.6vw, 53px);
    line-height: 1.14;
    letter-spacing: -0.046em;
    font-weight: 650;
  }
  .intro h1 span {
    color: var(--rust);
  }
  .intro-description {
    max-width: 660px;
    font-size: 18px;
    line-height: 1.7;
    color: #50565a;
    margin-top: 24px;
    text-wrap: pretty;
  }
  .intro-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 27px;
    margin-top: 27px;
    font-size: 14px;
  }
  .example {
    padding-bottom: 46px;
  }
  .section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
  }
  .section-heading > a,
  .section-note {
    font-size: 12px;
    color: var(--muted);
  }
  .section-heading > a {
    text-decoration: none;
  }
  .example-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    border: 1px solid #d6d8d5;
    border-radius: 4px;
    overflow: hidden;
  }
  .source-panel {
    order: 1;
    min-width: 0;
    background: #f0f2ef;
  }
  .preview-panel {
    order: 2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #fffefa;
    border-left: 1px solid #d6d8d5;
    padding: 0 22px 24px;
  }
  .model-section {
    padding: 36px 0 46px;
    border-top: 1px solid var(--line);
  }
  .concept-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px 65px;
    margin-top: 31px;
  }
  .concept-grid article {
    max-width: 460px;
  }
  .concept-grid p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
    margin-top: 9px;
  }
  .concept-grid a {
    display: inline-block;
    font-size: 13px;
    margin-top: 12px;
    text-decoration: none;
    color: var(--rust);
  }
  .getting-started {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 70px;
    padding: 40px 0 54px;
    border-top: 1px solid var(--line);
  }
  .getting-started p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--muted);
    margin-top: 14px;
  }
  .getting-started p a {
    color: var(--ink);
  }
  .site-footer {
    border-top: 1px solid var(--line);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 20px;
    padding-block: 25px 35px;
    color: var(--muted);
    font-size: 12px;
  }
  .site-footer p > span {
    padding-inline: 5px;
  }
  .site-footer a {
    text-decoration: none;
  }
}

@layer components {
  .skip-link {
    position: absolute;
    left: 20px;
    top: -100px;
    z-index: 5;
    padding: 10px 16px;
    background: var(--paper);
  }
  .skip-link:focus {
    top: 10px;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font: 600 19px/1 var(--mono);
    letter-spacing: -0.075em;
    text-decoration: none;
  }
  .brand-lockup {
    display: block;
    flex-shrink: 0;
    width: 126px;
    height: 41px;
    object-fit: contain;
  }
  .project-status {
    font: 11px/1.5 var(--mono);
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #6f846b;
    border-radius: 50%;
    flex-shrink: 0;
  }
  .primary-link {
    display: inline-flex;
    align-items: center;
    gap: 24px;
    background: var(--rust);
    color: #fff;
    text-decoration: none;
    padding: 9px 15px;
    border: 1px solid var(--rust);
    border-radius: 3px;
    font-weight: 500;
  }
  .primary-link:hover {
    color: #fff;
    background: #8d2a22;
  }
  .intro-links > a:last-child {
    text-decoration: none;
  }
  .intro-links > a:last-child span {
    margin-left: 4px;
  }
  .source-tabs {
    display: flex;
    align-items: stretch;
    gap: 0;
    height: 44px;
    background: #e9ece7;
    border-bottom: 1px solid #d6d8d5;
  }
  .source-tabs button {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-right: 1px solid #d6d8d5;
    border-bottom: 2px solid transparent;
    padding: 0 17px;
    background: transparent;
    font: 12px/1 var(--mono);
    color: var(--muted);
  }
  .source-tabs button[aria-pressed="true"] {
    background: #f0f2ef;
    color: var(--ink);
    border-bottom-color: var(--rust);
  }
  .source-tabs button:hover {
    color: var(--rust);
  }
  .source-tabs a {
    margin-left: auto;
    padding: 6px 16px;
    text-decoration: none;
    color: var(--muted);
    font-size: 17px;
  }
  .file-symbol {
    font-size: 10px;
    color: #9e4c33;
  }
  .html-symbol {
    color: #4d7463;
  }
  .source-panel pre {
    height: 350px;
    padding: 24px;
    overflow: auto;
    font: 12px/1.85 var(--mono);
    color: #364d42;
    tab-size: 2;
    scrollbar-width: thin;
    scrollbar-color: #adb6ac transparent;
  }
  .source-panel pre:focus-visible {
    outline-offset: -3px;
  }
  .preview-heading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    font: 10px/1.4 var(--mono);
    color: var(--muted);
  }
  .counter {
    width: 100%;
    padding-top: 21px;
    text-align: center;
  }
  .counter output {
    display: block;
    font: 400 62px/1.15 var(--mono);
    letter-spacing: -0.08em;
    font-variant-numeric: tabular-nums;
    color: #3a4a3e;
  }
  .counter-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 19px;
  }
  .counter button {
    padding: 7px 13px;
    font-size: 12px;
    background: #f0f2ed;
    border: 1px solid #c9d0c4;
    border-radius: 3px;
    transition: background 100ms;
  }
  .counter button:hover {
    background: #e4e9df;
  }
  .counter button:active {
    transform: translateY(1px);
  }
  .counter button + button {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
  }
  .counter-example > p {
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
    margin-top: 24px;
    text-align: center;
  }
  .example-note {
    font-size: 12px;
    line-height: 1.8;
    margin-top: 12px;
    max-width: 730px;
    color: var(--muted);
  }
  .install-command {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 21px;
    padding: 14px;
    border: 1px solid var(--line);
    background: #f0f0eb;
    border-radius: 3px;
  }
  .install-command code {
    font-size: 11px;
    line-height: 1.8;
    overflow-wrap: anywhere;
    user-select: all;
  }
  .install-command button {
    margin-left: auto;
    flex-shrink: 0;
    padding: 5px 0 5px 8px;
    border: 0;
    border-left: 1px solid #d0d3cc;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
  }
  .install-command button:hover {
    color: var(--rust);
  }
  .getting-started .setup-link {
    font-size: 13px;
  }
  .further-reading {
    border-left: 1px solid var(--line);
    padding-left: 28px;
  }
  .further-reading h3 {
    font-size: 14px;
    margin-bottom: 13px;
  }
  .further-reading a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    text-decoration: none;
    font-size: 12px;
  }
  .further-reading a span {
    color: var(--muted);
  }
  .noscript-note {
    max-width: 1040px;
    padding: 20px;
    margin: auto;
  }
}

@layer components {
  .example-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;
    border-bottom: 1px solid var(--line);
  }
  .example-switcher button {
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 10px 1px;
    font-size: 13px;
  }
  .example-switcher button[aria-pressed="true"] {
    border-bottom-color: var(--rust);
    color: var(--rust);
    font-weight: 600;
  }
  .example-switcher button:hover {
    color: var(--rust);
  }
  .example-description {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
    margin: 13px 0 18px;
    min-height: 22px;
  }
  .example-result {
    width: 100%;
    min-width: 0;
  }
  .syntax-token {
    font: inherit;
  }
  .preview-panel {
    padding-inline: 20px;
  }
  .search-demo label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    margin: 9px 0 7px;
  }
  .search-demo input,
  .keyed-rows input {
    width: 100%;
    min-width: 0;
    border: 1px solid #c9d0c4;
    border-radius: 3px;
    background: #fff;
    font: inherit;
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 10px;
  }
  .search-demo input::placeholder,
  .keyed-rows input::placeholder {
    color: #737873;
  }
  .search-results {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
  }
  .search-results li {
    border-bottom: 1px solid #e5e6e0;
  }
  .search-results a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    text-decoration: none;
  }
  .search-results strong {
    font-size: 12px;
    font-weight: 500;
  }
  .search-results a > span {
    color: var(--muted);
    font-size: 10px;
    text-align: right;
  }
  .result-count,
  .fixture-note {
    color: var(--muted);
    font: 10px/1.6 var(--mono);
    margin-top: 13px;
  }
  .empty-result {
    font-size: 12px;
    color: var(--muted);
    padding: 20px 0;
  }
  .demo-actions {
    display: flex;
    gap: 8px;
    margin: 13px 0 16px;
  }
  .demo-actions button {
    border: 1px solid #c9d0c4;
    background: #f0f2ed;
    border-radius: 3px;
    padding: 7px 10px;
    font-size: 11px;
  }
  .demo-actions button:hover {
    background: #e4e9df;
  }
  .demo-actions button[aria-pressed="true"] {
    background: #e5ebe1;
    border-color: #82917b;
    color: #354d39;
  }
  button:disabled {
    opacity: 0.5;
    cursor: default;
  }
  .keyed-rows {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 219px;
    overflow-y: auto;
  }
  .keyed-rows li {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
  }
  .row-id {
    font: 11px/1 var(--mono);
    color: var(--muted);
    width: 20px;
    flex-shrink: 0;
  }
  .keyed-rows input {
    padding: 7px 9px;
  }
  .keyed-rows button {
    flex-shrink: 0;
    border: 0;
    padding: 5px;
    background: transparent;
    font-size: 20px;
    color: var(--muted);
  }
  .keyed-rows button:hover {
    color: var(--rust);
  }
  .demo-instruction {
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
    margin-top: 19px;
  }
  .issue-result {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 17px 0;
    min-height: 143px;
  }
  .issue-result h3 {
    font: 11px/1.5 var(--mono);
    color: var(--muted);
    margin-bottom: 8px;
  }
  .issue-field[data-field="title"] {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
  }
  .issue-field[data-field="status"] {
    display: inline-block;
    font: 10px/1.5 var(--mono);
    border: 1px solid #ccd4c6;
    border-radius: 3px;
    color: #46583e;
    padding: 2px 6px;
    margin-top: 12px;
  }
  .issue-result[aria-busy="true"] {
    opacity: 0.55;
  }
}

@layer responsive {
  @media (max-width: 1000px) {
    .example-workspace {
      grid-template-columns: minmax(0, 1fr) 290px;
    }
    .source-panel pre {
      font-size: 11px;
      padding: 22px 18px;
    }
    .getting-started {
      grid-template-columns: minmax(0, 1fr) 220px;
      gap: 35px;
    }
    .install-command {
      align-items: flex-start;
    }
  }
  @media (max-width: 700px) {
    .page-width {
      width: calc(100% - 40px);
    }
    .site-header {
      min-height: 77px;
      gap: 16px;
    }
    .site-header nav {
      gap: 16px;
      font-size: 12px;
    }
    .brand {
      font-size: 17px;
      gap: 8px;
    }
    .brand-lockup {
      width: 112px;
      height: 37px;
    }
    .intro {
      padding: 40px 0 37px;
    }
    .intro h1 {
      font-size: clamp(34px, 6.1vw, 43px);
      letter-spacing: -0.04em;
    }
    .intro-description {
      font-size: 16px;
      line-height: 1.7;
      margin-top: 20px;
    }
    .intro-links {
      font-size: 13px;
      gap: 22px;
      margin-top: 23px;
    }
    .section-heading {
      gap: 12px;
      margin-bottom: 16px;
    }
    .section-heading h2 {
      font-size: 19px;
    }
    .section-heading > a {
      font-size: 11px;
    }
    .example-workspace {
      grid-template-columns: 1fr;
    }
    .source-tabs button {
      font-size: 11px;
      padding-inline: 14px;
    }
    .source-panel pre {
      height: 250px;
      font-size: 11px;
      padding: 18px 16px;
    }
    .preview-panel {
      order: 0;
      min-height: 340px;
      border-left: 0;
      border-top: 0;
      border-bottom: 1px solid #d6d8d5;
      padding: 0 20px 20px;
    }
    .preview-heading {
      height: 42px;
      font-size: 10px;
    }
    .counter {
      padding-top: 8px;
    }
    .counter output {
      font-size: 46px;
    }
    .counter-actions {
      margin-top: 12px;
    }
    .counter-example > p {
      margin-top: 14px;
    }
    .example-note {
      font-size: 11px;
    }
    .example {
      padding-bottom: 32px;
    }
    .model-section {
      padding: 30px 0;
    }
    .concept-grid {
      gap: 26px 30px;
      margin-top: 26px;
    }
    .concept-grid h3 {
      font-size: 15px;
    }
    .concept-grid p {
      font-size: 13px;
    }
    .concept-grid a {
      font-size: 12px;
    }
    .section-note {
      font-size: 11px;
    }
    .getting-started {
      display: block;
      padding: 31px 0;
    }
    .install-command {
      align-items: center;
    }
    .further-reading {
      border-left: 0;
      border-top: 1px solid var(--line);
      padding: 24px 0 0;
      margin-top: 27px;
    }
    .further-reading a {
      max-width: 340px;
      font-size: 13px;
    }
    .site-footer {
      flex-wrap: wrap;
      gap: 9px;
      font-size: 11px;
      padding-block: 22px 28px;
    }
  }
  @media (max-width: 440px) {
    .site-header {
      align-items: center;
    }
    .site-header nav {
      gap: 14px;
    }
    .site-header nav a:last-child > span {
      display: none;
    }
    .brand {
      font-size: 16px;
      gap: 7px;
    }
    .intro h1 {
      font-size: 35px;
    }
    .section-heading > a {
      max-width: 115px;
      text-align: right;
      line-height: 1.5;
    }
    .concept-grid {
      grid-template-columns: 1fr;
    }
    .preview-panel {
      padding: 16px;
      gap: 16px;
    }
    .source-tabs button {
      padding-inline: 12px;
      gap: 6px;
    }
  }
  @media (max-width: 360px) {
    .page-width {
      width: calc(100% - 32px);
    }
    .brand {
      font-size: 15px;
      gap: 6px;
    }
    .site-header {
      gap: 10px;
    }
    .site-header nav {
      gap: 10px;
    }
    .intro h1 {
      font-size: 31px;
    }
    .intro-links {
      gap: 17px;
      font-size: 12px;
    }
    .source-tabs button {
      padding-inline: 9px;
    }
    .preview-panel {
      column-gap: 8px;
    }
    .preview-heading {
      font-size: 8px;
      gap: 5px;
    }
    .counter {
      min-width: 125px;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      transition: none !important;
      animation: none !important;
    }
  }
}

@layer responsive {
  @media (max-width: 700px) {
    .example-description {
      font-size: 12px;
      min-height: 40px;
    }
    .example-switcher {
      gap: 4px 20px;
    }
    .example-switcher button {
      font-size: 12px;
    }
    .example-result {
      max-width: 450px;
      margin-inline: auto;
    }
    .search-demo input,
    .keyed-rows input {
      font-size: 16px;
    }
    .search-results strong {
      font-size: 13px;
    }
    .search-results a > span {
      font-size: 11px;
    }
    .keyed-rows {
      max-height: 238px;
    }
  }
  @media (max-width: 360px) {
    .example-switcher {
      gap: 4px 16px;
    }
    .example-switcher button {
      font-size: 11px;
    }
  }
}
