/* Theme tokens. Dark is the default (like the PRISM apps); light is chosen in
   the header toggle, remembered, or forced with ?theme=light|dark. */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1422;
  --bg-alt: #0f1c2c;
  --surface: #142537;
  --surface-2: #1a2e44;
  --text: #eef2f4;
  --text-2: #a7b8c3;
  --text-3: #7f93a1;
  --line: #24374a;
  --line-strong: #3a5064;
  --accent: #eda58b;
  --accent-strong: #d97855;
  --accent-2: #69d9c8;
  --glow: #23445a;
  --header-bg: #0b1422c7;
  --shadow: #00000066;
  --button-bg: #eef2f4;
  --button-text: #0b1422;
  --series-1: #2ba898;
  --series-2: #d9764c;
  --grid: #22364a;
  --scroll-thumb: #3a5064;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f1;
  --bg-alt: #eceeea;
  --surface: #ffffff;
  --surface-2: #f7f8f5;
  --text: #202529;
  --text-2: #5f6870;
  --text-3: #8a939a;
  --line: #dfe2df;
  --line-strong: #c9cfcd;
  --accent: #bd6848;
  --accent-strong: #d97855;
  --accent-2: #0f766e;
  --glow: #d6ebe5;
  --header-bg: #f4f4f1d1;
  --shadow: #1c29221f;
  --button-bg: #202529;
  --button-text: #ffffff;
  --series-1: #0a9484;
  --series-2: #d2693f;
  --grid: #e6e8e5;
  --scroll-thumb: #b3bcc2;
}

html { scroll-behavior: smooth; scrollbar-color: var(--scroll-thumb) transparent; scrollbar-width: thin; scrollbar-gutter: stable; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--scroll-thumb) padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-strong) padding-box; }
::selection { background: #d9785540; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  transition: background-color .25s ease, color .25s ease;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; }
.container { width: min(100% - 64px, 1240px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; z-index: 20; top: -100px; left: 20px; padding: 12px 18px; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 12px; }

/* Header */
.site-header { position: fixed; z-index: 10; top: 0; right: 0; left: 0; color: var(--text); background: var(--header-bg); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; letter-spacing: -.05em; }
.brand svg { width: 26px; height: 26px; color: var(--accent-strong); }
.site-header nav { display: flex; gap: 24px; font-size: 13px; font-weight: 650; }
.site-header nav a { position: relative; padding: 6px 0; color: var(--text-2); transition: color .2s ease; }
.site-header nav a::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; border-radius: 2px; background: var(--accent-strong); transform: scaleX(0); transition: transform .2s ease; }
.site-header nav a:hover { color: var(--text); }
.site-header nav a:hover::after, .site-header nav a:focus-visible::after { transform: scaleX(1); }
.header-tools { display: flex; align-items: center; gap: 14px; }
.header-status { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 10px; font-weight: 750; letter-spacing: .15em; white-space: nowrap; }
.header-status > span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-strong); }
.theme-toggle { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--text-2); cursor: pointer; transition: color .2s, border-color .2s; }
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun, :root[data-theme="light"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
.mobile-nav { display: none; }

/* Hero */
.hero { position: relative; overflow: hidden; background: radial-gradient(circle at 80% 30%, var(--glow) 0%, transparent 55%), var(--bg); }
.hero::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 84px 84px; mask-image: linear-gradient(90deg, transparent 35%, #000); pointer-events: none; }
.hero-inner { position: relative; display: grid; grid-template-columns: 1.03fr .97fr; gap: 56px; align-items: center; min-height: 560px; padding-top: 104px; padding-bottom: 52px; }
.hero-copy { position: relative; z-index: 2; }
.eyebrow { margin: 0; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 700; letter-spacing: .2em; }
.hero h1 { margin: 22px 0 20px; font-size: clamp(40px, 4.2vw, 60px); line-height: 1.16; letter-spacing: -.065em; font-weight: 760; white-space: nowrap; }
.hero h1 span { color: var(--accent-strong); }
.hero-lead { max-width: 540px; margin: 0; color: var(--text-2); font-size: 16px; line-height: 1.85; word-break: keep-all; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.button { display: inline-flex; align-items: center; justify-content: space-between; gap: 26px; min-width: 164px; padding: 13px 18px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13px; font-weight: 700; transition: transform .2s ease, background .2s ease; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--button-bg); border-color: var(--button-bg); color: var(--button-text); }
.button-quiet { color: var(--text); }
.button-quiet:hover { background: var(--surface); }
.button span { font-size: 16px; font-weight: 400; }
.hero-visual { position: relative; align-self: center; padding: 12px; border: 1px solid var(--line-strong); border-radius: 15px; background: var(--surface); box-shadow: 0 30px 70px var(--shadow); transform: perspective(1000px) rotateY(-5deg) rotateX(2deg); }
.hero-visual img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; }
.hero-visual-top, .hero-visual-bottom { display: flex; justify-content: space-between; gap: 12px; padding: 3px 3px 11px; color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; letter-spacing: .15em; }
.hero-visual-bottom { padding: 11px 3px 3px; }
.hero-foot { position: relative; display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .12em; }

/* Sections alternate two background steps of the same theme. */
.section { padding: 64px 0; scroll-margin-top: 62px; background: var(--bg); }
.film, .detail-section, .connection-section, .closing { background: var(--bg-alt); }
.erp-section, .reporting-section { background: var(--bg); }
.section-intro { margin-bottom: 28px; }
.intro-grid { display: grid; grid-template-columns: 1fr .55fr; gap: 40px; align-items: end; }
.section h2, .closing h2 { margin: 16px 0 0; font-size: clamp(28px, 2.9vw, 42px); line-height: 1.25; letter-spacing: -.055em; font-weight: 750; }
.intro-grid p { margin: 0 0 4px; color: var(--text-2); font-size: 15px; line-height: 1.85; word-break: keep-all; }

.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.service-panel { display: flex; flex-direction: column; min-height: 250px; padding: 28px 30px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.service-top { display: flex; justify-content: space-between; color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.service-top span:last-child { color: var(--accent-strong); font-size: 19px; line-height: 1; }
.erp-panel .service-top span:last-child { color: var(--accent-2); }
.service-panel h3 { margin: 30px 0 9px; font-size: 23px; letter-spacing: -.045em; }
.service-panel p { max-width: 480px; margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.75; word-break: keep-all; }
.service-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: auto; padding-top: 22px; }
.service-tags span { padding: 6px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--text-2); font-size: 11px; font-weight: 650; }
.service-link { display: inline-flex; align-items: center; justify-content: space-between; align-self: flex-start; gap: 36px; margin-top: 20px; padding-bottom: 4px; border-bottom: 1px solid currentColor; color: var(--text); font-size: 12px; font-weight: 700; }
.service-link:hover { color: var(--accent-strong); }
.web-panel { border-top: 3px solid var(--accent-strong); }
.erp-panel { border-top: 3px solid var(--accent-2); }

.detail-grid { display: grid; grid-template-columns: .78fr 1fr; align-items: center; gap: 48px; }
.detail-grid-reverse { grid-template-columns: 1fr .78fr; }
.detail-grid-reverse .detail-copy { order: 2; }
.detail-grid-reverse .detail-visual { order: 1; }
.detail-lead { max-width: 535px; margin: 18px 0 0; color: var(--text-2); font-size: 15px; line-height: 1.85; word-break: keep-all; }
.feature-list { margin-top: 26px; border-top: 1px solid var(--line-strong); }
.feature-list > div { display: grid; grid-template-columns: 34px 1fr; column-gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.feature-list span { padding-top: 4px; color: var(--accent-2); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.feature-list strong { font-size: 16px; letter-spacing: -.02em; }
.feature-list p { grid-column: 2; margin: 4px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.detail-visual { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 50px var(--shadow); }
.detail-visual img { width: 100%; height: auto; border-radius: 8px; }
.detail-visual figcaption { padding: 12px 4px 4px; color: var(--text-3); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; letter-spacing: .05em; }

.connection-section { overflow: hidden; background: radial-gradient(circle at 82% 25%, var(--glow), transparent 45%), var(--bg-alt); }
.flow-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; margin-top: 34px; }
.flow-track > div { position: relative; display: flex; flex-direction: column; min-height: 130px; padding: 20px; border: 1px solid var(--line); border-top: 3px solid var(--accent-2); border-radius: 11px; background: var(--surface); box-shadow: 0 18px 40px var(--shadow); }
.flow-track > div:nth-child(2n) { border-top-color: var(--accent-strong); }
.flow-track > div:not(:last-child)::after { content: "→"; position: absolute; top: 50px; right: -18px; z-index: 1; color: var(--accent-2); font-size: 22px; }
.flow-track small { color: var(--accent-2); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; letter-spacing: .15em; }
.flow-track strong { margin-top: 20px; font-size: 17px; letter-spacing: -.03em; }
.flow-track span { margin-top: 4px; color: var(--text-2); font-size: 12px; }

/* Reporting dashboard (example data) */
.reporting-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.reporting-tags span { padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--text-2); font-size: 11px; font-weight: 700; }
.dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.dash-card { position: relative; padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.dash-wide { grid-column: span 2; }
.dash-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dash-title { margin: 0; color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.dash-sub { color: var(--text-3); font-size: 11px; }
.stat-value { margin: 10px 0 2px; font-size: 30px; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-delta { color: var(--text-2); font-size: 12px; }
.stat-delta b { color: var(--accent-2); font-weight: 700; }
.spark { width: 100%; height: 38px; margin-top: 10px; }
.legend { display: flex; gap: 14px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: 12px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 2px; background: var(--series-1); }
.legend li + li i { background: var(--series-2); }
.chart { width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: inherit; }
.chart .label { fill: var(--text); font-size: 12px; font-weight: 700; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .s1 { stroke: var(--series-1); }
.chart .s2 { stroke: var(--series-2); }
.chart .area { fill: var(--series-1); opacity: .1; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .bar { fill: var(--series-1); }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.chart-tip { position: absolute; z-index: 3; min-width: 120px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); box-shadow: 0 10px 24px var(--shadow); color: var(--text); font-size: 12px; line-height: 1.6; pointer-events: none; opacity: 0; transition: opacity .12s; }
.chart-tip.is-on { opacity: 1; }
.chart-tip i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--series-1); }
.chart-tip i.s2 { background: var(--series-2); }
.dash-note { grid-column: 1 / -1; margin: 2px 2px 0; color: var(--text-3); font-size: 11px; }

/* Film */
.film.section { padding: 52px 0; background: radial-gradient(circle at 10% 0%, #69d9c81c, transparent 34%), radial-gradient(circle at 92% 100%, #d978551a, transparent 36%), var(--bg-alt); }
.film-layout { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr); gap: 48px; align-items: center; }
.film-lead { margin: 16px 0 0; color: var(--text-2); font-size: 15px; line-height: 1.8; word-break: keep-all; }
.film-chapters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 20px; }
.film-chapters button { display: flex; gap: 10px; align-items: center; padding: 7px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; transition: border-color .2s; }
.film-chapters button span { min-width: 34px; color: var(--accent); font-variant-numeric: tabular-nums; font-weight: 700; }
.film-chapters button:hover { border-color: var(--accent-2); }
.film-note { margin: 14px 0 0; color: var(--text-3); font-size: 12px; line-height: 1.6; word-break: keep-all; }
.film-frame { position: relative; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 16px; background: #0b1422; box-shadow: 0 30px 70px -30px var(--shadow); }
.film-frame > video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #0b1422; }

/* Closing & footer */
.closing { padding: 56px 0 60px; }
.closing-inner { display: grid; grid-template-columns: .3fr 1fr .56fr; gap: 36px; align-items: start; padding-top: 22px; border-top: 1px solid var(--line-strong); }
.closing h2 { margin: 0; font-size: clamp(26px, 2.6vw, 38px); }
.closing p:last-child { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.85; word-break: keep-all; }
.site-footer { background: var(--bg); border-top: 1px solid var(--line); }
.footer-inner { display: flex; align-items: center; gap: 22px; min-height: 80px; font-size: 12px; }
.footer-brand { color: var(--text); font-size: 19px; font-weight: 800; letter-spacing: -.06em; }
.footer-brand span { color: var(--accent-strong); }
.footer-inner > span:nth-child(2) { flex: 1; color: var(--text-2); }
.footer-inner a { font-weight: 750; }
.footer-inner a:hover { color: var(--accent-strong); }

@media (max-width: 1000px) {
  .film-layout { grid-template-columns: 1fr; gap: 26px; }
  .film-frame { order: -1; }
  .header-status { display: none; }
  .hero-inner { grid-template-columns: 1fr; gap: 40px; padding-top: 100px; }
  .hero h1 { white-space: normal; }
  .hero-visual { width: min(100%, 700px); transform: none; }
  .hero-foot span:nth-child(2) { display: none; }
  .detail-grid, .detail-grid-reverse { grid-template-columns: 1fr; gap: 34px; }
  .detail-grid-reverse .detail-copy, .detail-grid-reverse .detail-visual { order: initial; }
  .dash { grid-template-columns: 1fr 1fr; }
  .dash-wide { grid-column: 1 / -1; }
  .flow-track { gap: 10px; }
  .flow-track > div { min-height: 120px; padding: 15px; }
  .flow-track strong { font-size: 15px; }
  .closing-inner { grid-template-columns: 1fr 1fr; }
  .closing-inner .eyebrow { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .container { width: min(100% - 36px, 520px); }
  .intro-grid, .closing-inner { grid-template-columns: 1fr; gap: 16px; }
  .header-inner { min-height: 56px; }
  .brand { font-size: 16px; }
  .desktop-nav { display: none !important; }
  .mobile-nav { display: block; position: relative; margin-left: auto; }
  .mobile-nav summary { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
  .mobile-nav summary::-webkit-details-marker { display: none; }
  .mobile-nav nav { position: absolute; top: 44px; right: 0; z-index: 20; display: grid; min-width: 190px; padding: 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 16px 30px var(--shadow); }
  .mobile-nav nav a { padding: 10px; white-space: nowrap; }
  .hero-inner { gap: 36px; min-height: auto; padding-top: 88px; padding-bottom: 40px; }
  .hero h1 { font-size: clamp(32px, 8.4vw, 44px); }
  .hero-lead { font-size: 15px; }
  .hero-actions { margin-top: 26px; }
  .button { min-width: 0; }
  .hero-visual { padding: 8px; }
  .hero-visual-top, .hero-visual-bottom { font-size: 8px; }
  .hero-foot { font-size: 9px; }
  .section { padding: 44px 0; }
  .film.section { padding: 40px 0; }
  .section h2, .closing h2 { font-size: clamp(25px, 6.6vw, 32px); }
  .service-grid { grid-template-columns: 1fr; }
  .service-panel { min-height: 0; padding: 22px; }
  .service-panel h3 { margin-top: 22px; font-size: 21px; }
  .dash { grid-template-columns: 1fr; }
  .flow-track { grid-template-columns: 1fr; gap: 16px; margin-top: 26px; }
  .flow-track > div { min-height: 0; }
  .flow-track > div:not(:last-child)::after { top: auto; right: 50%; bottom: -22px; transform: translateX(50%); content: "↓"; }
  .flow-track strong { margin-top: 10px; }
  .closing { padding: 40px 0 44px; }
  .footer-inner { flex-wrap: wrap; gap: 8px 20px; align-content: center; padding: 22px 0; }
  .footer-inner > span:nth-child(2) { flex-basis: calc(100% - 100px); }
  .footer-inner a:last-child { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button, body { transition: none; }
}

/* Optional mechanical intro: original Hero is the default and failure state. */
.hero-stage { position: relative; }
.hero-preview { position: relative; transition: opacity .65s ease; }
.typewriter-intro { position: absolute; inset: 0; overflow: hidden; opacity: 0; visibility: hidden; border-radius: 8px; background: radial-gradient(ellipse at 52% 38%, var(--glow), transparent 70%), var(--surface); transition: opacity .65s ease; }
.typewriter-canvas { position: absolute; inset: 0; }
.typewriter-canvas canvas { display: block; width: 100%; height: 100%; }
.typewriter-label { position: absolute; z-index: 1; inset: 6px 6px auto; display: flex; justify-content: space-between; gap: 8px; font: 9px ui-monospace, monospace; letter-spacing: .1em; color: var(--text-3); pointer-events: none; }
.typewriter-label span:last-child { color: var(--accent); }
.typewriter-caption { position: absolute; z-index: 1; margin: 0; bottom: 9px; left: 5px; right: 5px; text-align: center; color: var(--text); font: 600 clamp(11px, 1.15vw, 16px) ui-monospace, monospace; text-shadow: 0 2px 12px var(--surface); pointer-events: none; }
.typewriter-progress { position: absolute; inset: auto 0 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; }
@media (min-width: 1001px) { .hero-visual.intro-active { transform: perspective(1000px) rotateY(-2deg); } }
.intro-active .hero-preview { opacity: 0; }
.intro-active .typewriter-intro { opacity: 1; visibility: visible; }
.intro-transition .typewriter-intro { opacity: 0; }
.intro-transition .hero-preview { opacity: 1; }
.typewriter-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px; margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line); color: var(--text-3); }
.typewriter-controls[hidden], .typewriter-controls button[hidden] { display: none; }
.typewriter-controls > span { font: 9px ui-monospace, monospace; letter-spacing: .04em; }
.typewriter-controls > div { display: flex; gap: 2px; }
.typewriter-controls button { border: 0; border-radius: 5px; min-height: 36px; padding: 7px; background: transparent; color: var(--text-2); font-family: inherit; font-size: 11px; cursor: pointer; }
.typewriter-controls button:hover { color: var(--text); background: var(--bg-alt); }
.typewriter-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (pointer: coarse) { .typewriter-controls button { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .hero-preview, .typewriter-intro { transition: none; } }
