/* =========================================================
   INDEXIA — 회사 소개 랜딩페이지
   활자 우선 · 정렬 (Type-First on a Swiss grid)
   White base · near-black type · single rationed blue accent
   Structure carried by 1px hairlines, not boxes.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* color */
  --bg: #ffffff;
  --surface: #f6f7f9;       /* the single tint: About + Contact 'rest' bands */
  --placeholder: #eef0f3;   /* image placeholder fill */
  --ink: #0b1220;           /* text primary — near-black navy (logo ink) */
  --muted: #5a6472;         /* text secondary — default reading color */
  --faint: #8a93a3;         /* placeholder labels */
  --line: #e6e8ec;          /* hairline — the primary structural device */
  --line-strong: #d5d9e0;   /* slightly stronger hairline (ghost button) */
  --accent: #2563eb;        /* logo-X blue */
  --accent-hover: #1d4ed8;
  --focus: rgba(37, 99, 235, 0.32);
  --navy: #0f1c3f;          /* IX badge navy */

  /* type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* layout */
  --maxw: 1200px;
  --gutter: clamp(20px, 5vw, 40px);
  --col-gap: clamp(24px, 3vw, 40px);
  --section-pad: clamp(6rem, 12vw, 10rem);
  --header-h: 64px;
}

@media (min-width: 1024px) {
  :root { --header-h: 72px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.78;
  letter-spacing: 0;
  /* Korean line-breaking: wrap between 어절(단어), never inside one;
     break only truly-unbreakable long tokens to avoid overflow */
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, figure, ol { margin: 0; }
ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
/* Skip-link lands focus on <main tabindex="-1">; don't draw a ring around the whole region */
#main:focus { outline: none; }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--col-gap);
}

.section {
  padding-block: var(--section-pad);
  border-top: 1px solid var(--line);
}
.section--tint { background: var(--surface); }

/* ---------- Shared: eyebrow ---------- */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.eyebrow__dot {
  width: 6px;
  height: 6px;
  background: var(--accent);
  flex: none;
}
.eyebrow__text {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Shared: section heading ---------- */
.section__title {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.section__head { margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section__intro {
  margin-top: 16px;
  max-width: 46ch;
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: #fff; }

/* ---------- Arrow link (product / inline) ---------- */
.link-arrow {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 24px;
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: border-bottom-width 0.15s ease, color 0.15s ease;
}
.link-arrow__icon {
  color: var(--accent);
  transition: transform 0.15s ease;
}
.link-arrow:hover { border-bottom-width: 2px; }
.link-arrow:hover .link-arrow__icon { transform: translate(2px, -2px); }

/* =========================================================
   Header
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.brand__name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.primary-nav a {
  position: relative;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.15s ease;
}
.primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.15s ease;
}
.primary-nav a:hover { color: var(--ink); }
.primary-nav a.is-active { color: var(--ink); }
.primary-nav a.is-active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--ink);
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  padding-top: calc(clamp(3rem, 6vw, 5.5rem));
  padding-bottom: var(--section-pad);
}
.hero__grid { align-items: center; }
.hero__text { grid-column: 1 / 7; }
.hero__figure { grid-column: 8 / 13; }

.hero__title {
  font-size: clamp(2.5rem, 1.6rem + 3.8vw, 4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 28px;
}
.hero__lead {
  max-width: 46ch;
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 36px;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* =========================================================
   Figures (editorial, with graceful placeholder)
   ========================================================= */
.figure {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.figure__media {
  position: relative;
  width: 100%;
  background: var(--placeholder);
  border-radius: 4px;
  overflow: hidden;
}
.figure__media--portrait { aspect-ratio: 4 / 5; }
.figure__media--landscape { aspect-ratio: 4 / 3; }

.figure__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
/* Placeholder shown when the <img> is absent/failed (img removed via onerror) */
.figure__ph {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.figure__phmark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  position: relative;
  opacity: 0.5;
}
.figure__phmark::before,
.figure__phmark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
}
.figure__phmark::before { /* white I */
  width: 4px; height: 16px;
  background: #fff;
  transform: translate(-9px, -50%);
}
.figure__phmark::after {  /* blue X (simplified as a slash) */
  width: 4px; height: 20px;
  background: var(--accent);
  transform: translate(4px, -50%) rotate(24deg);
}
.figure__phlabel {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.figure__cap {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* =========================================================
   About
   ========================================================= */
.about__grid { row-gap: clamp(2.5rem, 5vw, 3.5rem); }
.about__head { grid-column: 1 / 9; }
.about__figure { grid-column: 1 / 6; align-self: start; }
.about__text {
  grid-column: 7 / 13;
  align-self: start;
  max-width: 640px;
}
.about__text p { color: var(--muted); }
.about__text p + p { margin-top: 20px; }

/* =========================================================
   Products
   ========================================================= */
.products .section__head-inner { grid-column: 1 / 9; }

.product {
  align-items: center;
  row-gap: clamp(2rem, 4vw, 2.5rem);
}
.product + .product {
  margin-top: clamp(5rem, 9vw, 8rem);
  padding-top: clamp(5rem, 9vw, 8rem);
  border-top: 1px solid var(--line);
}
/* keep image + text on the same grid row regardless of column order
   (product 02 places the image in later columns first, which would otherwise
   push the text to a new row) */
.product__figure,
.product__text { grid-row: 1; }
.product--a .product__figure { grid-column: 1 / 7; }
.product--a .product__text { grid-column: 8 / 13; }
.product--b .product__figure { grid-column: 8 / 13; }
.product--b .product__text { grid-column: 1 / 6; }

.product__index {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.product__name {
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.625rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.product__name-en {
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.product__tagline {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}
.product__desc {
  max-width: 52ch;
  color: var(--muted);
}

/* =========================================================
   Philosophy
   ========================================================= */
.philosophy__list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 3vw, 40px);
}
.philosophy__item {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.philosophy__num {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 500;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-bottom: 20px;
}
.philosophy__title {
  font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.625rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.philosophy__desc {
  color: var(--muted);
  max-width: 34ch;
}

/* =========================================================
   Contact
   ========================================================= */
.contact__inner { max-width: 860px; }
.contact__title { margin-bottom: 16px; }
.contact__lead {
  font-size: clamp(1.125rem, 1.05rem + 0.4vw, 1.3125rem);
  color: var(--muted);
  margin-bottom: 40px;
}
.contact__action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(20px, 4vw, 40px);
}
.contact__email {
  font-size: clamp(1.5rem, 1rem + 2.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 4px;
  transition: border-bottom-width 0.15s ease;
}
.contact__email:hover { border-bottom-width: 2px; }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding-top: clamp(3rem, 6vw, 5rem);
  padding-bottom: 40px;
}
.site-footer__top {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.site-footer__tagline {
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-footer__legal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 32px;
}
.site-footer__legal > div { display: flex; flex-direction: column; gap: 4px; }
.site-footer__legal-wide { grid-column: 1 / -1; }
.site-footer__legal dt {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.site-footer__legal dd {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.site-footer__legal dd a { text-decoration: none; }
.site-footer__legal dd a:hover { color: var(--ink); }

.site-footer__bottom {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer__copy {
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer__nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.site-footer__nav a {
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.site-footer__nav a:hover { color: var(--ink); }

/* =========================================================
   Motion — scroll reveal (JS-enhanced, reduced-motion safe)
   ========================================================= */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .hero__grid,
  .about__grid,
  .product { row-gap: clamp(2rem, 6vw, 3rem); }

  .hero__text,
  .hero__figure,
  .about__head,
  .about__figure,
  .about__text,
  .products .section__head-inner,
  .product--a .product__figure,
  .product--a .product__text,
  .product--b .product__figure,
  .product--b .product__text {
    grid-column: 1 / -1;
  }

  /* keep product image above text on mobile regardless of desktop order.
     reset align-items:center (desktop grid rule) → stretch so the figure
     fills the column width instead of collapsing to its content width */
  .product { display: flex; flex-direction: column; align-items: stretch; }
  .product__figure { order: 0; }
  .product__text { order: 1; }

  .about__text { max-width: none; }
}

@media (max-width: 720px) {
  .philosophy__list { grid-template-columns: 1fr; }
  .philosophy__desc { max-width: none; }

  .site-footer__top { grid-template-columns: 1fr; }
  .site-footer__legal { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .nav-toggle { display: inline-flex; }

  .primary-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 12px;
    display: none;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
  }
  .primary-nav a:last-child { border-bottom: none; }
  .primary-nav a::after { display: none; }

  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }

  .contact__action { flex-direction: column; align-items: stretch; }
  .contact__action .btn { width: 100%; }
}

@media (max-width: 420px) {
  .site-footer__legal { grid-template-columns: 1fr; }
  .site-footer__legal-wide { grid-column: auto; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * , *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
