/* ganeumja.io design fixes (2026-10-11) — see GANEUMJA_DESIGN_FIXES.md.
   Loaded after renewal.css on the home page only. */

/* ===== design tokens ===== */
:root {
  /* brand */
  --color-brand: #5B3DF5;
  --color-brand-soft: #F7B0FF;

  /* text: 4.5:1 or better on white */
  --text-strong: #0B0B10;
  --text-body: #4A4A57;
  --text-muted: #6B6B7A;

  /* text on dark backgrounds */
  --text-on-dark: #FFFFFF;
  --text-on-dark-body: rgba(255, 255, 255, .78);

  /* surfaces */
  --surface-light: #FFFFFF;
  --surface-subtle: #F4F4F7;
  --surface-dark: #0A0810;

  /* header */
  --header-h: 72px;
  --header-bg-dark: rgba(10, 8, 16, .55);
  --header-bg-light: rgba(255, 255, 255, .82);
  --header-line-light: rgba(11, 11, 16, .06);

  /* spacing (8pt) */
  --space-1: 8px;  --space-2: 16px; --space-3: 24px;
  --space-4: 32px; --space-6: 48px; --space-8: 64px;
  --space-12: 96px; --space-16: 128px;

  --tap-min: 44px;

  /* overlays on dark sections */
  --scrim-dark: rgba(10, 8, 16, .85);
  --scrim-dark-0: rgba(10, 8, 16, 0);
  --btn-ghost-border: rgba(255, 255, 255, .5);
  --btn-ghost-bg: rgba(255, 255, 255, .06);
}

/* ===== P0-1 [S1] header follows the section under it (fixes.js sets data-header-theme) ===== */
[data-site-header] {
  background-color: var(--header-bg-dark) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  transition: background-color .25s ease, box-shadow .25s ease;
}
[data-site-header] .g-nav-trigger,
[data-site-header] #i05en-3 { transition: color .25s ease; }
[data-site-header] #i37rm-2 { transition: border-color .25s ease, background-color .25s ease; }

[data-site-header][data-header-theme="light"] {
  background-color: var(--header-bg-light) !important;
  box-shadow: 0 1px 0 var(--header-line-light);
}
[data-site-header][data-header-theme="light"] .g-nav-trigger { color: var(--text-strong); }
[data-site-header][data-header-theme="light"] .g-nav-trigger:hover,
[data-site-header][data-header-theme="light"] .g-nav-item.is-open > .g-nav-trigger { color: var(--color-brand); }
[data-site-header][data-header-theme="light"] #i37rm-2 { border-color: rgba(11, 11, 16, .24); background-color: var(--surface-light); }
[data-site-header][data-header-theme="light"] #i05en-3 { color: var(--text-strong); }
@media (prefers-reduced-motion: reduce) {
  [data-site-header], [data-site-header] * { transition: none !important; }
}

/* ===== P0-2 fixed elements must not cover content ===== */
/* KO/EN toggle sits in the desktop header, left of 문의하기 (i18n.js moves it into [data-lang-slot]) */
.g-lang-slot { display: flex; align-items: center; margin-right: var(--space-2); flex: none; }
#lang-switcher.in-header { position: static; inset: auto; }
/* the slot only exists in the desktop header; the mobile top bar keeps the floating toggle next to the menu button */
/* hero: keep the copy clear of the "scroll down" cue (cue: 16–18px from the bottom, ~70px tall) */
[data-section="S2"] #ijp7h { bottom: max(12vh, calc(104px + env(safe-area-inset-bottom))) !important; }
/* tablet widths (481–767px) also use the mobile top bar: keep the toggle in the bar, not floating over the page */
@media (max-width: 767.98px) {
  #lang-switcher:not(.in-header) { top: calc(20px + env(safe-area-inset-top)); bottom: auto; right: 64px; }
}
/* narrower desktop header (481–1023px): make room for the toggle */
@media (max-width: 1023.98px) {
  [data-site-header] #i37rm-2 { width: auto !important; padding-left: 20px; padding-right: 20px; }
  [data-site-header] #i05en-3 { white-space: nowrap; }
  [data-site-header] #irlfg-4-3 { padding-right: 24px; }
  [data-site-header] .g-nav { gap: 24px; }
}
@media (max-width: 767.98px) {
  .g-lang-slot { margin-right: var(--space-1); }
  #lang-switcher.in-header .lang-btn { min-width: 40px; padding: 8px 10px; }
  [data-site-header] #irlfg-4-3 { padding-right: 16px; }
  [data-site-header] .g-nav { gap: 16px; }
}

/* ===== P0-3 body text contrast =====
   styles.css: the 40% / 20% black text colours (#00000066, #00000033) now use var(--text-body) / var(--text-muted). */

/* ===== P0-4 [S17] Contact: copy stays readable over the bright sphere ===== */
[data-section="S17"] .g-cta { position: relative; z-index: 1; }
[data-section="S17"] .g-cta::before {
  content: ""; position: absolute; inset: -48px -64px; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, var(--scrim-dark), var(--scrim-dark-0));
}
[data-section="S17"] .g-cta-text { color: var(--text-on-dark-body); }
[data-section="S17"] .g-btn-ghost { color: var(--text-on-dark); border: 1px solid var(--btn-ghost-border); background: var(--btn-ghost-bg); }
/* S18 (chained from S17): on phones the footer sits on the same bright sphere — same scrim behind the footer */
@media (max-width: 767.98px) {
  [data-section="S18"] { isolation: isolate; }
  [data-section="S18"]::before {
    content: ""; position: absolute; inset: -40px 0 0; z-index: -1; pointer-events: none;
    background: linear-gradient(to bottom, var(--scrim-dark-0), var(--scrim-dark) 64px);
  }
}

/* ===== P1-1 no horizontal page scroll =====
   S10 (AI 분석 ↔ 사람 결정): renewal.css already treats the two cards as stacked at ≤992px (flex: 0 0 auto),
   but styles.css only stacks them at ≤480px, so between 481–992px they sat side by side at full content width. */
@media (max-width: 992px) {
  [data-section="S10"] #i8jsjl-2 { flex-direction: column !important; align-items: stretch !important; }
  [data-section="S10"] #i3krdj-4, [data-section="S10"] #i3krdj-4-3 { width: 100% !important; }
}
/* S16 (chained, same cause): the three Promise cards are "stacked" in renewal.css at ≤992px but laid out in a row by styles.css */
@media (max-width: 992px) {
  #i8jsjl-2-3 { flex-direction: column !important; }
  #i3krdj-4-4, #i3krdj-4-3-3, #i3krdj-4-3-2-2 { width: 100% !important; }
}
/* header row (fixed, so it never scrolls) still ran past the right edge at 481–640px once the toggle moved in */
@media (min-width: 481px) and (max-width: 640px) {
  [data-site-header] #irod2-4 { padding-left: 16px !important; padding-right: 16px !important; }
  [data-site-header] #idg6xj { width: 96px !important; }
  [data-site-header] #irlfg-4-3 { padding-right: 8px; }
  [data-site-header] .g-nav { gap: 10px; }
  [data-site-header] .g-nav-trigger { font-size: 14px; }
  .g-lang-slot { margin-right: 6px; }
  #lang-switcher.in-header .lang-btn { min-width: 36px; padding: 8px 8px; }
  [data-site-header] #i37rm-2 { padding-left: 12px !important; padding-right: 12px !important; }
  [data-site-header] #i05en-3 { font-size: 14px; }
}

/* ===== P1-4 [S2] hero: title → sub copy → CTA group, stacked at every width ===== */
[data-section="S2"] .g-hero-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
/* the builder nudged each button separately (top/left offsets) to line them up beside the title */
[data-section="S2"] .g-hero-ctas > #i37rm-3-3,
[data-section="S2"] .g-hero-ctas > #g-hero-btn2 { position: relative; top: auto !important; left: auto !important; right: auto; margin: 0 !important; height: 52px; }
@media (max-width: 480px) {
  [data-section="S2"] .g-hero-ctas > #i37rm-3-3,
  [data-section="S2"] .g-hero-ctas > #g-hero-btn2 { height: 48px; }
}

/* ===== P1-2 heading hierarchy + Korean line breaks =====
   Scoped to real headings: the builder also uses h2/h3 for chat words and small labels.
   Pretendard 600/700 are now self-hosted (fonts/pretendard), so these weights are real, not synthesized. */
h1, h2, h3 { word-break: keep-all; overflow-wrap: break-word; text-wrap: balance; }
p { word-break: keep-all; }

[data-section="S2"] h1#iiz3y {
  font-size: clamp(40px, 6.4vw, 88px) !important; font-weight: 700 !important;
  line-height: 1.15 !important; letter-spacing: -0.03em !important; height: auto !important;
}
[data-section="S2"] h1#iiz3y #itwt9d { font-weight: inherit !important; letter-spacing: inherit !important; }
/* builder spans inside section headings carried their own (regular) weight */
#iiz3y-3 #itbgaj, #iiz3y-3-2 #ifmw9a7, #iiz3y-4 #ixixp8 { font-weight: inherit !important; }
.g-h2,
[data-section="S3"] h2#iiz3y-3,
[data-section="S12"] h2#iiz3y-3-2,
[data-section="S17"] h2#iiz3y-4 {
  font-size: clamp(28px, 3.6vw, 48px) !important; font-weight: 650 !important;
  line-height: 1.25 !important; letter-spacing: -0.02em !important; height: auto !important;
}
.g-card-title, .g-intro-q, .g-why-title,
[data-section="S10"] h3, [data-section="S12"] h3, [data-section="S13"] h3, [data-section="S16"] h3,
#i8jsjl-2-3 h3 {
  font-weight: 600 !important; line-height: 1.35 !important;
}
/* body copy */
.g-lead, .g-card-text, .g-intro-a, .g-why-text, .g-step-text, .g-note, .g-cta-text,
.pw-user-text-style-ab493bd9-ea19-426a-9ab0-8cde8fe78f73 { line-height: 1.7 !important; }

/* ===== P1-3 one typeface: Pretendard =====
   index.html's inline @font-face list for Satoshi / Instrument (Peachworlds export) is removed — nothing renders with them.
   The few elements that still named them (or the UA default for buttons) fell back to a system font for Korean. */
#lang-switcher .lang-btn,
#ifc21b, .g-svc-name, #ix5i9e-2, #itwt9d, #i3qaw { font-family: var(--g-font) !important; }

/* ===== P1-5 [S11] chat demo: shorter pin, no blank screen after it =====
   The bubbles are driven by scroll progress through #ih1mff-2 (builder: block 400dvh, spacer 380dvh = 3,200–3,600px
   for three bubbles). Everything is scaled to one length so the bubble timing ratios stay the same:
   block = 100dvh + 1200px (pinned for ~1,200px); spacer at 5%, 95% tall, 20% lead-in, 3 × 20% steps.
   The 15% tail after the last bubble (where the white transition overlay showed an empty screen) shrinks with it. */
[data-section="S11"] { --chat-h: calc(100dvh + 1200px); height: var(--chat-h) !important; }
[data-section="S11"] #ih1mff-2 {
  top: calc(var(--chat-h) * .05) !important; height: calc(var(--chat-h) * .95) !important;
  padding-top: calc(var(--chat-h) * .2) !important;
}
[data-section="S11"] #ih1mff-2-2, [data-section="S11"] #ih1mff-2-3, [data-section="S11"] #ih1mff-2-2-2 { height: calc(var(--chat-h) * .2) !important; }
/* reduced motion: no pin — the conversation is shown all at once, in the page flow */
@media (prefers-reduced-motion: reduce) {
  /* static chat sits above the builder's white transition overlay, on its own dark surface */
  [data-section="S11"] { height: auto !important; z-index: 1 !important; background: var(--surface-dark); }
  [data-section="S11"] #ih1mff-2 { display: none !important; }
  [data-section="S11"] #ijl82-3-3-2-2 {
    position: relative !important; inset: auto !important; height: auto !important; min-height: 100dvh;
    padding-top: var(--space-16) !important; padding-bottom: var(--space-16) !important; opacity: 1 !important;
  }
  [data-section="S11"] #ijl82-3-3-2-2 * { opacity: 1 !important; transform: none !important; translate: none !important; transition: none !important; animation: none !important; }
  [data-section="S11"] .g-fx-halo, [data-section="S11"] .g-fx-orbit { display: none !important; }
}
/* S11 status chips ("분석 시작됨 ✓", "시나리오 추가됨 ✓") sit absolutely at the right of the white bubbles and ran over
   the reply text; on desktop/tablet the bubbles reserve room for them (on phones the chip already sits under the bubble) */
@media (min-width: 769px) {
  [data-section="S11"] #ico91-3-4-2, [data-section="S11"] #ico91-3-4-2-2 { padding-right: 168px !important; }
}

/* ===== P2-1 [S11] chat words are presentation, not headings =====
   Each animated word was an <h2> (83 h2s on the page). They are now aria-hidden <span>s (same ids, so the runtime
   and i18n still drive them) and the conversation is given once to assistive tech as an <ol class="sr-only">. */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[data-section="S11"] #ijl82-3-3-2-2 span.pw-text-style { display: block; }

/* ===== P2-4 touch targets (44px) and keyboard access ===== */
.skip-link {
  position: fixed; left: var(--space-2); top: -100px; z-index: 2147483647;
  padding: 14px 18px; border-radius: 10px; background: var(--surface-light); color: var(--text-strong);
  font: 600 15px/1.2 var(--g-font); text-decoration: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}
.skip-link:focus { top: var(--space-2); }
a:focus-visible, button:focus-visible, [role="button"]:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-brand) !important; outline-offset: 3px; border-radius: 6px;
}
[role="button"][data-kbd-click] { cursor: pointer; }
@media (max-width: 767.98px) {
  /* renewal.css shrank these to 34×28 on phones */
  #lang-switcher .lang-btn { min-width: var(--tap-min) !important; min-height: var(--tap-min) !important; height: var(--tap-min); line-height: var(--tap-min); padding: 0 10px !important; }
  /* pill grows to fit the 44px buttons; sits left of the 44px menu button (right 24px) */
  #lang-switcher:not(.in-header) { top: calc(16px + env(safe-area-inset-top)) !important; right: 76px !important; height: auto !important; padding: 0 !important; }
  [data-site-header] #izgbww-5 { width: var(--tap-min); min-height: var(--tap-min); top: 16px; }
  .g-intro-more,
  [data-section="S18"] a,
  .g-mnav a { display: inline-flex; align-items: center; min-height: var(--tap-min); }
  [data-section="S18"] .g-footer-nav { row-gap: 0; }
}

/* ===== P2-6 reduced motion =====
   CSS animations / transitions / smooth scrolling stop. The 3D scene (sphere, floating icons, camera moves) is a WebGL
   runtime with no pause hook, so it is not started-and-frozen but replaced: the canvas is hidden, dark sections get a
   dark surface, and the hero / contact show still frames of the same sphere (the images the sub pages already use). */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; transition-delay: 0s !important;
  }
  #ijim { display: none !important; }
  [data-theme="dark"] { background-color: var(--surface-dark); }
  [data-section="S2"] { background: linear-gradient(to top, var(--scrim-dark) 0, var(--scrim-dark-0) 70vh) 0 0 / 100% 100vh no-repeat, url('/assets/sub-sphere-center.webp') 50% 0 / cover no-repeat, var(--surface-dark); }
  [data-section="S17"] { background: url('/assets/sub-sphere-left.webp') 0% 60% / cover no-repeat, var(--surface-dark); }
  [data-section="S15"] { background-color: var(--surface-dark); }
}
/* tablets (481–1023px) get the desktop header: its menu triggers and 문의하기 also need 44px */
@media (max-width: 1023.98px) {
  [data-site-header] .g-nav-trigger { min-height: var(--tap-min); }
  [data-site-header] #i37rm-2 { min-height: var(--tap-min); display: flex; align-items: center; justify-content: center; }
}
