/* Help guides (/docs): loaded only on those pages, on top of site.css and in the same layer,
   so they share its colours, type scale, header, footer and light and dark themes. */
@layer site {
  .docs-page { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: clamp(32px, 4vw, 72px); align-items: start; padding-block: calc(var(--nav-h) + 72px) var(--section); }

  /* the list of guides */
  /* the list scrolls on its own; the 12px padding on the left keeps the highlighted item's rounded corners inside it */
  .docs-sticky { position: sticky; top: calc(var(--nav-h) + 40px); max-height: calc(100dvh - var(--nav-h) - 64px); overflow-y: auto; overscroll-behavior: contain; margin-left: -12px; padding: 2px 8px 2px 12px; }
  .docs-picker { display: none; }
  .docs-nav { display: grid; gap: 26px; font-size: .94rem; }
  .docs-nav a { position: relative; display: block; padding: 6px 12px; margin-left: -12px; border-radius: 10px; color: var(--muted); text-decoration: none; line-height: 1.35; transition: background-color .2s, color .2s; }
  .docs-nav a:hover { color: var(--ink); background: var(--surface-2); }
  .docs-nav a.on { color: var(--ink); background: var(--surface); box-shadow: 0 1px 0 var(--line); font-weight: 600; }
  .docs-nav a.on::before { content: ""; position: absolute; left: 4px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--yellow); }
  .docs-nav .home { font-weight: 600; color: var(--ink); }
  .docs-group p { margin: 0 0 6px; color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
  .docs-group ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }

  /* the article */
  .docs-article { max-width: 76ch; min-width: 0; }
  .crumbs { display: flex; gap: 10px; margin-bottom: 18px; color: var(--muted); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
  .crumbs a { color: inherit; }
  .docs-article h1 { margin: 0; font-size: var(--s3); font-weight: 600; font-stretch: 85%; line-height: 1.02; letter-spacing: -.035em; text-wrap: balance; }
  .docs-article .lead { margin: 20px 0 36px; color: var(--muted); font-size: var(--s1); line-height: 1.5; text-wrap: pretty; }
  .docs-article h2 { position: relative; margin: 56px 0 14px; font-size: var(--s2); font-weight: 600; letter-spacing: -.02em; line-height: 1.15; scroll-margin-top: calc(var(--nav-h) + 24px); }
  .docs-article h3 { margin: 32px 0 8px; font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; scroll-margin-top: calc(var(--nav-h) + 24px); }
  .docs-article p, .docs-article li { line-height: 1.7; text-wrap: pretty; }
  .docs-article ul { padding-left: 1.2em; }
  .docs-article li + li { margin-top: 4px; }
  .docs-article a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
  .docs-article a:hover { text-decoration-thickness: 2px; }
  .docs-article .anchor { margin-left: 10px; color: var(--muted); text-decoration: none; font-weight: 400; opacity: 0; transition: opacity .2s; }
  .docs-article h2:hover .anchor, .docs-article .anchor:focus-visible { opacity: 1; }
  .docs-article kbd { padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: var(--surface); font: .85em var(--mono); }
  .ui { padding: 1px 5px; border-radius: 7px; background: var(--surface-2); font-weight: 600; font-size: .95em; white-space: nowrap; }

  /* numbered steps */
  .d-steps { counter-reset: step; list-style: none; margin: 24px 0; padding: 0; display: grid; gap: 22px; }
  .d-steps > li { counter-increment: step; position: relative; padding-left: 52px; margin: 0; }
  .d-steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: var(--on-yellow); font: 600 .95rem/1 var(--mono); }
  .d-steps > li > :last-child { margin-bottom: 0; }
  .d-step-title { margin: 0 0 4px; font-weight: 600; }
  .d-steps .shot { margin-top: 14px; }

  /* screenshots */
  .shot { margin: 28px 0; }
  .shot a { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); cursor: zoom-in; }
  .shot img { display: block; width: 100%; height: auto; }
  .shot figcaption { margin-top: 10px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
  .shot.tall { max-width: 300px; }
  .shot.tall a { border-radius: 28px; }
  .shot-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
  .shot-pair .shot { margin: 12px 0; }
  .shot-pair .shot.tall { max-width: none; }

  /* callouts and plan chips */
  .callout { margin: 24px 0; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
  .callout.plan { border-left: 4px solid var(--yellow); }
  .callout.warn { border-left: 4px solid #e8590c; }
  .callout-title { margin: 0 0 4px; font-weight: 600; }
  .callout p { margin: 0; }
  .callout p + p, .callout p + ul, .callout ul + p { margin-top: 8px; }
  .d-plan { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 99px; font: 600 .68rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; vertical-align: .15em; }
  .d-plan.pro { background: var(--yellow); color: var(--on-yellow); }
  .d-plan.plus { background: var(--ink); color: var(--bg); }

  /* reference tables */
  .d-table { margin: 22px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
  .d-table:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  .d-table table { width: 100%; border-collapse: collapse; font-size: .92rem; }
  .d-table th, .d-table td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.5; }
  .d-table tr:last-child > * { border-bottom: 0; }
  .d-table thead th { color: var(--muted); font: 500 .72rem/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; }
  .d-table tbody th { font-weight: 600; min-width: 9em; }

  /* overview */
  .docs-start { margin: 8px 0 12px; padding: clamp(20px, 3vw, 32px); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
  .docs-start h2 { margin-top: 0; }
  .docs-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0 8px; padding: 0; list-style: none; }
  .docs-cards li { margin: 0; }
  .docs-cards a { display: grid; gap: 6px; height: 100%; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); text-decoration: none; transition: border-color .2s, transform .4s var(--ease-out); }
  .docs-cards a:hover { border-color: var(--ink); transform: translateY(-2px); }
  .docs-cards b { font-size: 1.02rem; }
  .docs-cards span { color: var(--muted); font-size: .9rem; line-height: 1.5; }

  /* previous / next and help */
  .prev-next { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 64px; }
  .prev-next a { display: grid; gap: 4px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; font-weight: 600; transition: border-color .2s; }
  .prev-next a:hover { border-color: var(--ink); }
  .prev-next .next { grid-column: 2; text-align: right; }
  .prev-next .mono { color: var(--muted); font-size: .72rem; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; }
  .help-card { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: center; justify-content: space-between; margin-top: 28px; padding: 22px 24px; border-radius: 20px; background: var(--surface-2); }
  .help-card p { margin: 0; color: var(--muted); max-width: 52ch; }
  .help-card .help-title { margin-bottom: 4px; color: var(--ink); font-weight: 600; }
  .help-card .btn { text-decoration: none; }

  @media (max-width: 960px) {
    .docs-page { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: calc(var(--nav-h) + 40px); }
    .docs-sticky { display: none; }
    .docs-picker { display: block; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
    .docs-picker summary { padding: 14px 18px; font-weight: 600; cursor: pointer; list-style-position: inside; }
    .docs-picker .docs-nav { padding: 4px 18px 18px 30px; }
  }
  @media (max-width: 640px) {
    .shot-pair, .docs-cards, .prev-next { grid-template-columns: minmax(0, 1fr); }
    .prev-next .next { grid-column: 1; text-align: left; }
    .shot a { border-radius: 12px; }
    .d-steps > li { padding-left: 44px; }
    .d-steps > li::before { width: 30px; height: 30px; }
    .help-card .btn { width: 100%; }
    /* long menu paths (Archivo › Descargar › …) wrap on phones instead of running off the screen */
    .ui { white-space: normal; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
  }
  @media (prefers-reduced-motion: reduce) {
    .docs-cards a, .docs-nav a, .prev-next a { transition: none; }
    .docs-cards a:hover { transform: none; }
  }
}

/* Public size chart pages (/size-charts) */
@layer site {
  .size-charts-page { padding-block: calc(var(--nav-h) + 72px) var(--section); }
  .size-charts-page .docs-cards { margin-top: 18px; padding-left: 0; list-style: none; }
  .d-table caption { padding: 12px 14px; text-align: left; color: var(--muted); font-size: .9rem; }
  .size-charts-page .last-updated { margin-top: 48px; color: var(--muted); font-size: .85rem; }
}

/* Size chart generator (/size-chart-generator) */
@layer site {
  .gen-controls { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: end; margin: 24px 0 16px; }
  .gen-controls > label { display: grid; flex: 1 1 260px; gap: 6px; min-width: 0; max-width: 460px; font-weight: 600; }
  .gen-controls select { width: 100%; max-width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; font-weight: 400; }
  .gen-units { display: flex; gap: 14px; margin: 0; padding: 0; border: 0; }
  .gen-units legend { padding: 0; margin-bottom: 6px; font-weight: 600; }
  .gen-units label { display: flex; gap: 6px; align-items: center; font-weight: 400; }
  .gen-table input { width: 100%; min-width: 72px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: inherit; font: inherit; }
  .gen-table thead input { font: 600 .92rem/1.4 var(--sans); letter-spacing: 0; text-transform: none; color: var(--ink); }
  .gen-table th small { display: block; margin-top: 4px; color: var(--muted); font-weight: 400; text-transform: none; }
  .gen-remove { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
  .gen-remove:hover { background: var(--line); }
  .gen-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 28px; }
}
