/* Growth idea 13: embeddable grade cards (embed/<slug>.html, standalone, no site.css),
   the "Embed a grade card" builder (embed/index.html) and the Retailer API page (api/index.html). */

/* ---------- the card (standalone page shown in an iframe) ---------- */
html.gc-html {
  --paper: #FFFDF6; --ink: #1B3028; --muted: #48594E; --line: #D6D2C1; --tint: #F3EEE2;
  --brass: #8C613B;
  --g-a: #214539; --g-b: #4C6253; --g-c: #9A5C46; --g-d: #7E7A6C;
  --s-low: #2F6A4E; --s-moderate: #9A6A2C; --s-high: #A8443A;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  html.gc-html:not([data-theme="light"]) {
    --paper: #152019; --ink: #EEE8DA; --muted: #A9AD9C; --line: #2F3E35; --tint: #1B2820;
    --brass: #E8C693;
    --g-a: #8FC9A6; --g-b: #B9C79A; --g-c: #E2A88F; --g-d: #ABA799;
    --s-low: #8FC9A6; --s-moderate: #E8C693; --s-high: #EF8F84;
    color-scheme: dark;
  }
}
html.gc-html[data-theme="dark"] {
  --paper: #152019; --ink: #EEE8DA; --muted: #A9AD9C; --line: #2F3E35; --tint: #1B2820;
  --brass: #E8C693;
  --g-a: #8FC9A6; --g-b: #B9C79A; --g-c: #E2A88F; --g-d: #ABA799;
  --s-low: #8FC9A6; --s-moderate: #E8C693; --s-high: #EF8F84;
  color-scheme: dark;
}
html.gc-html { background: var(--paper); color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.gc-body { margin: 0; font: 400 14px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
/* the frame is drawn around the iframe's viewport, so it stays whole whatever height the host page gives */
.gc-body::after { content: ""; position: fixed; inset: 0; border: 1px solid var(--line); pointer-events: none; }
.gc-card { box-sizing: border-box; padding: 12px 14px 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.gc-card p, .gc-card h1, .gc-card ul { margin: 0; }
.gc-card a { color: inherit; }
.gc-kicker { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.gc-rosette { width: 14px; height: 14px; color: var(--brass); flex: none; }
.gc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.gc-id { min-width: 0; }
.gc-name { font: 400 21px/1.15 Georgia, 'Times New Roman', serif; overflow-wrap: anywhere; }
.gc-name a { text-decoration: none; }
.gc-name a:hover, .gc-name a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.gc-latin { font: italic 13px/1.3 Georgia, 'Times New Roman', serif; color: var(--muted); margin-top: 2px !important; overflow-wrap: anywhere; }
.gc-grade { flex: none; display: grid; justify-items: center; gap: 4px; max-width: 96px; text-align: center; font-size: 9.5px; line-height: 1.2; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.gc-grade b { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid currentColor; box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px currentColor; font: italic 500 21px/1 Georgia, serif; letter-spacing: 0; color: var(--g-d); }
.gc-grade[data-g="A"] b { color: var(--g-a); } .gc-grade[data-g="B"] b { color: var(--g-b); } .gc-grade[data-g="C"] b { color: var(--g-c); }
.gc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.gc-h { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px !important; }
.gc-uses ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.gc-uses li { display: flex; align-items: center; gap: 5px; font-size: 12.5px; min-width: 0; }
.gc-uses li b { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid currentColor; font: italic 500 12px/1 Georgia, serif; color: var(--g-d); }
.gc-uses li b[data-g="A"] { color: var(--g-a); } .gc-uses li b[data-g="B"] { color: var(--g-b); } .gc-uses li b[data-g="C"] { color: var(--g-c); }
.gc-safety { font-size: 12px; line-height: 1.4; padding: 5px 9px; background: var(--tint); border-left: 3px solid var(--s-low); }
.gc-safety[data-s="moderate"] { border-left-color: var(--s-moderate); } .gc-safety[data-s="high"] { border-left-color: var(--s-high); }
.gc-s { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--s-low); margin-right: 2px; }
.gc-safety[data-s="moderate"] .gc-s { color: var(--s-moderate); } .gc-safety[data-s="high"] .gc-s { color: var(--s-high); }
.gc-foot { border-top: 1px solid var(--line); padding-top: 7px; font-size: 12px; }
.gc-foot a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; text-decoration: none; }
.gc-foot a > span:first-child { font-weight: 600; }
.gc-more { color: var(--brass); }
.gc-foot a:hover .gc-more, .gc-foot a:focus-visible .gc-more { text-decoration: underline; text-underline-offset: 3px; }
.gc-card a:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
/* narrow embeds (about 340 px and less): the footer already names the source, so the kicker line goes */
@media (max-width: 340px) { .gc-kicker { display: none; } }

/* ---------- builder: embed/index.html ---------- */
.gcb-form { grid-template-columns: minmax(0, 1fr); }
.gcb-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 18px 24px; }
.gcb-controls select { width: 100%; }
.gcb-h { font: 500 .6rem var(--ui); text-transform: uppercase; letter-spacing: .22em; color: var(--muted); margin: 0 0 10px; }
.gcb-stage { padding: clamp(14px, 3vw, 28px); background: var(--bg); border: 1px dashed var(--line-strong); overflow: hidden; }
.gcb-stage iframe { display: block; margin: 0 auto; border: 0; max-width: 100%; background: transparent; }
.gcb-code textarea { font: 400 .82rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; min-height: 8.5em; }
.gcb-about { margin-top: clamp(40px, 6vw, 72px); }

/* ---------- Retailer API: api/index.html ---------- */
.gca { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.gca .prose h2 { margin-top: 1.4em; }
.gca-note { padding: 18px 22px; background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--brass); }
.gca-note p { margin: 0; }
.gca-code { margin: 0; max-width: 100%; max-height: 460px; overflow: auto; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); font: 400 .8rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--ink); tab-size: 2; }
.gca code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; overflow-wrap: anywhere; }
.gca-code code { font-size: inherit; overflow-wrap: normal; white-space: pre; }
.gca-plans { margin-block: 6px; }
.gca-plans .out-card { margin: 0; }
.gca-plans h3 { margin: .2em 0 .4em; }
.gca-request { margin-top: clamp(40px, 6vw, 72px); }
.gca-form { grid-template-columns: minmax(0, 1fr); }
.gca-form h2 { margin: .2em 0 .3em; }
.gca-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 18px 24px; }
.gca-fields input, .gca-fields select { width: 100%; }
.gca-wide { grid-column: 1 / -1; }
.gca-form .form-note { color: var(--muted); }

/* phones: give the preview the full column so the card shows at a real embed width */
@media (max-width: 560px) {
  .gcb-form { padding: 18px 16px; }
  .gcb-stage { padding: 0; border: 0; background: none; }
}
.gca td code { white-space: nowrap; overflow-wrap: normal; }
/* authors after the Latin name stay upright */
span.rom.rom { font: inherit; font-style: normal; color: inherit; }

/* Grade seals (25 Nov 2026): the same seal as on the site (site.css, "Grade seals"): tinted disc with a fine inner
   rule (a real 1px border), letter upright, and a ring of four arcs cut by an SVG mask, so every line is sharp, that
   fills one arc per grade step (A four, B three, C two, D one). Sizes are whole pixels so the lines sit on the pixel grid. */
[data-g="A"] { --gn: 4; } [data-g="B"] { --gn: 3; } [data-g="C"] { --gn: 2; } [data-g="D"] { --gn: 1; }
.gc-grade b, .gc-uses li b { position: relative; isolation: isolate; border: 0; box-shadow: none; background: none; font-style: normal; font-weight: 400; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gc-uses li b { width: 22px; height: 22px; }
.gc-grade b::before, .gc-uses li b::before, .gc-grade b::after, .gc-uses li b::after { content: ''; position: absolute; z-index: -1; border-radius: 50%; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gc-grade b::before, .gc-uses li b::before {
  inset: 0;
  background: conic-gradient(from 225deg, currentColor calc(var(--gn, 4) * 90deg), color-mix(in srgb, currentColor 38%, transparent) 0);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M78.95 85.75A46 46 0 0 1 21.05 85.75M14.25 78.95A46 46 0 0 1 14.25 21.05M21.05 14.25A46 46 0 0 1 78.95 14.25M85.75 21.05A46 46 0 0 1 85.75 78.95' fill='none' stroke='%23000' stroke-width='8'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M78.95 85.75A46 46 0 0 1 21.05 85.75M14.25 78.95A46 46 0 0 1 14.25 21.05M21.05 14.25A46 46 0 0 1 78.95 14.25M85.75 21.05A46 46 0 0 1 85.75 78.95' fill='none' stroke='%23000' stroke-width='8'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.gc-grade b::after { inset: 5px; border: 1px solid color-mix(in srgb, currentColor 55%, transparent); background: color-mix(in srgb, currentColor 16%, transparent); }
.gc-uses li b::after { inset: 2px; background: color-mix(in srgb, currentColor 16%, transparent); }
