/* Guide pages template (A11 design, Penpot ChemAI_Guides page Guides). Loaded after css/home.css. sg- prefix. */

.sg { --sg-line: #1e3a5f; --sg-body: #cbd5e1; --sg-red: 239, 68, 68; }
.sg h3 { margin: 0; color: #fff; }
.sg button { min-height: 0; } /* main.css gives every button min-height 44px */
.sg :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.sg .hm-eyebrow.hm-bl, .sg .hm-eyebrow.hm-vi, .sg .hm-eyebrow.hm-am, .sg-kicker { color: var(--c, #10b981); }
.sg code { font-family: var(--hm-mono); }
.sg sub, .sg sup { font-size: .7em; line-height: 0; }
.sg-kicker { margin: 0; font: 500 11px/1.3 var(--hm-mono); letter-spacing: 1.5px; text-transform: uppercase; }
.sg-red { --a: var(--sg-red); --c: #ef4444; }
.sg svg[viewBox] { display: block; max-width: 100%; height: auto; } /* natural size from width/height attrs */

/* ---------- Hero ---------- */
.sg-hero { padding: 48px 0 56px; }
.sg-hero__grid { display: grid; grid-template-columns: minmax(0, 620px) minmax(0, 520px); justify-content: space-between; gap: 40px; align-items: center; }
.sg-hero__copy { display: flex; flex-direction: column; gap: 18px; }
.sg-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--sg-body); }
.sg-crumbs li + li::before { content: "›"; margin-right: 6px; color: var(--hm-muted); }
.sg-crumbs a { color: var(--sg-body); }
.sg-crumbs a:hover { color: #10b981; }
.sg-hero h1 { margin: 0; font-size: 46px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; color: #fff; text-align: left; background: none; -webkit-text-fill-color: currentColor; }
.sg-lead { font-size: 18px; line-height: 1.55; color: var(--hm-muted); }
.sg-lead code { color: var(--hm-text); }
.sg-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.sg-chips li {
    display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px;
    border: 1px solid rgba(var(--a), .45); border-radius: 999px; background: var(--hm-section);
    font-size: 14px; font-weight: 500; line-height: 1.3; color: var(--hm-text);
}
.sg-chips .hm-i { color: var(--c); }
.sg-hero__art { margin: 0; }

/* ---------- Section heads: text left, art right ---------- */
.sg-sec { padding-bottom: 72px; scroll-margin-top: 80px; }
.sg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; margin-bottom: 28px; }
.sg-head__text { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.sg-head h2 { font-size: 32px; }
.sg-sub { font-size: 16px; line-height: 1.5; color: var(--hm-muted); }
.sg-head__art { flex: 0 1 auto; min-width: 0; pointer-events: none; }

/* ---------- Rule cards ---------- */
.sg-rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 0; padding: 0; list-style: none; }
.sg-rule {
    position: relative; display: flex; flex-direction: column; gap: 10px; padding: 24px 20px 20px; overflow: hidden;
    border: 1px solid rgba(var(--a), .3); border-radius: 12px; background: var(--hm-section);
}
.sg-rule::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c); }
.sg-rule__art { margin: 4px 0 6px; }
.sg-rule h3 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.sg-rule > p:not([class]) { font-size: 14px; line-height: 1.55; color: var(--hm-muted); }
.sg-rule > p code { color: var(--hm-text); }
.sg-value { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--sg-body); }
.sg-value code { font-size: 22px; font-weight: 700; color: #fff; }
.sg-link { font: 700 18px/1.3 var(--hm-mono); color: var(--c); }
.sg-link:hover { text-decoration: underline; }
.sg-mini { width: 100%; margin-top: auto; border-collapse: collapse; border-radius: 8px; overflow: hidden; background: var(--hm-navy); }
.sg-mini td { padding: 5px 12px; font-size: 13px; line-height: 1.4; color: var(--hm-muted); text-align: right; }
.sg-mini td:first-child { padding-right: 4px; text-align: left; color: var(--hm-text); white-space: nowrap; }
.sg-mini code { font-size: 12px; }
.sg-mini td:last-child { white-space: nowrap; }
.sg-mini tr:first-child td { padding-top: 10px; }
.sg-mini tr:last-child td { padding-bottom: 10px; }

/* ---------- Worked example ---------- */
.sg-work { display: grid; grid-template-columns: minmax(0, 760px) minmax(0, 416px); justify-content: space-between; gap: 24px; }
.sg-steps { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.sg-steps li {
    display: flex; align-items: center; gap: 18px; min-height: 80px; padding: 14px 20px;
    border: 1px solid var(--hm-surface); border-radius: 12px; background: var(--hm-section);
}
.sg-num {
    display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid rgba(var(--a), .6); background: rgba(var(--a), .15); color: var(--c); font: 500 15px var(--hm-mono);
}
.sg-steps h3 { font-size: 15px; font-weight: 600; line-height: 1.4; }
.sg-steps code { display: block; margin-top: 4px; font-size: 14px; color: var(--c); overflow-wrap: anywhere; }
.sg-steps__check code { color: #fff; }
.sg-check {
    display: flex; flex-direction: column; gap: 14px; padding: 24px;
    border: 1px solid rgba(var(--a), .4); border-radius: 16px;
    background: linear-gradient(160deg, rgba(var(--a), .18), rgba(var(--a), 0) 70%) var(--hm-section);
}
.sg-check__art { margin-bottom: 8px; }
.sg-check h3 { font-size: 22px; font-weight: 700; line-height: 1.25; }
.sg-vars { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.sg-vars div { display: flex; align-items: baseline; gap: 16px; }
.sg-vars dt { width: 52px; flex: none; font: 600 13px var(--hm-mono); color: var(--c); }
.sg-vars dd { margin: 0; font-size: 14px; color: var(--sg-body); }
.sg-vars__key dt { width: auto; color: #a78bfa; }
.sg-vars__key dd code { font-size: 12px; color: #10b981; overflow-wrap: anywhere; }
.sg-check > p:not([class]) { font-size: 13px; line-height: 1.55; color: var(--hm-muted); }
.sg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
    border-radius: 8px; background: #10b981; color: var(--hm-navy) !important; font-size: 15px; font-weight: 600; white-space: nowrap;
    transition: background-color .2s, transform .2s;
}
.sg-btn:hover { background: #0ea371; transform: translateY(-1px); }
.sg-check .sg-btn { margin-top: auto; }

/* ---------- Reference table + organic subset ---------- */
.sg-ref { display: grid; grid-template-columns: minmax(0, 760px) minmax(0, 416px); justify-content: space-between; gap: 24px; align-items: start; }
.sg-table { width: 100%; padding: 8px; border: 1px solid var(--sg-line); border-radius: 12px; background: var(--hm-section); border-collapse: separate; border-spacing: 0 0; }
.sg-table tr:nth-child(odd) td, .sg-table tr:nth-child(odd) th { background: #0f2340; }
.sg-table td, .sg-table th { height: 42px; padding: 0 12px; font-size: 14px; font-weight: 400; text-align: left; color: var(--sg-body); }
.sg-table td:first-child { width: 118px; border-radius: 8px 0 0 8px; }
.sg-table td:last-child { width: 44%; border-radius: 0 8px 8px 0; }
.sg-sym {
    display: inline-block; min-width: 92px; padding: 2px 6px; border: 1px solid rgba(var(--a), .45); border-radius: 6px;
    background: rgba(var(--a), .16); font: 700 14px/1.3 var(--hm-mono); letter-spacing: 2px; color: var(--c); white-space: nowrap;
}
.sg-table a code { font-size: 14px; color: #fff; }
.sg-table a:hover code { color: #10b981; text-decoration: underline; }
.sg-subset {
    display: flex; flex-direction: column; gap: 16px; padding: 22px;
    border: 1px solid rgba(var(--a), .35); border-radius: 16px;
    background: linear-gradient(160deg, rgba(var(--a), .1), rgba(var(--a), 0) 70%) var(--hm-section);
}
.sg-elements { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sg-elements li {
    display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border: 1px solid rgba(var(--a), .55);
    border-radius: 8px; background: var(--hm-navy); text-align: center;
}
.sg-elements small { font: 500 10px var(--hm-mono); color: var(--hm-muted); }
.sg-elements b { font-size: 20px; font-weight: 700; line-height: 1.2; color: #fff; }
.sg-elements span { font: 500 10px/1.4 var(--hm-mono); color: var(--c); white-space: nowrap; }
.sg-subset > p:not([class]) { font-size: 13px; line-height: 1.55; color: var(--hm-muted); }

/* ---------- Mistakes ---------- */
.sg-mistakes { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 0; padding: 0; list-style: none; }
.sg-mistake { display: flex; gap: 18px; padding: 20px; border: 1px solid var(--hm-surface); border-radius: 12px; background: var(--hm-section); }
.sg-tile {
    display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 10px;
    border: 1px solid rgba(var(--a), .5); background: rgba(var(--a), .16); color: var(--c); font: 600 16px var(--hm-mono);
}
.sg-mistake > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sg-mistake h3 { font: 700 19px/1.3 var(--hm-mono); word-spacing: 6px; }
.sg-mistake h3 code { word-spacing: 0; }
.sg-mistake > div > p:not([class]) { font-size: 14px; line-height: 1.55; color: var(--hm-muted); }
.sg-verdicts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.sg-verdicts li { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 6px; font: 500 12px/1.3 var(--hm-mono); color: var(--sg-body); }
.sg-verdicts li::before { font-weight: 700; }
.sg-bad { border: 1px solid rgba(var(--sg-red), .45); background: rgba(var(--sg-red), .12); }
.sg-bad::before { content: "✗"; color: #ef4444; }
.sg-good { border: 1px solid rgba(16, 185, 129, .45); background: rgba(16, 185, 129, .12); }
.sg-good::before { content: "✓"; color: #10b981; }

/* ---------- FAQ ---------- */
.sg-faq { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.sg-faq details { padding: 18px 20px; border: 1px solid var(--hm-surface); border-radius: 12px; background: var(--hm-section); transition: border-color .2s; }
.sg-faq details[open] { border-color: rgba(245, 158, 11, .55); }
.sg-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 16px; font-weight: 600; color: #fff; cursor: pointer; list-style: none; }
.sg-faq summary::-webkit-details-marker { display: none; }
.sg-faq summary::after {
    content: ""; width: 8px; height: 8px; flex: none; border-right: 1.5px solid var(--hm-muted); border-bottom: 1.5px solid var(--hm-muted);
    transform: translateY(-3px) rotate(45deg); transition: transform .2s;
}
.sg-faq details[open] summary::after { border-color: #f59e0b; transform: translateY(2px) rotate(-135deg); }
.sg-faq details p { margin-top: 12px; font-size: 14px; line-height: 1.6; color: var(--hm-muted); }

/* ---------- References + review ---------- */
.sg-refs { display: grid; grid-template-columns: minmax(0, 776px) minmax(0, 400px); justify-content: space-between; gap: 24px; }
.sg-sources { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 24px; list-style: none; border: 1px solid var(--hm-surface); border-radius: 12px; background: var(--hm-section); }
.sg-sources li { display: flex; gap: 14px; align-items: flex-start; }
.sg-n {
    display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 7px;
    border: 1px solid rgba(var(--a), .5); background: rgba(var(--a), .16); color: var(--c); font: 600 13px var(--hm-mono);
}
.sg-sources div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sg-sources cite { font-size: 15px; font-style: normal; font-weight: 600; color: #fff; }
.sg-sources a { font: 400 12px/1.5 var(--hm-mono); color: var(--hm-muted); overflow-wrap: anywhere; }
.sg-sources a:hover { color: #10b981; text-decoration: underline; }
.sg-review {
    display: flex; flex-direction: column; gap: 10px; padding: 24px;
    border: 1px solid rgba(var(--a), .35); border-radius: 16px;
    background: linear-gradient(160deg, rgba(var(--a), .1), rgba(var(--a), 0) 70%) var(--hm-section);
}
.sg-review__art { margin-bottom: 6px; }
.sg-review h3 { font-size: 20px; font-weight: 700; }
.sg-review > p:not([class]) { font-size: 14px; line-height: 1.6; color: var(--hm-muted); }
.sg-review__mail { font: 500 13px var(--hm-mono); color: #10b981; }
.sg-review__mail a { color: #10b981; }
.sg-review__mail a:hover { text-decoration: underline; }

/* ---------- Related: tool cards (home.css .hm-tool) + Chemistry AI band ---------- */
.sg .hm-strip b { font-family: var(--hm-mono); font-size: 13px; }
.sg-promo {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) 150px auto; align-items: center; gap: 24px; margin-top: 24px; padding: 12px 32px;
    border: 1px solid rgba(139, 92, 246, .45); border-radius: 12px;
    background: linear-gradient(120deg, rgba(139, 92, 246, .32), rgba(59, 130, 246, .2)) var(--hm-section);
}
.sg-promo__icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 12px; border: 1px solid rgba(139, 92, 246, .35); background: var(--hm-navy); color: #e2e8f0; }
.sg-promo__icon .hm-i { width: 28px; height: 28px; }
.sg-promo .hm-mono { color: #a78bfa; }
.sg-promo__text { max-width: 440px; font-size: 20px; font-weight: 600; line-height: 1.3; color: #fff; }

/* ---------- Footer bottom row (A11 design) ---------- */
.sg-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.sg-foot ul { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; }
.sg-foot a, .sg-foot .ca-choices { padding: 0; border: 0; background: none; font: 400 13px Inter, sans-serif; color: var(--hm-muted); cursor: pointer; }
.sg-foot a:hover, .sg-foot .ca-choices:hover { color: #fff; }

/* ---------- Narrower screens ---------- */
@media (max-width: 1180px) {
    .sg-hero__grid { grid-template-columns: 1fr; }
    .sg-hero__art { max-width: 520px; }
    .sg-rules { grid-template-columns: repeat(2, 1fr); }
    .sg-work, .sg-ref, .sg-refs { grid-template-columns: 1fr; }
    .sg-promo { grid-template-columns: auto minmax(0, 1fr) auto; }
    .sg-promo .hm-mono, .sg-promo__art { display: none; }
}

/* 375 design: 16 px gutters, one column, head art under the heading */
@media (max-width: 760px) {
    .sg .hm-wrap { padding: 0 16px; }
    .sg-hero { padding: 24px 0 40px; }
    .sg-hero h1 { font-size: 32px; }
    .sg-lead { font-size: 16px; }
    .sg-chips li { font-size: 13px; }
    .sg-sec { padding-bottom: 48px; }
    .sg-head { flex-direction: column; gap: 16px; margin-bottom: 20px; }
    .sg-head h2 { font-size: 26px; }
    .sg-head__art { flex: none; width: 100%; max-width: 340px; }
    .sg-rules, .sg-mistakes, .sg-faq { grid-template-columns: 1fr; gap: 14px; }
    .sg-steps li { gap: 14px; padding: 14px 16px; }
    .sg-check, .sg-subset, .sg-review, .sg-sources { padding: 18px; }
    .sg-table td:first-child { width: 96px; padding-right: 4px; }
    .sg-sym { min-width: 0; letter-spacing: 1px; }
    .sg-table tr { display: grid; grid-template-columns: 96px minmax(0, 1fr); }
    .sg-table th { display: flex; align-items: center; border-radius: 0 8px 0 0; }
    .sg-table td:last-child { grid-column: 2; width: auto; height: 32px; border-radius: 0 0 8px 0; }
    .sg-table td:first-child { grid-row: span 2; display: flex; align-items: center; }
    .sg-mistake { flex-direction: column; gap: 12px; padding: 16px; }
    .sg-mistake h3 { font-size: 16px; word-spacing: 2px; }
    .sg-promo { grid-template-columns: 1fr; gap: 14px; padding: 20px; }
    .sg-promo__icon { width: 56px; height: 56px; }
    .sg-promo__text { font-size: 18px; }
    .sg-promo .sg-btn { justify-self: start; }
    .sg-foot { flex-direction: column; align-items: flex-start; }
}

/* ---------- IR guide additions (A11 / ir guide boards, Penpot ChemAI_Guides page IR guide) ---------- */
.ir-sky { --a: 56, 189, 248; --c: #38bdf8; }
.ir sup { font-size: .65em; line-height: 0; vertical-align: super; }
.ir .sg-mini td:first-child { font: 600 12px var(--hm-mono); }
.ir .sg-mini td { font-size: 12px; }
.ir-spec { margin: 0 0 24px; }
.ir-spec__full { display: block; width: 100%; height: auto; border-radius: 12px; }
.ir-spec__parts { display: none; }
.ir-spec__credit { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ir-table td:first-child { width: 96px; }
.ir-table th { color: var(--sg-body); }
.ir-table td:last-child { width: 210px; font: 400 15px var(--hm-mono); color: #fff; white-space: nowrap; }
.ir-table .sg-sym { min-width: 64px; text-align: center; letter-spacing: 0; font-size: 15px; }
.ir-side { display: flex; flex-direction: column; gap: 24px; }
.ir-side .sg-subset > div { display: flex; }
.ir-esters dt { width: 20px; text-align: center; color: #a78bfa; font-size: 14px; }
.ir-esters__key dd { color: #10b981; font-weight: 600; }
.ir-src { font: 400 12px/1.5 var(--hm-mono); color: var(--hm-muted); }

@media (max-width: 760px) {
    /* 375 design: plot halves + band cards in two rows, drawn from the one inline SVG */
    /* invisible but laid over the parts, so the motion observer sees it on screen and the <use> copies animate */
    .ir-spec { position: relative; }
    .ir-spec__full { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
    .ir-spec__parts { display: grid; gap: 8px; }
    .ir-spec__parts svg { width: 100%; height: auto; }
    .ir-spec__plot { border-radius: 10px; }
    .ir-spec__credit { position: static; width: auto; height: auto; clip: auto; white-space: normal; display: block; margin-top: 8px; font-size: 11px; line-height: 1.45; color: var(--hm-muted); }
    .ir-table td:last-child { grid-column: 2; font-size: 14px; }
    .ir-table td:first-child { width: 96px; }
    .ir-table th { display: block; height: auto; padding: 10px 12px 2px; line-height: 1.4; }
}
