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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--fs-body);
  font-weight: 450;
  line-height: 1.65;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-slow) var(--ease-io), color var(--t-slow) var(--ease-io);
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
p,
ol,
ul,
dl,
dd,
figure {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.22;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.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;
}

/* 숫자는 좁은 폭의 Archivo — 타임코드·측정값·금액 */
.num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums lining-nums;
  font-stretch: 78%;
  letter-spacing: 0;
}

kbd {
  font-family: var(--num);
  font-stretch: 85%;
  font-size: 0.82em;
  font-weight: 600;
  padding: 0.1em 0.45em 0.12em;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--fg-2);
  background: var(--bg-hi);
}

/* 스크롤바 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

/* ─────────────── 상단 막대 ─────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 var(--gutter) 0 var(--rail);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med), background-color var(--t-slow) var(--ease-io);
}

.topbar.is-scrolled {
  border-bottom-color: var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  color: var(--fg);
}

/* 워드마크 — 'Frame.io'는 담담하게, 'Feedback AI'는 넓고 굵게. Frame.io의 마침표가 녹화등이다 */
.wm {
  display: inline-flex;
  align-items: baseline;
  gap: 0.32em;
  font-family: var(--num);
  font-size: 18px;
  line-height: 1;
  letter-spacing: -0.012em;
  white-space: nowrap;
  color: var(--fg);
}

.wm__a {
  font-weight: 400;
  font-stretch: 86%;
  color: var(--fg-3);
}

.wm__b {
  font-weight: 820;
  font-stretch: 112%;
  letter-spacing: -0.005em;
  word-spacing: 0.04em;
  color: var(--fg);
}

.wm__dot {
  display: inline-block;
  width: 0.21em;
  height: 0.21em;
  margin: 0 0.055em;
  border-radius: 50%;
  background: var(--rec);
  animation: rec-breathe var(--rec-period) var(--ease-io) infinite;
}

/* 녹화등의 숨 — 켜진 채로 천천히 흐려졌다 돌아온다. 모든 점이 같은 박자로 (util.syncRec) */
:root {
  --rec-period: 2.6s;
}

@keyframes rec-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.rec-dot {
  display: inline-block;
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rec);
  animation: rec-breathe var(--rec-period) var(--ease-io) infinite;
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  position: relative;
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--fg-3);
  transition: color var(--t-fast);
}

.nav a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-med) var(--ease-out);
}

.nav a:hover {
  color: var(--fg);
}

.nav a:hover::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.nav a[aria-current="page"] {
  color: var(--fg);
}

.clock {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 132px;
  justify-content: flex-end;
  color: var(--fg-3);
  font-size: 13px;
}

.clock__tc {
  font-size: 17px;
  font-weight: 500;
  font-stretch: 70%;
  color: var(--fg-2);
}

.clock__ff {
  color: var(--fg-4);
}

/* 세로쓰기 상태 표지 */
.vtag {
  position: fixed;
  left: calc(var(--rail) / 2 - 9px);
  top: 50%;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.32em;
  color: var(--fg-3);
  pointer-events: none;
  transition: color var(--t-slow);
}

.vtag::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--fg);
}

.vtag::after {
  content: "";
  width: 1px;
  height: 64px;
  background: var(--line-2);
}

@keyframes tally {
  50% {
    opacity: 0.15;
  }
}

/* ─────────────── 화면 전환 ─────────────── */

#view {
  position: relative;
  min-height: calc(100vh - 64px);
}

.view-enter {
  animation: gate-open 620ms var(--ease-out) both;
}

@keyframes gate-open {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

.gate-line {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 60;
  height: 1px;
  background: var(--fg);
  pointer-events: none;
  animation: gate-line 620ms var(--ease-out) both;
}

@keyframes gate-line {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  to {
    transform: translateY(calc(100vh - 64px));
    opacity: 0;
  }
}

.dimmer {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

@media (max-width: 760px) {
  .topbar {
    gap: 12px;
    padding: 0 16px;
    height: 56px;
  }
  .nav a {
    padding: 8px 8px;
    font-size: 13.5px;
  }
  .nav a::after {
    left: 8px;
    right: 8px;
  }
  .clock {
    display: none;
  }
  .vtag {
    display: none;
  }
  #view {
    min-height: calc(100vh - 56px);
  }
}

/* 좁은 화면: 메뉴 이름에서 '검수'를 빼고 워드마크를 조금 줄인다 */
@media (max-width: 520px) {
  .nav__pre {
    display: none;
  }
  .nav {
    gap: 0;
  }
  .wm {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
