/* HyperBasak web design system
   Every page uses only these tokens and components.
   Pages may add layout (grid/flex placement) but no new colors, font sizes, radii, shadows or spacing values. */

/* ---------- Tokens ---------- */
:root {
  /* Color (design-system.md, toned-down screen palette) */
  --c-bg: #F3F4F6;          /* page background */
  --c-surface: #FFFFFF;     /* cards, mock windows */
  --c-ink: #16181D;         /* titles, primary button, dark sections */
  --c-text: #444444;        /* body */
  --c-muted: #888888;       /* secondary text */
  --c-line: #E8E8E8;        /* borders, dividers */
  --c-line-strong: #C4C4C4; /* inactive, input borders */
  --c-blue: #0072E0;        /* main accent */
  --c-blue-soft: #E6F1FC;   /* blue tint backgrounds */
  --c-red: #E23A18;         /* problem highlight, max 1–2 per screen */
  --c-red-soft: #FCEBE7;
  --c-blue-dark: #5AA6F5;   /* accent on dark only */
  --c-on-dark: #FFFFFF;
  --c-on-dark-text: rgba(255,255,255,.72);
  --c-on-dark-muted: rgba(255,255,255,.48);
  --c-on-dark-line: rgba(255,255,255,.14);

  /* Type: one family, six sizes */
  --font: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  --fs-display: clamp(34px, 1.4rem + 2.4vw, 56px);
  --fs-h2: clamp(28px, 1.2rem + 1.5vw, 42px);
  --fs-h3: clamp(20px, 1.05rem + .45vw, 24px);
  --fs-lead: clamp(17px, 1rem + .2vw, 19px);
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-caption: 12px;      /* smallest size anywhere, incl. mock UI */
  --lh-tight: 1.22;
  --lh-snug: 1.4;
  --lh-body: 1.65;
  --ls-tight: -0.03em;
  --ls-snug: -0.015em;

  /* Radius: three steps + pill */
  --r-sm: 6px;    /* tags inside mocks, inputs, small chips */
  --r-md: 12px;   /* cards, tabs, mock inner blocks */
  --r-lg: 20px;   /* mock windows, large panels */
  --r-pill: 999px;

  /* Spacing: 4px base */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* Borders & shadows */
  --border: 1.5px solid var(--c-line);
  --divider: 1px solid var(--c-line);
  --shadow-1: 0 1px 2px rgba(22,24,29,.05), 0 4px 16px rgba(22,24,29,.05);
  --shadow-2: 0 2px 6px rgba(22,24,29,.06), 0 20px 48px rgba(22,24,29,.10);

  /* Layout */
  --w-max: 1200px;
  --gutter: clamp(16px, 5vw, 64px);
  --hh: 64px;
  --screen: calc(100vh - var(--hh));
  --section-y: clamp(40px, 7vh, 88px);

  /* Motion */
  --ease: cubic-bezier(.2,.7,.2,1);
  --dur: .35s;
  --rotate: 7s;   /* auto-advance interval for tab sets */
}
@supports (height: 100svh) { :root { --screen: calc(100svh - var(--hh)); } }
@media (max-width: 860px) { :root { --hh: 58px; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-anchor: none; /* panel swaps must not move the page */ scroll-behavior: smooth; scroll-padding-top: var(--hh); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font: 400 var(--fs-body)/var(--lh-body) var(--font); word-break: keep-all; overflow-wrap: break-word; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--c-blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Typography ---------- */
.t-display { font-size: var(--fs-display); font-weight: 800; line-height: var(--lh-tight); letter-spacing: var(--ls-tight); color: var(--c-ink); }
.t-h2 { font-size: var(--fs-h2); font-weight: 800; line-height: var(--lh-tight); letter-spacing: var(--ls-tight); color: var(--c-ink); }
.t-h3 { font-size: var(--fs-h3); font-weight: 700; line-height: var(--lh-snug); letter-spacing: var(--ls-snug); color: var(--c-ink); }
.t-lead { font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--c-text); }
.t-body { font-size: var(--fs-body); line-height: var(--lh-body); }
.t-small { font-size: var(--fs-small); line-height: 1.55; }
.t-caption { font-size: var(--fs-caption); line-height: 1.45; color: var(--c-muted); }
.t-strong { font-weight: 700; color: var(--c-ink); }
.t-blue { color: var(--c-blue); }
.t-red { color: var(--c-red); }
.t-muted { color: var(--c-muted); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-small); font-weight: 700; color: var(--c-blue); letter-spacing: 0; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--w-max) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.section { min-height: var(--screen); display: flex; flex-direction: column; justify-content: center; padding: var(--section-y) 0; }
.section--white { background: var(--c-surface); }
.section--dark { background: var(--c-ink); color: var(--c-on-dark-text); }
.section--dark .t-display, .section--dark .t-h2, .section--dark .t-h3, .section--dark .t-strong { color: var(--c-on-dark); }
.section--dark .t-lead { color: var(--c-on-dark-text); }
.section--dark .eyebrow, .section--dark .t-blue { color: var(--c-blue-dark); }
.section--dark .t-caption, .section--dark .t-muted { color: var(--c-on-dark-muted); }
.section-head { display: flex; flex-direction: column; gap: var(--s-4); max-width: 720px; margin-bottom: var(--s-7); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-5 > * + * { margin-top: var(--s-5); }
.stack-6 > * + * { margin-top: var(--s-6); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; height: var(--hh); background: var(--c-surface); border-bottom: var(--divider); }
.site-header .container { height: 100%; display: flex; align-items: center; gap: var(--s-6); }
.brand img { height: 22px; width: auto; }
.nav { display: flex; gap: var(--s-6); margin-left: auto; font-size: var(--fs-small); font-weight: 500; color: var(--c-text); }
.nav a { padding: var(--s-2) 0; transition: color var(--dur) var(--ease); }
.nav a:hover, .nav a.is-current { color: var(--c-ink); }
.nav a.is-current { font-weight: 700; }
.menu-btn { display: none; margin-left: auto; padding: var(--s-2) var(--s-4); border: var(--border); border-radius: var(--r-pill); background: var(--c-surface); font-size: var(--fs-small); font-weight: 700; color: var(--c-ink); cursor: pointer; }
@media (max-width: 860px) {
  .site-header .btn { display: none; }
  .js .menu-btn { display: inline-flex; }
  .js .nav { position: fixed; inset: var(--hh) 0 auto 0; flex-direction: column; gap: 0; margin: 0; padding: var(--s-2) var(--gutter) var(--s-5); background: var(--c-surface); border-bottom: var(--divider); box-shadow: var(--shadow-2); font-size: var(--fs-lead); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); }
  .js .nav a { padding: var(--s-4) 0; border-bottom: var(--divider); }
  .js .menu-open .nav { opacity: 1; transform: none; pointer-events: auto; }
  .nav { flex-wrap: wrap; gap: var(--s-4); }
}

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 48px; padding: 0 var(--s-5); border-radius: var(--r-pill); border: 1.5px solid transparent; font-size: var(--fs-body); font-weight: 700; line-height: 1; cursor: pointer; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease); white-space: nowrap; }
.btn--sm { min-height: 40px; padding: 0 var(--s-4); font-size: var(--fs-small); }
.btn--primary { background: var(--c-ink); color: var(--c-on-dark); }
.btn--primary:hover { background: #000; }
.btn--ghost { background: var(--c-surface); border-color: var(--c-line-strong); color: var(--c-ink); }
.btn--ghost:hover { border-color: var(--c-ink); }
.btn--light { background: var(--c-surface); color: var(--c-ink); }
.btn--outline-light { border-color: var(--c-on-dark-line); color: var(--c-on-dark); }
.btn--outline-light:hover { border-color: var(--c-on-dark); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.link { font-weight: 700; color: var(--c-blue); }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; gap: var(--s-1); padding: var(--s-1) var(--s-3); border-radius: var(--r-pill); background: var(--c-surface); border: var(--divider); font-size: var(--fs-caption); font-weight: 500; color: var(--c-text); white-space: nowrap; }
.tag--blue { background: var(--c-blue-soft); border-color: transparent; color: var(--c-blue); font-weight: 700; }
.tag--red { background: var(--c-red-soft); border-color: transparent; color: var(--c-red); font-weight: 700; }
.tag--ink { background: var(--c-ink); border-color: transparent; color: var(--c-on-dark); font-weight: 700; }
.tag--plain { background: var(--c-bg); border-color: transparent; color: var(--c-muted); }

/* ---------- Cards ---------- */
.card { background: var(--c-surface); border: var(--border); border-radius: var(--r-md); padding: var(--s-5); }
.card--lg { border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-1); }
.card--dark { background: var(--c-ink); border-color: transparent; color: var(--c-on-dark-text); }
.card--dark .t-h3, .card--dark .t-strong { color: var(--c-on-dark); }
@media (max-width: 860px) { .card--lg { padding: var(--s-5); } }

/* ---------- Mock window (예시 화면) ---------- */
.mock { background: var(--c-surface); border: var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; font-size: var(--fs-small); color: var(--c-text); }
.mock__head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-bottom: var(--divider); }
.mock__title { font-weight: 700; color: var(--c-ink); }
.mock__head .tag:last-child { margin-left: auto; }
.mock__body { padding: var(--s-5); }
.mock__block { background: var(--c-bg); border-radius: var(--r-md); padding: var(--s-4); }
.mock__row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: var(--divider); }
.mock__row:last-child { border-bottom: 0; }
.mock__value { font-size: var(--fs-h3); font-weight: 800; letter-spacing: var(--ls-snug); color: var(--c-ink); font-variant-numeric: tabular-nums; }
.mock table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.mock th { text-align: left; font-size: var(--fs-caption); font-weight: 500; color: var(--c-muted); padding: var(--s-2) var(--s-3); border-bottom: var(--divider); }
.mock td { padding: var(--s-3); border-bottom: var(--divider); color: var(--c-ink); }
.mock tr:last-child td { border-bottom: 0; }
.mock .is-bad { color: var(--c-red); font-weight: 700; }
.mock .is-good { color: var(--c-blue); font-weight: 700; }
/* mocks are always light, also inside dark sections */
.section--dark .mock, .card--dark .mock { color: var(--c-text); }
.section--dark .mock .t-strong, .section--dark .mock .t-h3, .section--dark .mock .t-h2 { color: var(--c-ink); }
.section--dark .mock .t-caption, .section--dark .mock .t-muted { color: var(--c-muted); }
.section--dark .mock .t-blue, .section--dark .mock .eyebrow { color: var(--c-blue); }
@media (max-width: 860px) { .mock__head, .mock__body { padding-left: var(--s-4); padding-right: var(--s-4); } }

/* ---------- Rotating tabs (auto-advance, loop, click restarts timer) ---------- */
.tabs { display: flex; flex-direction: column; gap: var(--s-2); }
.tabs--row { flex-direction: row; flex-wrap: wrap; }
.tab { position: relative; display: block; width: 100%; padding: var(--s-4) var(--s-5); border: var(--border); border-radius: var(--r-md); background: var(--c-surface); text-align: left; font-size: var(--fs-body); font-weight: 500; color: var(--c-muted); cursor: pointer; overflow: hidden; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.tabs--row .tab { width: auto; padding: var(--s-2) var(--s-4); border-radius: var(--r-pill); font-size: var(--fs-small); }
.tab:hover { color: var(--c-ink); }
.tab[aria-selected="true"] { color: var(--c-ink); font-weight: 700; border-color: var(--c-ink); box-shadow: var(--shadow-1); }
.tab .tab__sub { display: block; margin-top: var(--s-1); font-size: var(--fs-small); font-weight: 400; color: var(--c-muted); }
.tab__bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--c-blue); transform: scaleX(0); transform-origin: left; }
.tab[aria-selected="true"] .tab__bar { animation: tab-progress var(--rotate) linear forwards; }
[data-rotate].is-paused .tab[aria-selected="true"] .tab__bar,
[data-rotate]:not(.is-running) .tab[aria-selected="true"] .tab__bar { animation-play-state: paused; }
@keyframes tab-progress { to { transform: scaleX(1); } }
.panel { animation: panel-in var(--dur) var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.js [role="tabpanel"][hidden] { display: none; }
@media (max-width: 860px) {
  .tabs--scroll { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); }
  .tabs--scroll::-webkit-scrollbar { display: none; }
  .tabs--scroll .tab { flex: 0 0 auto; width: auto; max-width: 80vw; scroll-snap-align: start; padding: var(--s-3) var(--s-4); font-size: var(--fs-small); }
  .tabs--scroll .tab__sub { display: none; }
}

/* ---------- Stage strip (컨설팅 → 구축) ---------- */
.stages { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2); }
.stage { padding: var(--s-3) var(--s-2); border-radius: var(--r-md); background: var(--c-surface); border: var(--border); text-align: center; font-size: var(--fs-small); font-weight: 700; color: var(--c-muted); }
.stage.is-start, .stage.is-on { border-color: transparent; }
.stage.is-start { background: var(--c-blue); color: var(--c-on-dark); }
.stage.is-on { background: var(--c-blue-soft); color: var(--c-blue); }

/* ---------- FAQ ---------- */
.faq-list { border-top: var(--divider); }
.faq-item { border-bottom: var(--divider); }
.faq-item summary { display: flex; justify-content: space-between; gap: var(--s-4); padding: var(--s-5) 0; font-size: var(--fs-lead); font-weight: 700; color: var(--c-ink); cursor: pointer; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-weight: 400; color: var(--c-muted); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { padding: 0 0 var(--s-5); max-width: 720px; }

/* ---------- Form ---------- */
.form { display: grid; gap: var(--s-4); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.field { display: grid; gap: var(--s-2); }
.field label, .field legend { font-size: var(--fs-small); font-weight: 700; color: var(--c-ink); padding: 0; }
.input { width: 100%; min-height: 48px; padding: var(--s-3) var(--s-4); border: 1.5px solid var(--c-line-strong); border-radius: var(--r-sm); background: var(--c-surface); font-size: var(--fs-body); color: var(--c-ink); transition: border-color var(--dur) var(--ease); }
.input:focus { outline: none; border-color: var(--c-blue); }
textarea.input { min-height: 96px; resize: vertical; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; padding: var(--s-2) var(--s-4); border: 1.5px solid var(--c-line-strong); border-radius: var(--r-pill); background: var(--c-surface); font-size: var(--fs-small); font-weight: 500; color: var(--c-text); cursor: pointer; transition: all var(--dur) var(--ease); }
.chip input:checked + span { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-on-dark); }
.chip input:focus-visible + span { outline: 2px solid var(--c-blue); outline-offset: 2px; }
.consent { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--fs-caption); line-height: 1.55; color: var(--c-muted); }
.consent input { margin-top: 3px; accent-color: var(--c-blue); }
.consent a { text-decoration: underline; }
.form-status { min-height: 1.5em; font-size: var(--fs-small); }
.form-status.error { color: var(--c-red); }
.form-status.ok { color: var(--c-blue); }
@media (max-width: 860px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-surface); border-top: var(--divider); padding: var(--s-7) 0; font-size: var(--fs-caption); color: var(--c-muted); }
.site-footer .container { display: grid; gap: var(--s-4); }
.site-footer img { height: 20px; width: auto; }
.biz { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); }
.biz div { display: flex; gap: var(--s-2); }
.biz dt { font-weight: 700; }
.footer-copy { display: flex; gap: var(--s-5); }
.footer-copy a { text-decoration: underline; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .tab__bar { display: none; }
}
