/* ==========================================================================
   Intelli Living — aperture.css  (v4 surface layer)
   Loaded last, after styles.css · flagship.css · atelier.css · hero-21x9.css.

   A4.1  Cross-document view transitions (page-to-page continuity)
   A4.2  Navigation: condense + auto-hide on scroll down, return on scroll up
   A4.3  Section rail — a quiet right-edge index with reading progress
   A4.4  Editorial line reveal — headings rise out of their own mask
   A4.5  Marquee — scroll-velocity ticker (JS driven, CSS is the fallback)
   A4.6  Mobile action dock — one-thumb conversion bar below the hero
   A4.7  Button sheen + press states, contrast & transparency preferences
   A4.8  Typographic correction for the display line

   Only transform / opacity / filter animate. Everything here degrades to the
   plain, readable site: no JS, no IntersectionObserver, reduced motion, or an
   older browser leaves the page exactly as it was before this file existed.
   ========================================================================== */

/* --------------------------------------------------------------------------
   A4.1  View transitions
   -------------------------------------------------------------------------- */
@view-transition {
  navigation: auto;
}

.nav {
  view-transition-name: studio-nav;
}

::view-transition-old(studio-nav) {
  animation: none;
  opacity: 0;
}
::view-transition-new(studio-nav) {
  animation: none;
  opacity: 1;
}

::view-transition-old(root) {
  animation: apFadeOut 180ms cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
  animation: apFadeIn 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes apFadeOut {
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes apFadeIn {
  from { opacity: 0; transform: translateY(10px); }
}

/* --------------------------------------------------------------------------
   A4.2  Navigation
   -------------------------------------------------------------------------- */
.nav-wrap {
  transition: transform 0.52s var(--ease), opacity 0.3s ease;
  will-change: transform;
}

html.ap-nav-hidden .nav-wrap {
  transform: translateY(calc(-100% - 26px));
  opacity: 0.001;
}

/* Never hide while something inside the navigation holds focus, while the
   drawer is open, or when the user prefers reduced motion. */
html.ap-nav-hidden .nav-wrap:focus-within,
html.ap-drawer-open .nav-wrap {
  transform: none;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  html.ap-nav-hidden .nav-wrap { transform: none; opacity: 1; }
}

/* --------------------------------------------------------------------------
   A4.3  Section rail
   -------------------------------------------------------------------------- */
.ap-rail {
  position: fixed;
  z-index: 120;
  right: max(18px, calc((100vw - 1240px) / 2 - 76px));
  top: 50%;
  transform: translateY(-50%);
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  opacity: 0;
  transition: opacity 0.6s ease 0.2s;
}

.ap-rail.is-ready { opacity: 1; }

@media (min-width: 1180px) {
  .ap-rail { display: flex; }
}

.ap-rail__item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  height: 26px;
  padding-inline: 0;
  border-radius: 6px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.3s ease;
}

.ap-rail__label {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(3, 5, 10, 0.74);
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-4px, -50%);
  transition: opacity 0.28s ease, transform 0.35s var(--ease);
}

.ap-rail:hover .ap-rail__label,
.ap-rail__item:focus-visible .ap-rail__label,
.ap-rail__item[aria-current="true"] .ap-rail__label {
  opacity: 1;
  transform: translate(0, -50%);
}

.ap-rail__dot {
  position: relative;
  display: block;
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: 0.42;
  transition: width 0.35s var(--ease), opacity 0.3s ease, background 0.3s ease;
}

.ap-rail__item:hover { color: var(--bone-dim); }
.ap-rail__item[aria-current="true"] { color: var(--accent); }
.ap-rail__item[aria-current="true"] .ap-rail__dot {
  width: 30px;
  opacity: 1;
  box-shadow: 0 0 12px rgba(108, 233, 255, 0.55);
}

@media (prefers-reduced-transparency: reduce) {
  .ap-rail__label { background: #05080f; }
}

/* --------------------------------------------------------------------------
   A4.4  Editorial line reveal
   -------------------------------------------------------------------------- */
.ap-mask {
  display: block;
}

.ap-mask__line {
  display: block;
  overflow: hidden;
  /* Room for descenders so the mask never clips a final glyph. */
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.ap-mask__line > span {
  display: block;
  transition: transform 1.05s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--ap-i, 0) * 90ms);
  will-change: transform;
}

/* Only content that JS has taken over is hidden before it arrives; without
   JS every line stays exactly where it was. */
.ap-mask.is-armed .ap-mask__line > span {
  transform: translate3d(0, 108%, 0);
}

.ap-mask.is-in .ap-mask__line > span { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .ap-mask.is-armed .ap-mask__line > span { transform: none; }
  .ap-mask__line > span { transition: none; }
}

/* --------------------------------------------------------------------------
   A4.5  Marquee (JS takes over; this only removes the CSS loop for it)
   -------------------------------------------------------------------------- */
.marquee[data-ap-mq] .marquee__track {
  animation: none;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.marquee[data-ap-mq]:hover .marquee__track { animation-play-state: running; }
@media (prefers-reduced-motion: reduce) {
  .marquee[data-ap-mq] .marquee__track { transform: none; }
}

/* --------------------------------------------------------------------------
   A4.6  Mobile action dock
   -------------------------------------------------------------------------- */
.ap-dock {
  position: fixed;
  z-index: 190;
  inset-inline: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(6, 9, 16, 0.9);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  transform: translateY(140%);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.35s ease;
}

@media (max-width: 899px) {
  .ap-dock { display: flex; }
}

.ap-dock.is-on { transform: none; opacity: 1; }

.ap-dock__primary,
.ap-dock__ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.ap-dock__primary {
  flex: 1 1 auto;
  background: var(--bone);
  color: #05070d;
}

.ap-dock__primary:active { background: #dfe6ea; }

.ap-dock__ghost {
  flex: 0 0 auto;
  padding-inline: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--bone-dim);
}

.ap-dock .arw { font-size: 11px; }

body.ap-dock-live { padding-bottom: 0; }

@media (max-width: 899px) {
  body.ap-dock-live { padding-bottom: 86px; }
}

@media (prefers-reduced-transparency: reduce) {
  .ap-dock { background: #060a12; backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* --------------------------------------------------------------------------
   A4.7  Buttons, contrast, transparency
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 32%, rgba(255, 255, 255, 0.55) 48%, transparent 64%);
  transform: translateX(-120%);
  opacity: 0;
  pointer-events: none;
}

.btn--ghost::before {
  background: linear-gradient(105deg, transparent 32%, rgba(140, 230, 255, 0.16) 48%, transparent 64%);
}

.btn:hover::before {
  animation: apSheen 0.9s cubic-bezier(0.33, 1, 0.68, 1);
}

.btn:active { filter: brightness(0.92); }

@keyframes apSheen {
  0% { transform: translateX(-120%); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translateX(120%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn:hover::before { animation: none; }
}

/* Cards and media frames: a hairline that lights up on hover, GPU only. */
.card,
.media-frame,
.channel,
.contact-card {
  transition: transform 0.4s var(--ease), border-color 0.4s ease, box-shadow 0.4s ease;
}

.card:hover,
.contact-card:hover {
  border-color: rgba(148, 226, 255, 0.24);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(190, 205, 225, 0.34);
    --line-strong: rgba(200, 214, 232, 0.5);
    --muted: #b6c2d3;
    --dim: #96a3b8;
  }
  .card, .channel, .contact-card { border-width: 1.5px; }
}

@media (prefers-reduced-transparency: reduce) {
  .nav {
    background: #05080f;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* --------------------------------------------------------------------------
   A4.8  Display line correction
   The headline is written as two lines. On wide screens it was breaking the
   second line ("일상은 더 / 가볍게."), so the measure and the type scale are
   balanced here to keep two lines — and only two — from 1024px up.
   -------------------------------------------------------------------------- */
@media (min-width: 1024px) {
  .hero__copy {
    max-width: min(800px, 58vw);
  }
  .hero h1 {
    font-size: clamp(46px, 7.2vw, 104px);
    letter-spacing: -0.05em;
  }
  .hero h1 .line {
    white-space: nowrap;
  }
  .hero h1 .line--indent { padding-left: 0.12em; }
  .hero__lead { max-width: 52ch; }
}

/* --------------------------------------------------------------------------
   A4.9  Horizon — the long-term expansion path (vision blocks)
   -------------------------------------------------------------------------- */
.horizon {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}

.horizon__step {
  position: relative;
  padding: 30px 28px 34px;
  border-right: 1px solid var(--line);
}

.horizon__step:last-child { border-right: 0; }

.horizon__step::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 1.1s var(--ease);
}

.horizon__step.is-in::before { width: 100%; }
.horizon__step:nth-child(2)::before { transition-delay: 0.14s; }
.horizon__step:nth-child(3)::before { transition-delay: 0.28s; }

.horizon__step {
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.horizon.is-armed .horizon__step { opacity: 0; transform: translateY(14px); }
.horizon.is-armed .horizon__step:nth-child(2) { transition-delay: 0.1s; }
.horizon.is-armed .horizon__step:nth-child(3) { transition-delay: 0.2s; }
.horizon.is-armed .horizon__step.is-in { opacity: 1; transform: none; }

.horizon__num {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.horizon__title {
  font-size: clamp(17px, 1.5vw, 20px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.35;
  margin-bottom: 10px;
}

.horizon__text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.horizon__note {
  margin-top: 18px;
  color: var(--dim);
  font-size: 12.5px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .horizon { grid-template-columns: 1fr; }
  .horizon__step {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 24px 0 26px;
  }
  .horizon__step:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .horizon.is-armed .horizon__step { opacity: 1; transform: none; transition: none; }
  .horizon__step::before { transition: none; }
}
