/* =========================================================
   ASPECT — video ratio converter
   Work performed by HMPX Studio
   Token system
   ink        #070C15  base background
   surface    #101B2C  panel
   surface-2  #17263C  raised / hover
   line       #223047  hairline borders
   blue       #4C8DFF  primary accent (from HMPX brand blue #2563c4, lifted for dark UI)
   green      #22D3A6  signal / render accent
   amber      #FFB640  tally / attention accent
   text       #EAF0FB  primary text
   text-soft  #9FB0C9  secondary text
   text-faint #5B6C86  tertiary text
   ========================================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --ink: #070c15;
  --surface: #101b2c;
  --surface-2: #17263c;
  --line: #223047;
  --blue: #4c8dff;
  --blue-dim: #2f5fb8;
  --green: #22d3a6;
  --amber: #ffb640;
  --text: #eaf0fb;
  --text-soft: #9fb0c9;
  --text-faint: #5b6c86;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* subtle film-grain / noise atmosphere */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration: none; }
button, select { font-family: inherit; }

::selection { background: var(--blue); color: var(--ink); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(7, 12, 21, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--blue); }
.brand__text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.brand__dot { color: var(--green); }

.topbar__meta { display: flex; align-items: center; gap: 10px; }
.tc-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}
.timecode {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--green);
  letter-spacing: 0.05em;
}
.rec-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(255, 182, 64, 0.15);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.35; }
}

/* ---------- layout ---------- */
.stage { max-width: 1140px; margin: 0 auto; padding: 0 28px; position: relative; z-index: 1; }

/* ---------- hero ---------- */
.hero { padding: 76px 0 56px; max-width: 720px; }
.hero__eyebrow { margin-bottom: 22px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(76, 141, 255, 0.06);
}
.chip strong { color: var(--blue); font-weight: 600; }

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--text);
}
.ink-underline {
  position: relative;
  color: var(--blue);
}
.ink-underline::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 4px;
  height: 0.32em;
  background: rgba(76, 141, 255, 0.18);
  z-index: -1;
  border-radius: 2px;
}

.hero__sub {
  margin-top: 20px;
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 56ch;
}

.hero__cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 13px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--blue);
  color: #060a12;
}
.btn--primary:hover { background: #6ba0ff; }
.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text-soft);
}
.btn--ghost:hover { border-color: var(--blue); color: var(--text); }
.btn--sm { padding: 10px 16px; font-size: 0.82rem; }

.readout-row {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 34px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.readout { display: flex; flex-direction: column; gap: 4px; }
.readout__value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  color: var(--green);
}
.readout__label {
  font-size: 0.74rem;
  color: var(--text-faint);
}

/* ---------- panels (shared) ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
}
.panel__head { margin-bottom: 20px; }
.panel__tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--blue);
  display: block;
  margin-bottom: 8px;
}
.panel__tag--done { color: var(--green); }
.panel__head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
}

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  padding: 52px 24px;
  text-align: center;
  background: radial-gradient(circle at 50% 0%, rgba(76,141,255,0.06), transparent 60%);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
}
.dropzone.dragover {
  border-color: var(--blue);
  background: rgba(76, 141, 255, 0.08);
}
.dropzone__reel { color: var(--text-faint); margin-bottom: 14px; }
.dropzone__title { font-weight: 600; font-size: 1.05rem; margin-bottom: 6px; }
.dropzone__sub { color: var(--text-faint); font-size: 0.88rem; margin-bottom: 22px; }

/* ---------- workbench ---------- */
.workbench { display: none; }
.workbench__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 860px) {
  .workbench__grid { grid-template-columns: 1fr; }
}

.video-preview {
  width: 100%;
  border-radius: 10px;
  background: #000;
  margin-bottom: 20px;
  display: block;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
}
.info-grid__item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.info-grid__item dt {
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.info-grid__item dd {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  color: var(--text);
}
.info-grid--result .info-grid__item dd { color: var(--green); }

/* ---------- fields ---------- */
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 10px;
  letter-spacing: 0.02em;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 0.92rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239FB0C9' stroke-width='1.4' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
select:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- ratio picker ---------- */
.ratio-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.ratio-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text-soft);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ratio-swatch:hover { border-color: var(--blue-dim); }
.ratio-swatch[aria-checked="true"] {
  border-color: var(--blue);
  color: var(--text);
  background: rgba(76, 141, 255, 0.08);
}
.ratio-swatch__box {
  display: block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: rgba(255,255,255,0.03);
}
.r-16-9  { width: 32px; height: 18px; }
.r-4-3   { width: 26px; height: 19.5px; }
.r-1-1   { width: 22px; height: 22px; }
.r-9-16  { width: 12.4px; height: 22px; }
.r-21-9  { width: 34px; height: 14.5px; }

/* ---------- preview canvas ---------- */
.preview-block { margin-bottom: 24px; }
.preview-block__label {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.preview-block__ratio { color: var(--green); }
#previewCanvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #000;
  display: block;
  border: 1px solid var(--line);
}

/* ---------- convert button ---------- */
.btn--convert {
  width: 100%;
  justify-content: center;
  background: var(--green);
  color: #04241b;
  font-size: 1rem;
  padding: 15px 22px;
}
.btn--convert:hover { background: #4de0bb; }

/* ---------- export warning ---------- */
.export-warning {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 182, 64, 0.35);
  background: rgba(255, 182, 64, 0.08);
  border-radius: 9px;
  color: var(--amber);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ---------- disabled controls during export ---------- */
.ratio-swatch:disabled,
select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- progress ---------- */
.progress-section { display: none; margin-top: 18px; }
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.3s ease;
}
.progress-text {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-align: center;
}

/* ---------- download panel ---------- */
.download-panel { display: none; }
.download-panel .info-grid { margin-bottom: 24px; }

/* ---------- how it works ---------- */
.how-panel { padding: 40px 28px; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 24px; margin-top: 4px; }
.step { display: flex; gap: 20px; }
.step__index {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--blue);
  padding-top: 3px;
  flex-shrink: 0;
  width: 28px;
}
.step h3 { font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 4px; }
.step p { color: var(--text-soft); font-size: 0.92rem; max-width: 60ch; }

.fine-print {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--text-faint);
  line-height: 1.6;
  max-width: 68ch;
}

/* ---------- footer / studio credit ---------- */
.studio-footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 48px 28px 24px;
  background: linear-gradient(180deg, transparent, rgba(76,141,255,0.03));
  position: relative;
  z-index: 1;
}
.studio-footer__inner {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
}
@media (max-width: 720px) {
  .studio-footer__inner { grid-template-columns: 1fr; }
}
.studio-footer__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  display: block;
  margin-bottom: 8px;
}
.studio-footer__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--text);
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.studio-footer__name:hover { color: var(--blue); }
.studio-footer__desc {
  margin-top: 12px;
  color: var(--text-soft);
  font-size: 0.92rem;
  max-width: 46ch;
}
.studio-footer__meta { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.studio-footer__stack { display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; color: var(--text-soft); }
.studio-footer__stack .tc-label { margin-bottom: 2px; }

.studio-footer__bottom {
  max-width: 1140px;
  margin: 36px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .topbar__inner { padding: 14px 18px; }
  .stage { padding: 0 18px; }
  .hero { padding: 52px 0 40px; }
  .readout-row { grid-template-columns: repeat(2, auto); row-gap: 20px; }
  .field-row { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
}
