/* ============================================================
   penplotter sites - the family look of the drawing libraries:
   sober black and white, Oswald titles, Inter body, Courier New
   code on warm paper. The rules are shared, taken over as
   they are. Identical in vanilla.penplotter and p5.penplotter.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&family=Inter:wght@400;500&display=swap');

:root {
  --bg:          #f5f5f5;
  --bg2:         #eeeeee;
  --bg3:         #e4e4e4;
  --surface:     #ffffff;
  --paper:       #faf8f3;
  --border:      rgba(0, 0, 0, 0.1);
  --border-mid:  rgba(0, 0, 0, 0.2);
  --border-hard: rgba(0, 0, 0, 0.7);
  --text:        #111111;
  --text-muted:  #666666;
  --text-faint:  #999999;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, .nav-logo, .cta-btn, .hero-badge { font-family: 'Oswald', sans-serif; margin: 0; }
code, pre { font-family: 'Courier New', Courier, monospace; }
a:focus-visible, button:focus-visible { outline: 2px solid #000; outline-offset: 3px; }

/* ── NAV ── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2.5rem;
  background: rgba(245, 245, 245, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-mid);
}
.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
}
.nav-logo span { color: #000; border-bottom: 2px solid #000; }
.nav-links { display: flex; list-style: none; gap: 2rem; margin: 0; padding: 0; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'Oswald', sans-serif;
  font-weight: 400;
  transition: color 0.15s;
}
.nav-links a:hover { color: #000; }
.nav-links a.active { color: #000; border-bottom: 2px solid #000; padding-bottom: 2px; }
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
}
.nav-hamburger span { display: block; width: 22px; height: 2px; background: var(--text); border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
#navbar.nav-open .nav-hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#navbar.nav-open .nav-hamburger span:nth-child(2) { opacity: 0; }
#navbar.nav-open .nav-hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

#hero, .section, footer { position: relative; z-index: 1; }

/* ── HERO ── */
#hero {
  height: 100vh;
  min-height: 580px;
  overflow: hidden;
}
#hero-canvas { position: absolute; inset: 0; }
#hero-canvas canvas { display: block; width: 100% !important; height: 100% !important; }
.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(245,245,245,0.15) 0%, rgba(245,245,245,0.75) 100%);
  pointer-events: none;
}
.hero-text { text-align: center; pointer-events: auto; padding: 0 1.25rem; }
.hero-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  border: 1px solid var(--border-hard);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 1.5rem;
}
.hero-text h1 {
  font-size: clamp(3rem, 10vw, 7.5rem);
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #000;
  margin-bottom: 1.2rem;
}
.hero-sub {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 2.5rem;
  font-weight: 400;
}
.cta-btn {
  display: inline-block;
  padding: 0.8rem 2.5rem;
  background: #000;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.15s;
}
.cta-btn:hover { background: #333; }
.cta-btn.secondary { background: #444; }
.cta-btn.secondary:hover { background: #333; }
.cta-row { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* ── SECTIONS ── */
.section { padding: 6rem 2rem; }
.section-dark { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-header { text-align: center; max-width: 680px; margin: 0 auto 3rem; }
.section-tag, .eyebrow {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  border: 1px solid var(--border-mid);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
  margin: 0 0 1rem;
}
.section-header h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #000;
  margin-bottom: 1rem;
}
.section-header p { color: var(--text-muted); line-height: 1.7; font-size: 0.97rem; margin: 0; }
.accent { color: #000; }
section[id], h2[id], h3[id] { scroll-margin-top: 62px; }

/* The two-libraries and five-stages lists on the landing page */
.pipeline-list { list-style: none; margin: 0 auto; padding: 0; max-width: 960px; border-top: 1px solid var(--border-mid); }
.pipeline-list li {
  display: grid;
  grid-template-columns: 64px minmax(170px, .4fr) 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border-mid);
}
.pipeline-list span { font-family: 'Consolas', 'Courier New', monospace; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.pipeline-list strong { font-family: 'Oswald', sans-serif; font-size: clamp(1.3rem, 2.6vw, 1.9rem); font-weight: 500; letter-spacing: 0.02em; color: #000; }
.pipeline-list p { margin: 0; color: var(--text-muted); line-height: 1.65; }
.pipeline-list a { color: #000; }

/* ── CODE ── */
.code-preview {
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 0.75rem;
  text-align: left;
}
.code-preview code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.7rem;
  color: #111;
  background: transparent;
  white-space: pre-wrap;
  line-height: 1.65;
}
pre, .code-block {
  background: var(--paper);
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 1.2rem 1.4rem;
  margin: 0.8rem 0 1.4rem;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 0.84rem;
  line-height: 1.6;
  white-space: pre;
}
pre code, .code-block code { background: transparent; padding: 0; font-family: inherit; font-size: inherit; }
p code, li code, td code, dd code { font-family: 'Courier New', monospace; font-size: 0.88em; background: #f3f1ec; padding: 0.1em 0.35em; }

/* Prism tokens - p5 webeditor (Atom One Light) palette */
.token.comment    { color: #A0A1A7; font-style: italic; }
.token.keyword    { color: #A626A4; }
.token.string     { color: #50A14F; }
.token.number,
.token.boolean    { color: #986801; }
.token.function   { color: #4078F2; }
.token.class-name { color: #C18401; }
.token.property   { color: #E45649; }
.token.operator,
.token.punctuation { color: #383A42; }

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border-mid);
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.9;
}
footer p { margin: 0; }
footer a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
footer a:hover { color: #000; }
.footer-sub { font-size: 0.75rem; color: var(--text-faint); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #aaa; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── DOC PAGES (reading layout) ── */
.page, .guide-wrap { max-width: 960px; margin: 0 auto; padding: 6rem 2rem 5rem; }
.page h1 { font-size: 2.8rem; margin-bottom: 0.3rem; }
.page h2 { font-size: 1.5rem; margin: 3rem 0 0.7rem; text-transform: uppercase; letter-spacing: .05em; padding-bottom: 0.3rem; }
.page h3 { font-size: 1.1rem; margin: 1.8rem 0 0.4rem; text-transform: uppercase; letter-spacing: .04em; }
.page p, .page li { line-height: 1.7; color: var(--text-muted); }
.page p { margin: 0 0 0.8rem; }
.page a { color: #000; text-decoration: underline; }
.page a:hover { color: #555; }
.guide-intro, .lead { font-size: 1.1rem; color: var(--text); margin-bottom: 2rem; line-height: 1.7; }
.page .lead, .page .guide-intro { color: var(--text); }
.page ol, .page ul { padding-left: 22px; margin: 0 0 1rem; }
.page li + li { margin-top: 0.4rem; }
.page-header { margin-bottom: 2.5rem; }
.page-header .section-tag, .page-header .eyebrow { margin-bottom: 0.6rem; }

.callout {
  background: var(--bg2);
  padding: 0.9rem 1.2rem;
  margin: 1.2rem 0;
  color: var(--text);
}
.callout p { margin: 0; }
.callout code { background: #ebe8e0; }
.note {
  display: inline-block;
  font-size: 0.72rem;
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #000;
  color: #fff;
  padding: 0.15em 0.5em;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.page table, .opts-table { width: 100%; border-collapse: collapse; margin: 0.8rem 0 1.4rem; font-size: 0.84rem; }
.page th, .opts-table th {
  text-align: left;
  font-family: 'Oswald', sans-serif;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0.4rem 0.8rem;
  background: #000;
  color: #fff;
}
.page td, .opts-table td { padding: 0.45rem 0.8rem; border-bottom: 1px solid #e8e8e8; color: var(--text); vertical-align: top; }
.page tr:last-child td, .opts-table tr:last-child td { border-bottom: none; }
.page td:first-child, .opts-table td:first-child { font-family: 'Courier New', monospace; white-space: nowrap; }
.page td:nth-child(3), .opts-table td:nth-child(3) { color: var(--text-muted); }
.table-wrap { overflow-x: auto; }

.step-list { list-style: none; padding: 0; margin: 0.5rem 0 1.4rem; counter-reset: steps; }
.step-list li { counter-increment: steps; display: flex; gap: 1rem; margin-bottom: 0.9rem; }
.step-list li::before { content: counter(steps); font-family: 'Oswald', sans-serif; font-size: 1.1rem; background: #000; color: #fff; min-width: 1.8rem; height: 1.8rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 0.1rem; }
.step-list li p { margin: 0; line-height: 1.6; }

.example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.example-card { padding: 1.4rem; border: 1px solid var(--border-mid); background: var(--surface); }
.example-card h2 { margin: 0.4rem 0 0.8rem; font-size: 1.4rem; border: 0; padding: 0; }

/* ── EXAMPLES AND POSSIBILITIES PAGES (gallery layout) ── */
.ex-page-header { max-width: 1100px; margin: 0 auto; padding: 7rem 2rem 3rem; text-align: center; }
.ex-page-header h1 { font-size: 2.8rem; margin-bottom: 0.6rem; }
.ex-page-header > p { max-width: 620px; margin: 0 auto 2rem; line-height: 1.7; color: var(--text-muted); }
.ex-page-header .section-tag { margin-bottom: 0.6rem; }
.ex-preview { max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.ex-canvas { width: 100%; overflow: hidden; background: var(--surface); border: 1px solid var(--border-mid); }
.ex-canvas canvas, .ex-canvas iframe { display: block !important; width: 100% !important; height: auto; border: 0; }
.ex-canvas canvas[data-example], .ex-canvas iframe { aspect-ratio: 4 / 5; object-fit: contain; }
.ex-canvas iframe { pointer-events: none; } /* a preview, not a plot button: the full example is the page to click */
.ex-canvas .ex-text { margin: 0; padding: 1rem; border: 0; border-radius: 0; aspect-ratio: 520 / 220; height: auto; font-size: 0.78rem; line-height: 1.65; white-space: pre; overflow: auto; background: var(--paper); }
.section-dark .ex-canvas { background: var(--surface); }
.ex-code-block {
  width: 100%;
  margin: 0;
  padding: 1rem 1.2rem;
  background: var(--paper);
  color: #111;
  border: 1px solid rgba(0, 0, 0, 0.15);
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
  border-radius: 4px;
}
.ex-full-link, .ex-link {
  display: inline-block;
  font-family: 'Oswald', sans-serif;
  font-size: 0.72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none !important;
  border-bottom: 1px solid var(--border-mid);
  transition: color 0.15s, border-color 0.15s;
}
.ex-full-link:hover, .ex-link:hover { color: #000; border-color: #000; }
.ex-controls { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); }
.ex-controls label { display: inline-flex; align-items: center; gap: 0.4rem; }
.ex-controls select { padding: 0.35rem 0.5rem; border: 1px solid var(--border-mid); background: var(--surface); }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .pipeline-list li { grid-template-columns: 45px 1fr; }
  .pipeline-list p { grid-column: 2; }
  .example-grid { grid-template-columns: 1fr; }
  .nav-hamburger { display: flex; }
  .nav-links {
    display: none;
    position: fixed;
    top: 52px;
    left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(245, 245, 245, 0.97);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-mid);
    padding: 0.5rem 0 1rem;
  }
  #navbar.nav-open .nav-links { display: flex; }
  .nav-links li { padding: 0; }
  .nav-links a { display: block; padding: 0.75rem 2rem; font-size: 0.9rem; }
}
@media (max-width: 620px) {
  #navbar { padding-left: 1.25rem; padding-right: 1.25rem; }
  .section { padding: 4rem 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ── Landing: four drawings you can make ── */
.make-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.25rem; max-width: 1100px; margin: 0 auto; }
.make-card { display: block; text-decoration: none; color: inherit; }
.make-card .ex-canvas { margin-bottom: 0.6rem; }
.make-card p { margin: 0; font-family: 'Oswald', sans-serif; font-size: 1.1rem; font-weight: 400; letter-spacing: 0.02em; color: #000; }
.make-card:hover p { text-decoration: underline; }

/* Titles use Oswald Light; keep the existing sizes and placement. */
:is(#hero, .page, .section, .ex-page-header, .demo-header, .hb) :is(h1, h2, h3) {
  font-weight: 300;
}

/* Long inline references must not widen the page. */
p code, li code, td code { overflow-wrap: anywhere; }


/* Preserve code indentation inside a contained scrolling panel. */
pre, .ex-code-block { max-width: 100%; min-width: 0; box-sizing: border-box; }
pre code { white-space: pre; overflow-wrap: normal; }

.token.tag, .token.attr-name { color: #E45649; }
.token.attr-value { color: #50A14F; }

.workflow-pair { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:1.5rem; margin:2rem 0; }
.workflow-pair figure { min-width:0; margin:0; }
.workflow-pair img { display:block; width:100%; height:auto; }
.workflow-pair h3 { font-size:1.35rem; }
details { margin:1.5rem 0; }
summary { cursor:pointer; margin-bottom:1rem; }
@media (max-width:620px) { .workflow-pair { grid-template-columns:1fr; } }
@media (max-width:620px) { .page table { table-layout:fixed; } .page td:first-child { white-space:normal; overflow-wrap:anywhere; } .page th, .page td { overflow-wrap:anywhere; padding-left:.4rem; padding-right:.4rem; } }
