/* Templates share content and interactions; only the presentation changes. */
body[data-template] {
  --canvas-color: 165, 197, 139;
  --canvas-accent: #c3f87c;
}
body[data-template] :is(main, .hero-copy, .section-side, .about-content, .project-info, .skill-column, .timeline, .ai-copy, .ai-metric) { min-width: 0; }
body[data-template] main { overflow-wrap: anywhere; }
body[data-template] :is(h1, h2, h3, p, li, .skill-list, .job-company, .tech-tags, .about-tags, .phone-link) { overflow-wrap: anywhere; }
body[data-template] main :is(h1, h2) { text-wrap: balance; }
body[data-template] .hero h1 { white-space: normal; }
body[data-template] :is(.hero-buttons, .hero-location, .agent-tools, .job-date) { flex-wrap: wrap; }
body[data-template] :is(button, a) { overflow-wrap: anywhere; }
body[data-template] .phone-link { max-width: 100%; }
body[data-template] .project-meta > span:last-child { white-space: normal; }
body[data-template] .contact-actions { min-width: 0; max-width: 100%; }
body[data-template] #dialog-content { min-width: 0; overflow-wrap: anywhere; }
body[data-template] :is(input, select, textarea, button, a):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
body[data-template] .project-trigger:focus-visible { outline: none; }

body[data-template="editorial"] {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #d5dbe5;
  --text: #192333;
  --muted: #536075;
  --accent: #284ec7;
  --on-accent: #fff;
  --wash: #eaf0fa;
  --diagram-surface: #f9fbff;
  --canvas-color: 69, 92, 169;
  --canvas-accent: #284ec7;
  --heading: "Iowan Old Style", "Baskerville", "Songti SC", "Noto Serif SC", "STSong", serif;
}
body[data-template="terminal"] {
  color-scheme: dark;
  --bg: #081320;
  --surface: #0d1a2b;
  --line: #2b3d54;
  --text: #e3edf9;
  --muted: #a3b4cb;
  --accent: #ffbc66;
  --on-accent: #101b2b;
  --wash: #13253a;
  --diagram-surface: #0b1b2c;
  --canvas-color: 111, 168, 209;
  --canvas-accent: #ffbc66;
  --sans: "SFMono-Regular", Consolas, "Liberation Mono", "PingFang SC", "Microsoft YaHei", monospace;
  background-image: linear-gradient(#7fb1d407 1px, transparent 1px), linear-gradient(90deg, #7fb1d407 1px, transparent 1px);
  background-size: 32px 32px;
}

/* Explicitly recolor the original illustrations, menus, and modal as well as text. */
body:is([data-template="editorial"], [data-template="terminal"]) {
  font-size: 16px;
  --project-color: var(--accent);
}
body:is([data-template="editorial"], [data-template="terminal"]) :is(.desktop-nav, .hero-greeting, .hero-location, .hero-bottom, .hero-bottom > a > .mono, .visual-top, .visual-top span:last-child, .visual-center > span, .orbit-label, .visual-bottom, .side-note, .large-copy > span, .about-tags span, .project-meta, .work-note, .ai-metric > .mono, .ai-metric > small, .ai-metric > span:not(.mono), .ai-process, .ai-process b, .ai-process i, .job-date, .job-company, .education > .mono, .skill-column > p, .skill-list, .domain-row, .domain-row > .mono, .contact-top, .copy-button, .footer, .footer-brand, .footer-brand > span, #dialog-content p, #dialog-content li, #dialog-content .dialog-role) { color: var(--muted); }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.hero-description, .section-heading p, .stats p, .side-description, .job-company, .job-body ul, .skill-column > p, .skill-list, .education > span:last-child, .dialog-systems p) { font-size: 1rem !important; }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.button, .text-button, .resume-link, .copy-button, .motion-button, .desktop-nav, .footer > a:last-child) { font-size: .875rem; }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.motion-button, .reset-visual, .menu-button) { min-width: 36px; min-height: 36px; }
body:is([data-template="editorial"], [data-template="terminal"]) .menu-button { justify-content: center; align-items: center; }
body:is([data-template="editorial"], [data-template="terminal"]) .menu-button > span { background: var(--text); }
body:is([data-template="editorial"], [data-template="terminal"]) .mobile-nav:not([hidden]) { background: var(--surface); border-color: var(--line); box-shadow: 0 16px 30px #08132018; }
body:is([data-template="editorial"], [data-template="terminal"]) .mobile-nav a { border-color: var(--line); }
body:is([data-template="editorial"], [data-template="terminal"]) .primary { color: var(--on-accent); }
body:is([data-template="editorial"], [data-template="terminal"]) .primary:hover { background: var(--accent); filter: brightness(1.08); }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.desktop-nav a:hover, .text-button:hover, .job-toggle) { color: var(--accent); }
body:is([data-template="editorial"], [data-template="terminal"]) .location-separator { color: var(--line); }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.scroll-indicator, .visual-bottom, .about-tags span, .project-arrow, .agent-tools span, .ai-process, .ai-metric, .timeline, .current-label, .phone-link, .dialog-systems > div) { border-color: var(--line); }
body:is([data-template="editorial"], [data-template="terminal"]) .system-visual { background: radial-gradient(ellipse at center, var(--wash), transparent 70%); }
body:is([data-template="editorial"], [data-template="terminal"]) .system-visual::before,
body:is([data-template="editorial"], [data-template="terminal"]) .system-visual::after { color: var(--accent); }
body:is([data-template="editorial"], [data-template="terminal"]) .visual-center { text-shadow: 0 2px 18px var(--bg); }
body:is([data-template="editorial"], [data-template="terminal"]) .project-card { background: var(--surface); }
body:is([data-template="editorial"], [data-template="terminal"]) .tech-tags span { background: var(--wash); color: var(--text); }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.diagram-hub, .diagram-spokes span, .pod-core, .pod-output > span, .trade-center, .caimu-layer > span, .caimu-base) { background: var(--diagram-surface); color: var(--project-color); border-color: rgba(var(--project-rgb), .4); box-shadow: none; }
body:is([data-template="editorial"], [data-template="terminal"]) .pod-core { outline-color: rgba(var(--project-rgb), .18); }
body:is([data-template="editorial"], [data-template="terminal"]) :is(.flow-line, .trade-path) { background: var(--project-color); }
body:is([data-template="editorial"], [data-template="terminal"]) .flow-line::after { background: var(--project-color); box-shadow: 0 0 8px var(--project-color); }
body:is([data-template="editorial"], [data-template="terminal"]) .trade-path:after { background: var(--surface); }
body:is([data-template="editorial"], [data-template="terminal"]) .ai-panel { background: var(--surface); border-color: var(--line); }
body:is([data-template="editorial"], [data-template="terminal"]) .agent-tools span { color: var(--text); }
body:is([data-template="editorial"], [data-template="terminal"]) .token-bars > i { background: var(--accent); }
body:is([data-template="editorial"], [data-template="terminal"]) .job:before { background: var(--muted); }
body:is([data-template="editorial"], [data-template="terminal"]) .job:first-child:before { background: var(--accent); }
body:is([data-template="editorial"], [data-template="terminal"]) .job-body li::marker { color: var(--accent); }
body:is([data-template="editorial"], [data-template="terminal"]) .contact { background: none; }
body:is([data-template="editorial"], [data-template="terminal"]) dialog { color: var(--text); background: var(--surface); border-color: var(--line); }
body:is([data-template="editorial"], [data-template="terminal"]) dialog::backdrop { background: #081320aa; }
body:is([data-template="editorial"], [data-template="terminal"]) .dialog-close { color: var(--text); background: var(--wash); width: 40px; height: 40px; }

/* Editorial: generous typography, asymmetric introduction, alternating case studies. */
body[data-template="editorial"] .wrap { width: min(1200px, calc(100% - 112px)); }
body[data-template="editorial"] .header { max-width: 1440px; height: 106px; }
body[data-template="editorial"] .brand-mark { font-family: var(--heading); font-weight: 600; }
body[data-template="editorial"] .hero { grid-template-columns: minmax(0, 1fr) 260px; gap: 38px; min-height: 680px; padding-top: 86px; padding-bottom: 110px; }
body[data-template="editorial"] .hero h1 { font: 500 clamp(42px, 5.6vw, 80px)/1.28 var(--heading); letter-spacing: -.055em; }
body[data-template="editorial"] .hero h1 > span { font-style: italic; }
body[data-template="editorial"] .hero-greeting { margin-top: 28px; font-size: 1.125rem; }
body[data-template="editorial"] .hero-description { max-width: 620px; }
body[data-template="editorial"] .system-visual { position: relative; width: 100%; height: 340px; margin: 0; border-left: 1px solid var(--line); opacity: 1; }
body[data-template="editorial"] .visual-top { padding-inline: 18px 0; font-size: .5rem; }
body[data-template="editorial"] .visual-top span:last-child { display: none; }
body[data-template="editorial"] .visual-center { left: 51%; }
body[data-template="editorial"] .visual-center strong { font-family: var(--heading); font-size: 1.4rem; }
body[data-template="editorial"] .visual-bottom { left: 18px; font-size: .5rem; }
body[data-template="editorial"] .visual-bottom > .mono { font-size: .5rem; }
body[data-template="editorial"] .orbit-label { font-size: .4375rem; }
body[data-template="editorial"] .orbit-label-one { left: 8%; }
body[data-template="editorial"] .orbit-label-two { right: -3%; }
body[data-template="editorial"] .orbit-label-three { left: 3%; }
body[data-template="editorial"] .button { border-radius: 0; padding: 15px 23px; }
body[data-template="editorial"] .stats { padding-block: 28px; }
body[data-template="editorial"] .stats strong { font-family: var(--heading); font-size: 3.2rem; }
body[data-template="editorial"] .section { padding-block: 110px; }
body[data-template="editorial"] :is(.section h2, #dialog-content h2) { font-family: var(--heading); font-weight: 500; font-size: clamp(30px, 3.1vw, 44px); line-height: 1.5; }
body[data-template="editorial"] .about { grid-template-columns: 1fr 1.7fr; gap: 72px; }
body[data-template="editorial"] .about-content > .large-copy { font-family: var(--heading); font-size: 1.625rem; }
body[data-template="editorial"] .about-tags span { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding-inline: 0; margin-right: 14px; }
body[data-template="editorial"] .section-kicker { letter-spacing: .16em; }
body[data-template="editorial"] .project-grid { grid-template-columns: 1fr; gap: 36px; }
body[data-template="editorial"] .project-card { --project-color: #284ec7; --project-rgb: 40, 78, 199; border: 0; border-block: 1px solid var(--line); border-radius: 0; }
body[data-template="editorial"] .project-card:hover { transform: none; border-color: var(--accent); }
body[data-template="editorial"] .project-open { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
body[data-template="editorial"] .project-visual { height: 100%; min-height: 300px; border: 0; background-color: var(--wash); }
body[data-template="editorial"] .project-info { display: flex; flex-direction: column; justify-content: center; padding: 38px 42px; }
body[data-template="editorial"] .project-title { margin-block: 20px 14px; }
body[data-template="editorial"] .project-title h3 { font-family: var(--heading); font-size: 1.75rem; font-weight: 500; }
body[data-template="editorial"] .project-arrow { border: 0; font-size: 1.6rem; }
body[data-template="editorial"] .project-meta { flex-wrap: wrap; }
body[data-template="editorial"] .project-meta > span:last-child { font-size: .6875rem; }
body[data-template="editorial"] .project-card:nth-child(even) .project-visual { order: 2; }
body[data-template="editorial"] .finance-diagram { top: 75px; }
body[data-template="editorial"] .pod-diagram { top: 100px; }
body[data-template="editorial"] .trade-diagram { top: 100px; }
body[data-template="editorial"] .caimu-diagram { top: 78px; }
body[data-template="editorial"] .ai-section { padding-top: 0; }
body[data-template="editorial"] .ai-panel { border: 0; border-top: 3px solid var(--text); border-radius: 0; padding: 48px 0 0; gap: 40px; background: none; }
body[data-template="editorial"] .ai-metric { border-left: 1px solid var(--line); }
body[data-template="editorial"] .ai-metric > strong { font-family: var(--heading); font-size: 7.5rem; }
body[data-template="editorial"] .token-bars { height: 44px; }
body[data-template="editorial"] .experience { grid-template-columns: 1fr 1.7fr; gap: 72px; }
body[data-template="editorial"] .experience .section-side h2 { font-size: 2.1rem; }
body[data-template="editorial"] .timeline { border-left: 0; padding-left: 0; }
body[data-template="editorial"] .job { padding-bottom: 30px; margin-bottom: 30px; }
body[data-template="editorial"] .job:before { display: none; }
body[data-template="editorial"] .job-title { font-family: var(--heading); font-size: 1.625rem; }
body[data-template="editorial"] .skill-column { padding-left: 28px; }
body[data-template="editorial"] .skill-column:first-child { padding-left: 0; }
body[data-template="editorial"] .skill-column h3 { font-family: var(--heading); font-size: 1.5rem; }
body[data-template="editorial"] .contact { border-top: 3px solid var(--text); }
body[data-template="editorial"] .contact h2 { font-size: clamp(34px, 4.2vw, 58px); }
body[data-template="editorial"] .contact-asterisk { display: none; }
body[data-template="editorial"] .phone-link { font-family: var(--heading); font-size: 2.2rem; }
body[data-template="editorial"] dialog { border-radius: 0; box-shadow: 0 25px 100px #142e4940; }

/* Terminal: the system view leads, followed by a compact engineering log. */
body[data-template="terminal"] .wrap { width: min(1320px, calc(100% - 96px)); }
body[data-template="terminal"] .header { height: 84px; padding-inline: 48px; border-bottom: 1px solid var(--line); background: var(--bg); }
body[data-template="terminal"] .brand-mark { font-size: 2rem; }
body[data-template="terminal"] .brand-sub { color: #75bdd6; }
body[data-template="terminal"] .hero { grid-template-columns: minmax(0, .95fr) minmax(0, 1.15fr); gap: 50px; min-height: 660px; padding-block: 60px 95px; }
body[data-template="terminal"] .hero-copy { grid-column: 2; grid-row: 1; }
body[data-template="terminal"] .hero h1 { font-size: clamp(36px, 3.8vw, 58px); letter-spacing: -.065em; line-height: 1.42; }
body[data-template="terminal"] .hero-greeting:before { content: "> "; color: var(--accent); }
body[data-template="terminal"] .hero-greeting { margin-block: 25px 12px; }
body[data-template="terminal"] .eyebrow { font-size: .625rem; letter-spacing: .05em; }
body[data-template="terminal"] .hero-description { line-height: 1.9; }
body[data-template="terminal"] .hero-description br { display: none; }
body[data-template="terminal"] .hero-buttons { gap: 22px; }
body[data-template="terminal"] .system-visual { grid-column: 1; grid-row: 1; width: 100%; height: 450px; margin: 0; border: 1px solid var(--line); background: radial-gradient(ellipse, #1b40523b, transparent 68%), var(--surface); }
body[data-template="terminal"] .system-visual::before,
body[data-template="terminal"] .system-visual::after { top: -15px; background: var(--bg); padding-inline: 4px; }
body[data-template="terminal"] .visual-top { padding: 16px 18px; }
body[data-template="terminal"] .visual-center > span { color: #75bdd6; }
body[data-template="terminal"] .visual-center strong { font-size: 1.6rem; }
body[data-template="terminal"] .visual-bottom { left: 18px; right: 18px; bottom: 8px; }
body[data-template="terminal"] .orbit-label { background: var(--surface); color: #85d7e7; }
body[data-template="terminal"] .orbit-label-two { right: 1%; }
body[data-template="terminal"] .button { border-radius: 0; box-shadow: 4px 4px 0 #ffbc6626; }
body[data-template="terminal"] .stats { gap: 14px; padding: 0; border: 0; }
body[data-template="terminal"] .stats > div { border: 1px solid var(--line); border-top: 2px solid var(--accent); padding: 22px 20px; background: var(--surface); }
body[data-template="terminal"] .stats strong { font-size: clamp(30px, 3vw, 44px); }
body[data-template="terminal"] .stats p { line-height: 1.65; }
body[data-template="terminal"] .section { padding-block: 80px; }
body[data-template="terminal"] .section h2 { font-size: clamp(26px, 2.6vw, 36px); font-weight: 600; }
body[data-template="terminal"] .section-kicker { font-size: .75rem; letter-spacing: .03em; margin-bottom: 20px; }
body[data-template="terminal"] .section-kicker:before { content: "[ "; color: #75bdd6; }
body[data-template="terminal"] .section-kicker:after { content: " ]"; color: #75bdd6; }
body[data-template="terminal"] .about { grid-template-columns: 1fr 1.8fr; gap: 56px; }
body[data-template="terminal"] .about-content { border-left: 2px solid var(--accent); padding-left: 28px; }
body[data-template="terminal"] .about-content > .large-copy { font-size: 1.25rem; }
body[data-template="terminal"] .about-tags span { border-radius: 0; background: var(--surface); color: #85d7e7; }
body[data-template="terminal"] .project-grid { gap: 22px; }
body[data-template="terminal"] .project-card { --project-color: #85d7e7; --project-rgb: 133, 215, 231; border-radius: 0; }
body[data-template="terminal"] .project-card:nth-child(even) { --project-color: #ffbc66; --project-rgb: 255, 188, 102; }
body[data-template="terminal"] .project-card:hover { transform: translateY(-3px); }
body[data-template="terminal"] .project-visual { height: 240px; background-size: auto, 20px 20px, 20px 20px; }
body[data-template="terminal"] .project-visual-meta { font-size: .625rem; opacity: 1; }
body[data-template="terminal"] .project-title h3 { font-size: 1.3rem; font-weight: 600; }
body[data-template="terminal"] .project-info { padding: 24px; }
body[data-template="terminal"] .project-meta { flex-wrap: wrap; }
body[data-template="terminal"] .project-arrow { border-radius: 0; }
body[data-template="terminal"] .tech-tags span { border: 1px solid var(--line); border-radius: 0; color: #b9dae5; }
body[data-template="terminal"] .pod-core { transform: none; border-radius: 0; }
body[data-template="terminal"] .trade-center { border-radius: 0; }
body[data-template="terminal"] .caimu-diagram { transform: translateX(-50%); }
body[data-template="terminal"] .ai-section { padding-top: 0; }
body[data-template="terminal"] .ai-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); border-radius: 0; padding: 36px 36px 0; gap: 30px; }
body[data-template="terminal"] .ai-copy { grid-column: 2; grid-row: 1; }
body[data-template="terminal"] .ai-metric { grid-column: 1; grid-row: 1; border-right: 1px solid var(--line); padding-right: 30px; }
body[data-template="terminal"] .ai-metric > strong { font-size: 5.5rem; }
body[data-template="terminal"] .agent-tools span { border-radius: 0; color: #85d7e7; }
body[data-template="terminal"] .ai-process { font-size: .75rem; flex-wrap: wrap; }
body[data-template="terminal"] .experience { grid-template-columns: 1fr; gap: 32px; }
body[data-template="terminal"] .experience .section-side { display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; }
body[data-template="terminal"] .experience .section-kicker { grid-column: 1 / -1; }
body[data-template="terminal"] .experience .section-side h2 { grid-row: span 2; font-size: clamp(26px, 2.6vw, 36px); }
body[data-template="terminal"] .experience .side-description { margin: 0 0 12px; }
body[data-template="terminal"] .timeline { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 18px; border: 0; padding: 0; margin: 0; }
body[data-template="terminal"] .job { margin: 0; padding: 24px; border: 1px solid var(--line); background: var(--surface); }
body[data-template="terminal"] .job:first-child { border-top: 2px solid var(--accent); }
body[data-template="terminal"] .job:before { display: none; }
body[data-template="terminal"] .job-title { font-size: 1.25rem; }
body[data-template="terminal"] .job-toggle { top: 24px; }
body[data-template="terminal"] .current-label { border-radius: 0; }
body[data-template="terminal"] .education { grid-column: 1 / -1; padding-top: 12px; }
body[data-template="terminal"] .skills-grid { gap: 18px; margin-top: 32px; }
body[data-template="terminal"] :is(.skill-column, .skill-column:first-child) { padding: 25px; border: 1px solid var(--line); background: var(--surface); }
body[data-template="terminal"] .skill-icon { color: #85d7e7; }
body[data-template="terminal"] .skill-list { font-size: 1rem; }
body[data-template="terminal"] .domain-row { color: #85d7e7; }
body[data-template="terminal"] .contact { border: 1px solid var(--line); background: var(--surface); padding: 48px; margin-bottom: 50px; }
body[data-template="terminal"] .contact h2 { font-size: clamp(28px, 3.1vw, 44px); }
body[data-template="terminal"] .contact-asterisk { font-size: 5rem; }
body[data-template="terminal"] .phone-link { font-size: 1.75rem; }
body[data-template="terminal"] dialog { border-radius: 0; border-top: 3px solid var(--accent); }

@media (max-width: 1100px) {
  body:is([data-template="editorial"], [data-template="terminal"]) .wrap { width: calc(100% - 64px); }
  body:is([data-template="editorial"], [data-template="terminal"]) .header { padding-inline: 32px; }
  body[data-template="editorial"] .hero { grid-template-columns: minmax(0, 1fr) 210px; gap: 25px; }
  body[data-template="editorial"] .hero h1 { font-size: clamp(42px, 5.8vw, 68px); }
  body[data-template="editorial"] .system-visual { height: 300px; }
  body[data-template="editorial"] .visual-bottom > .mono { font-size: .4375rem; }
  body[data-template="editorial"] .project-info { padding: 28px; }
  body[data-template="editorial"] :is(.about, .experience) { gap: 42px; }
  body[data-template="terminal"] .hero { gap: 32px; }
  body[data-template="terminal"] .hero h1 { font-size: 2.625rem; }
  body[data-template="terminal"] .system-visual { height: 400px; }
  body[data-template="terminal"] .stats > div { padding: 20px 16px; }
  body[data-template="terminal"] :is(.skill-column, .skill-column:first-child) { padding: 20px; }
  body[data-template="terminal"] .contact-asterisk { display: none; }
}

@media (max-width: 800px) {
  body:is([data-template="editorial"], [data-template="terminal"]) .header { height: 78px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .hero-copy { width: 100%; grid-column: auto; grid-row: auto; }
  body:is([data-template="editorial"], [data-template="terminal"]) .hero { grid-template-columns: 1fr; min-height: 0; padding-block: 54px 82px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .system-visual { position: relative; inset: auto; width: 100%; opacity: 1; grid-column: auto; grid-row: auto; }
  body:is([data-template="editorial"], [data-template="terminal"]) :is(.visual-center, .orbit-label) { display: block; }
  body:is([data-template="editorial"], [data-template="terminal"]) :is(.visual-top, .visual-bottom) { display: flex; }
  body:is([data-template="editorial"], [data-template="terminal"]) .hero-description { max-width: 620px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .section { padding-block: 72px; }
  body:is([data-template="editorial"], [data-template="terminal"]) :is(.about, .experience) { grid-template-columns: 1fr; gap: 34px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-section { padding-top: 0; }
  body:is([data-template="editorial"], [data-template="terminal"]) .section-heading { align-items: start; }
  body[data-template="editorial"] .hero { display: grid; text-align: center; gap: 35px; }
  body[data-template="editorial"] .hero h1 { font-size: clamp(42px, 7.8vw, 66px); }
  body[data-template="editorial"] :is(.eyebrow, .hero-buttons, .hero-location) { justify-content: center; }
  body[data-template="editorial"] .hero-description { margin-inline: auto; }
  body[data-template="editorial"] .system-visual { max-width: 400px; height: 260px; margin-inline: auto; border-left: 0; }
  body[data-template="editorial"] .visual-top { padding-left: 0; }
  body[data-template="editorial"] .visual-bottom { left: 0; }
  body[data-template="editorial"] .orbit-label-two { right: 0; }
  body[data-template="editorial"] .stats > div { padding: 22px; border-bottom: 1px solid var(--line); }
  body[data-template="editorial"] .stats > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  body[data-template="editorial"] .stats > div:nth-child(n+3) { border-bottom: 0; }
  body[data-template="editorial"] .project-open { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  body[data-template="editorial"] .project-info { padding: 26px 24px; }
  body[data-template="editorial"] .project-title h3 { font-size: 1.5rem; }
  body[data-template="editorial"] .project-visual { min-height: 310px; }
  body[data-template="editorial"] .pod-diagram { top: 110px; }
  body[data-template="editorial"] .trade-diagram { top: 110px; }
  body[data-template="editorial"] .caimu-diagram { top: 90px; width: 200px; }
  body[data-template="editorial"] .ai-metric > strong { font-size: 5.5rem; }
  body[data-template="terminal"] .hero { gap: 35px; }
  body[data-template="terminal"] .system-visual { height: 360px; grid-row: 2; }
  body[data-template="terminal"] .hero h1 { font-size: clamp(36px, 6.7vw, 54px); }
  body[data-template="terminal"] .hero-copy { max-width: 620px; }
  body[data-template="terminal"] .project-grid { grid-template-columns: 1fr; }
  body[data-template="terminal"] .project-open { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
  body[data-template="terminal"] .project-visual { height: 100%; min-height: 290px; border-right: 1px solid var(--line); border-bottom: 0; }
  body[data-template="terminal"] .project-info { padding: 25px; }
  body[data-template="terminal"] .project-visual-meta { font-size: .5rem; }
  body[data-template="terminal"] .finance-diagram { top: 74px; }
  body[data-template="terminal"] .pod-diagram { top: 103px; }
  body[data-template="terminal"] .trade-diagram { top: 99px; }
  body[data-template="terminal"] .caimu-diagram { top: 83px; }
  body[data-template="terminal"] .ai-panel { padding: 30px 26px 0; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 22px; }
  body[data-template="terminal"] .ai-metric { padding-right: 22px; }
  body[data-template="terminal"] .ai-metric > strong { font-size: 4.25rem; }
  body[data-template="terminal"] .skills-grid { grid-template-columns: 1fr; }
  body[data-template="terminal"] .skill-column { position: relative; }
  body[data-template="terminal"] .skill-icon { position: absolute; right: 22px; top: 22px; }
  body[data-template="terminal"] .skill-column h3 { margin-top: 0; padding-right: 45px; }
  body[data-template="terminal"] .contact { padding: 36px; }
}

@media (max-width: 560px) {
  body:is([data-template="editorial"], [data-template="terminal"]) .wrap { width: calc(100% - 40px); }
  body:is([data-template="editorial"], [data-template="terminal"]) .header { padding-inline: 20px; height: 74px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .header-actions { gap: 9px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .hero { padding-top: 38px; padding-bottom: 74px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .hero h1 { font-size: clamp(34px, 9vw, 46px); }
  body:is([data-template="editorial"], [data-template="terminal"]) .hero-buttons { gap: 20px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .section { padding-block: 56px; }
  body:is([data-template="editorial"], [data-template="terminal"]) :is(.section h2, .experience .section-side h2) { font-size: 1.75rem; }
  body:is([data-template="editorial"], [data-template="terminal"]) .section-heading { display: block; }
  body:is([data-template="editorial"], [data-template="terminal"]) .project-open { display: flex; flex-direction: column; }
  body:is([data-template="editorial"], [data-template="terminal"]) .project-visual { height: 240px; min-height: 240px; border: 0; border-bottom: 1px solid var(--line); }
  body:is([data-template="editorial"], [data-template="terminal"]) .project-info { padding: 24px 20px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .project-meta { flex-wrap: wrap; gap: 6px 14px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .finance-diagram { top: 56px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .pod-diagram { top: 82px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .trade-diagram { top: 78px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .caimu-diagram { top: 57px; width: min(245px, 82%); }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-section { padding-top: 0; }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-panel { grid-template-columns: 1fr; gap: 26px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-copy { grid-column: auto; grid-row: auto; }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-metric { grid-column: auto; grid-row: auto; padding: 25px 0 0; border: 0; border-top: 1px solid var(--line); }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-metric > strong { font-size: 6rem; }
  body:is([data-template="editorial"], [data-template="terminal"]) .ai-process { font-size: .75rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body:is([data-template="editorial"], [data-template="terminal"]) .skills-grid { grid-template-columns: 1fr; }
  body:is([data-template="editorial"], [data-template="terminal"]) .contact h2 { font-size: clamp(26px, 7.1vw, 34px); }
  body:is([data-template="editorial"], [data-template="terminal"]) .contact-bottom { align-items: stretch; }
  body:is([data-template="editorial"], [data-template="terminal"]) .phone-link { font-size: clamp(22px, 6.2vw, 30px); }
  body:is([data-template="editorial"], [data-template="terminal"]) .phone-link > span { margin-left: 14px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .footer { flex-wrap: wrap; row-gap: 12px; }
  body[data-template="editorial"] .hero { gap: 22px; }
  body[data-template="editorial"] .system-visual { height: 250px; }
  body[data-template="editorial"] .stats { padding-block: 0; }
  body[data-template="editorial"] .stats strong { font-size: 2.625rem; }
  body[data-template="editorial"] .stats > div { padding-block: 22px; padding-right: 8px; }
  body[data-template="editorial"] .stats > div:nth-child(even) { padding-left: 16px; }
  body[data-template="editorial"] .project-card:nth-child(even) .project-visual { order: 0; }
  body[data-template="editorial"] .about-content > .large-copy { font-size: 1.3125rem; }
  body[data-template="editorial"] .ai-panel { padding-top: 32px; }
  body[data-template="editorial"] :is(.skill-column, .skill-column:first-child) { padding-left: 45px; }
  body[data-template="terminal"] .hero { display: flex; }
  body[data-template="terminal"] .system-visual { height: 310px; }
  body[data-template="terminal"] .stats { gap: 10px; }
  body[data-template="terminal"] .stats > div { padding: 18px 12px; border: 1px solid var(--line); border-top: 2px solid var(--accent); }
  body[data-template="terminal"] .stats strong { font-size: 1.875rem; }
  body[data-template="terminal"] .stats strong > span { font-size: .75rem; }
  body[data-template="terminal"] .about-content { padding-left: 20px; }
  body[data-template="terminal"] .ai-panel { padding: 26px 20px 0; }
  body[data-template="terminal"] .ai-process { display: grid; }
  body[data-template="terminal"] .experience .section-side { display: block; }
  body[data-template="terminal"] .experience .side-description { margin-block: 18px; }
  body[data-template="terminal"] .timeline { grid-template-columns: 1fr; }
  body[data-template="terminal"] .job { padding: 22px 18px; }
  body[data-template="terminal"] .skill-icon { left: auto; right: 20px; }
  body[data-template="terminal"] .contact { padding: 28px 20px; margin-bottom: 30px; }
  body[data-template="terminal"] .contact-top { flex-wrap: wrap; gap: 0; margin-bottom: 20px; }
}

@media (max-width: 360px) {
  body[data-template] .hero-buttons { gap: 15px; }
  body[data-template] .button { padding-inline: 14px; gap: 18px; }
  body[data-template] .text-button { gap: 9px; }
  body[data-template] .finance-diagram { left: 3%; right: 3%; }
  body[data-template] .diagram-spokes { gap: 4px; }
  body[data-template] .diagram-spokes span { padding-inline: 4px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .header { gap: 8px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .brand { gap: 6px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .brand-sub { letter-spacing: .08em; }
  body:is([data-template="editorial"], [data-template="terminal"]) .header-actions { gap: 5px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .resume-link { font-size: .875rem; }
  body:is([data-template="editorial"], [data-template="terminal"]) .resume-link span { margin-left: 0; }
  body:is([data-template="editorial"], [data-template="terminal"]) .project-info { padding-inline: 16px; }
  body:is([data-template="editorial"], [data-template="terminal"]) .contact-top > .mono { font-size: .5rem; }
}
