/* D4 Builder guide pages (/guide/…, ko; /guide/en/…, en). Same palette, fonts, header and footer as the landing page
   (assets/landing.css); article typography for long reads. Ad boxes are styled by assets/ads.css. */
:root {
  --bg: #0d0b0a; --bg-2: #120e0c; --panel: #16120f; --panel-2: #211a16; --hover: rgb(255 236 214 / .045);
  --line: #2a221d; --line-2: #3d322b; --fg: #efe7db; --fg-2: #b9ac9c; --fg-3: #877a69;
  --accent: #e8603a; --on-accent: #fff2e6; --gold: #c19a5b; --gold-dim: #5d4a31;
  --guide: #f5c518; --ok: #55d282; --no: #ec6d5f; --warn: #d8972b; --cyan: #4dd9ff; --magenta: #ff33bf; --shot: #070605;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --display: "Cinzel", "Trajan Pro", "Times New Roman", serif;
  --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 .8 13.2 7 7 13.2.8 7z' fill='none' stroke='%23c19a5b' stroke-width='1.3'/%3E%3Cpath d='M7 4.6 9.4 7 7 9.4 4.6 7z' fill='%23c19a5b'/%3E%3C/svg%3E");
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3eee6; --bg-2: #ece5da; --panel: #fffcf7; --panel-2: #ebe3d6; --hover: rgb(60 30 10 / .04);
  --line: #e0d6c7; --line-2: #c9bba7; --fg: #1d1713; --fg-2: #4e4339; --fg-3: #776a5c;
  --accent: #b2341c; --on-accent: #fff6ee; --gold: #8f6a2e; --gold-dim: #cdb894;
  --guide: #9a7600; --ok: #1d8544; --no: #c23a2c; --warn: #a86a0c; --cyan: #0b7fa3; --magenta: #b8178a; --shot: #17120f;
  --orn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M7 .8 13.2 7 7 13.2.8 7z' fill='none' stroke='%238f6a2e' stroke-width='1.3'/%3E%3Cpath d='M7 4.6 9.4 7 7 9.4 4.6 7z' fill='%238f6a2e'/%3E%3C/svg%3E");
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.8 var(--sans); overflow-x: hidden; word-break: keep-all; overflow-wrap: break-word; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: 12px; top: -40px; z-index: 9; padding: 6px 10px; background: var(--accent); color: var(--on-accent); border-radius: 4px; font-weight: 650; text-decoration: none; }
.skip:focus { top: 10px; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: 1240px; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; }
p { margin: 0; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code, kbd { font-family: var(--mono); font-size: .88em; }

/* header (as on the landing page) */
.top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 60px; }
.top::after { content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 1px; background: linear-gradient(90deg, var(--line) 0, var(--gold-dim) 50%, var(--line) 100%); }
.brand { display: inline-flex; align-items: center; gap: 9px; font: 700 15px/1 var(--display); letter-spacing: .06em; text-decoration: none; }
.mark { width: 22px; height: 22px; flex: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 6px 9px; border-radius: 4px; font-size: 13.5px; color: var(--fg-2); text-decoration: none; white-space: nowrap; }
.nav a:hover { color: var(--fg); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--fg); font-weight: 650; }
.tools { display: flex; gap: 6px; align-items: center; margin-left: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
.seg a, .seg button { display: inline-block; border: 0; background: none; padding: 4px 10px; font-size: 12.5px; line-height: 1.5; color: var(--fg-3); text-decoration: none; cursor: pointer; }
.seg [aria-current="true"] { background: var(--panel-2); color: var(--fg); font-weight: 650; }
.iconbtn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-2); border-radius: 4px; background: none; color: var(--fg-2); cursor: pointer; }
.iconbtn:hover, .seg a:hover { color: var(--fg); }

/* breadcrumbs */
nav.crumbs ol { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 28px 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.6; color: var(--fg-3); }
nav.crumbs li, nav.crumbs li + li { margin: 0; }
nav.crumbs li + li::before { content: "›"; margin-right: 8px; color: var(--gold-dim); }
nav.crumbs a { color: var(--fg-2); text-decoration: none; }
nav.crumbs a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* article */
.doc { max-width: 780px; margin: 0 auto; }
.doc-head { padding: 28px 0 8px; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 14px; font: 600 12.5px/1.4 var(--sans); color: var(--gold); letter-spacing: .04em; }
.eyebrow span + span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 12px; transform: translateY(-2px) rotate(45deg); border: 1px solid var(--gold-dim); }
h1 { margin: 0; font: 800 clamp(30px, 4.4vw, 44px)/1.18 var(--sans); letter-spacing: -.035em; }
.lede { margin-top: 18px; font-size: 18px; line-height: 1.7; color: var(--fg-2); }
.meta { margin-top: 14px; font-size: 13px; color: var(--fg-3); }
.toc { margin: 32px 0 8px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
nav.toc h2 { margin: 0; padding: 0; border: 0; font-size: 13px; letter-spacing: .04em; color: var(--fg-3); }
.toc ol { margin: 8px 0 0; padding-left: 20px; font-size: 15px; }
.toc li + li { margin-top: 2px; }
nav.toc a { color: var(--fg-2); text-decoration: none; }
nav.toc a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.doc section { margin-top: 48px; }
.doc h2 { margin: 0; padding-top: 22px; border-top: 1px solid var(--line); font-size: 24px; line-height: 1.35; font-weight: 750; letter-spacing: -.025em; }
.doc h3 { margin: 28px 0 0; font-size: 18px; line-height: 1.45; font-weight: 700; letter-spacing: -.015em; }
.doc p { margin-top: 14px; color: var(--fg-2); }
.doc p strong, .doc li strong, .doc td strong { color: var(--fg); font-weight: 650; }
.doc ul, .doc ol { margin: 14px 0 0; padding-left: 22px; color: var(--fg-2); }
.doc li + li { margin-top: 6px; }
.doc a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--gold-dim); text-underline-offset: 3px; }
.doc a:hover { text-decoration-color: var(--accent); }
.doc kbd { display: inline-block; min-width: 1.8em; padding: 0 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; background: var(--panel); color: var(--fg); text-align: center; line-height: 1.6; }
.doc q { color: var(--fg); }
.doc figure { margin: 26px 0 0; }
.doc figure img { width: 100%; border: 1px solid var(--line-2); border-radius: 6px; background: var(--shot); }
.doc figcaption { margin-top: 8px; font-size: 13.5px; line-height: 1.55; color: var(--fg-3); }
.note { margin-top: 18px; padding: 14px 18px; border-left: 3px solid var(--gold); border-radius: 0 6px 6px 0; background: var(--panel); }
.note.warn { border-left-color: var(--warn); }
.note p:first-child { margin-top: 0; }
.steps { counter-reset: s; list-style: none; padding-left: 0 !important; }
.steps > li { counter-increment: s; position: relative; padding-left: 40px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 2px; display: grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--gold-dim); border-radius: 50%; color: var(--gold); font: 700 12px/1 var(--mono); }
.steps > li + li { margin-top: 14px; }
.tbl { margin-top: 18px; overflow-x: auto; }
.doc table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.6; }
.doc th, .doc td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { color: var(--fg-3); font-weight: 600; font-size: 13px; }
.doc td { color: var(--fg-2); }
.doc td:first-child { color: var(--fg); font-weight: 600; }
.sw { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid currentColor; border-radius: 2px; vertical-align: -1px; }
.sw.dash { border-style: dashed; }
.sw.ring { border-radius: 50%; border-style: dashed; }
.c-guide { color: var(--guide); } .c-ok { color: var(--ok); } .c-no { color: var(--no); } .c-warn { color: var(--warn); } .c-cyan { color: var(--cyan); } .c-mag { color: var(--magenta); }
.calc { margin-top: 16px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font: 500 14.5px/1.75 var(--sans); font-variant-numeric: tabular-nums; color: var(--fg); overflow-x: auto; }

/* "read next" + guide index cards */
.next { margin-top: 64px; }
.next h2 { font-size: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 18px 0 0; padding: 0 !important; list-style: none; }
.cards li { margin: 0 !important; }
.cards a { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); text-decoration: none; overflow: hidden; }
.cards a:hover { border-color: var(--gold-dim); }
.cards img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 30%; border-bottom: 1px solid var(--line); background: var(--shot); }
.cards .ct { display: block; padding: 14px 16px 0; color: var(--fg); font-weight: 700; font-size: 16px; line-height: 1.45; }
.cards .cd { display: block; padding: 6px 16px 16px; color: var(--fg-2); font-size: 14px; line-height: 1.6; }
.index .cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.index .doc { max-width: 1040px; }
.index .doc-head { max-width: 780px; }
.aside { margin-top: 48px; max-width: 780px; }

/* footer (as on the landing page) */
footer { margin-top: 112px; padding: 30px 0 48px; font-size: 13px; color: var(--fg-3);
  background: var(--orn) 50% 0 / 14px no-repeat, linear-gradient(90deg, transparent, var(--gold-dim) 30%, var(--gold-dim) 70%, transparent) 50% 6.5px / 100% 1px no-repeat; }
.fgrid { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 40px; }  /* row 1: brand | links */
.flinks { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
/* row 2, full width under a thin gold rule: disclaimer + build sources */
.fmeta { grid-column: 1 / -1; margin-top: 22px; padding-top: 20px;
  background: linear-gradient(90deg, transparent, var(--gold-dim) 18%, var(--gold-dim) 82%, transparent) 0 0 / 100% 1px no-repeat; }
.fmeta > p:first-child { margin-top: 0; }
.flinks a { color: var(--fg-2); text-decoration: none; }
.flinks a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
footer p { margin-top: 8px; }
footer .fb { color: var(--fg); font: 700 14px var(--display); letter-spacing: .06em; display: inline-flex; gap: 8px; align-items: center; }

@media (max-width: 760px) {
  .nav a.hide-m { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .top::after { left: 16px; right: 16px; }
  .top { height: 56px; }
  body { font-size: 15.5px; }
  .tools { margin-left: 4px; }
  .nav a { padding: 6px 5px; font-size: 13px; }
  .lede { font-size: 16.5px; }
  .doc h2 { font-size: 21px; }
  .toc { padding: 14px 16px; }
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  .flinks { justify-content: flex-start; gap: 0 20px; margin-top: 8px; }
  .flinks a { display: inline-block; padding: 8px 0; }  /* tap targets */
  .doc table, .doc thead, .doc tbody, .doc tr, .doc th, .doc td { display: block; }
  .doc thead { display: none; }
  .doc tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .doc td { padding: 2px 0; border: 0; }
}
@media (max-width: 440px) { .brand span { display: none; } }
@media (max-width: 360px) { .tools a.iconbtn { display: none; } }
