:root {
  color-scheme: light;
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 222.2 84% 4.9%;
  --primary: 222.2 47.4% 11.2%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --shadcn-muted: 210 40% 96.1%;
  --shadcn-muted-foreground: 215.4 16.3% 46.9%;
  --shadcn-accent: 210 40% 96.1%;
  --shadcn-accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 40% 98%;
  --shadcn-border: 214.3 31.8% 91.4%;
  --shadcn-input: 214.3 31.8% 91.4%;
  --shadcn-ring: 222.2 84% 4.9%;
  --shadcn-card-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadcn-popover-shadow:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius: 0.5rem;
  --v-bg: hsl(var(--background));
  --v-surface: hsl(var(--card));
  --v-surface-soft: hsl(var(--shadcn-muted));
  --v-text: hsl(var(--foreground));
  --v-muted: hsl(var(--shadcn-muted-foreground));
  --v-line: hsl(var(--shadcn-border));
  --v-accent: hsl(var(--primary));
  --v-accent-strong: hsl(var(--primary));
  --v-warm: hsl(var(--destructive));
  --v-shadow: var(--shadcn-card-shadow);
  /* Spacing rules: page 32/64, sections 48 apart, panels 32 inside, cards 16 inside, groups 16 apart, controls 8 apart. */
  --v-space-1: 4px;
  --v-space-2: 8px;
  --v-space-3: 12px;
  --v-space-4: 16px;
  --v-space-5: 24px;
  --v-space-6: 32px;
  --v-space-7: 48px;
  --v-space-8: 64px;
  --v-page-gutter: 20px;
  --v-page-top: var(--v-space-6);
  --v-page-bottom: var(--v-space-8);
  --v-title-gap: var(--v-space-5);
  --v-section-gap: var(--v-space-7);
  --v-section-padding: var(--v-space-6);
  --v-panel-padding: var(--v-space-5);
  --v-card-padding: var(--v-space-4);
  --v-group-gap: var(--v-space-4);
  --v-control-gap: var(--v-space-2);
  --font-sans:
    Inter, Satoshi, Montserrat, system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  --font-mono:
    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Monaco, Consolas,
    monospace;
  --page: var(--v-bg);
  --paper: var(--v-surface);
  --bg: var(--v-bg);
  --surface: var(--v-surface);
  --ink: var(--v-text);
  --text: var(--v-text);
  --muted: var(--v-muted);
  --ink-muted: var(--v-muted);
  --line: var(--v-line);
  --border: var(--v-line);
  --accent: var(--v-accent);
  --green: var(--v-accent);
  --panel: var(--v-surface);
  --green-dark: var(--v-accent-strong);
  --color-picker-line: hsl(var(--shadcn-border));
  --color-picker-surface: hsl(var(--popover));
  --color-picker-muted: hsl(var(--shadcn-muted-foreground));
  --color-picker-active: hsl(var(--primary));
  --color-picker-family-active: hsl(var(--primary) / 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--v-bg);
  color: var(--v-text);
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  letter-spacing: 0;
  line-height: 1.5;
  background: linear-gradient(
    180deg,
    hsl(var(--background)),
    hsl(var(--shadcn-muted))
  );
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    hsl(var(--background) / 0.92),
    hsl(var(--shadcn-muted) / 0.82)
  );
}

.grid-bg {
  opacity: 0.18;
}

.page-shell,
main,
.container,
.shell,
.archive-page,
.font-page {
  width: min(1160px, calc(100% - (var(--v-page-gutter) * 2)));
  margin: 0 auto;
}

.page-shell,
main,
.container,
.shell {
  padding-top: var(--v-page-top);
  padding-bottom: var(--v-page-bottom);
}

.container {
  padding-right: 0;
  padding-left: 0;
}

h1,
h2,
h3 {
  color: var(--v-text);
  letter-spacing: 0;
}

h1 {
  font-size: clamp(36px, 5.4vw, 64px);
  line-height: 1;
}

h2 {
  font-size: clamp(26px, 3.8vw, 42px);
}

p,
.lead,
.lede,
.workflow-step-text,
.page-head p,
.tool-block p,
.archive-page__lead,
.font-page-intro__lead,
.render-video-card__text,
.file-card__meta,
.file-card__details {
  color: var(--v-muted);
}

.eyebrow,
.section-kicker {
  color: var(--v-warm);
}

main > .hero:first-child,
.container > .intro:first-child,
.shell > .page-head:first-child,
.archive-page > .archive-page__intro:first-child {
  margin: 0 0 var(--v-title-gap);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

main > .hero:first-child h1,
.container > .intro:first-child h1,
.shell > .page-head:first-child h1,
.archive-page > .archive-page__intro:first-child h1 {
  margin-bottom: 10px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--v-space-5);
  margin-bottom: var(--v-title-gap);
}

.page-head p {
  max-width: 640px;
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.tool-block,
.saved-links,
.audio-panel,
.editor-card,
.workflow-step,
.step2-panel,
.step3-panel,
.final-video-panel,
.stats-panel,
.summary,
.file-card,
.archive-section,
.font-page-intro,
.font-list,
.drop-zone,
.preview-wrap {
  border: 1px solid hsl(var(--shadcn-border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--v-shadow);
}

.preview-wrap {
  padding: 22px;
}

.tool-block {
  padding: var(--v-section-padding);
  margin-bottom: var(--v-space-4);
}

.tool-block:last-child {
  border-bottom: 1px solid hsl(var(--shadcn-border));
}

.saved-links,
.audio-panel,
.workflow-step,
.archive-section,
.font-page-intro {
  padding: var(--v-section-padding);
}

.editor-card,
.stats-panel,
.file-card {
  padding: var(--v-card-padding);
}

.summary {
  overflow: hidden;
  background: var(--v-line);
}

.summary > div {
  background: var(--v-surface);
}

.summary__value,
.summary__label {
  display: block;
}

.summary__value {
  font-size: 26px;
  font-weight: 800;
}

.summary__label {
  margin-top: 4px;
  color: var(--v-muted);
  font-size: 13px;
}

.workflow-step + .workflow-step,
.archive-section + .archive-section {
  margin-top: 0;
}

.workflow-step {
  margin: 0 0 var(--v-section-gap);
  border-bottom: 1px solid hsl(var(--shadcn-border));
}

.workflow-step:last-child {
  margin-bottom: 0;
  border-bottom: 1px solid hsl(var(--shadcn-border));
}

.workflow-step[open]:has(> :not(summary):not([hidden])) > .workflow-step-head {
  margin-bottom: var(--v-panel-padding);
}

.workflow-step > .editor-section + .editor-section,
.workflow-step > .editor-section + .video-bound-panel,
.workflow-step > .video-bound-panel + .editor-section {
  margin-top: var(--v-group-gap);
}

.archive-section {
  margin: 0 0 var(--v-section-gap);
}

.archive-section:last-of-type {
  margin-bottom: 0;
}

.editor-section {
  border: 1px solid hsl(var(--shadcn-border));
  border-radius: var(--radius);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: var(--v-shadow);
}

.editor-section__summary,
.workflow-step-head {
  display: flex;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.editor-section__summary {
  align-items: center;
  justify-content: space-between;
  gap: var(--v-group-gap);
  padding: var(--v-space-4) var(--v-panel-padding);
}

.workflow-step-head {
  position: relative;
  align-items: flex-start;
  gap: var(--v-group-gap);
  width: 100%;
  max-width: none;
  padding-right: 0;
}

.workflow-step-head > div {
  flex: 1 1 auto;
  min-width: 0;
}

.editor-section__summary::-webkit-details-marker,
.workflow-step-head::-webkit-details-marker {
  display: none;
}

.editor-section__summary::after,
.workflow-step-head::after {
  content: '';
  position: static;
  top: auto;
  right: auto;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--v-muted);
  border-bottom: 2px solid var(--v-muted);
  transform: rotate(45deg);
  transition:
    transform 0.15s ease,
    margin-top 0.15s ease;
}

.editor-section__summary::after {
  margin-top: -4px;
}

.workflow-step-head::after {
  margin-top: 9px;
}

.editor-section[open] > .editor-section__summary::after,
.workflow-step[open] > .workflow-step-head::after {
  transform: rotate(-135deg);
}

.editor-section[open] > .editor-section__summary::after {
  margin-top: 2px;
}

.workflow-step[open] > .workflow-step-head::after {
  margin-top: 13px;
}

.editor-section__title {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.1;
}

.editor-section__body {
  display: grid;
  gap: var(--v-group-gap);
  padding: 0 var(--v-panel-padding) var(--v-panel-padding);
}

.editor-section__body.editor-grid {
  padding-top: 0;
}

.workflow-step .workbench,
.results,
.step2-panel,
.step3-panel,
.final-video-panel {
  margin-top: var(--v-panel-padding);
}

.step2-panel,
.step3-panel,
.final-video-panel {
  padding: var(--v-card-padding);
}

.drop-zone {
  border-style: dashed;
  background: hsl(var(--shadcn-muted));
}

.primary-link,
.secondary-link,
.primary-btn,
.ghost-btn,
.refresh-button,
.file-card__button,
.link-button,
.tool-link,
.sample-btn,
.mini-btn,
.upload-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--v-control-gap);
  border: 1px solid hsl(var(--shadcn-border));
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

button.primary-link,
button.secondary-link,
button.primary-btn,
button.ghost-btn,
button.refresh-button,
button.file-card__button,
button.link-button,
button.tool-link,
button.sample-btn,
button.mini-btn,
button.upload-button {
  cursor: pointer;
}

.primary-link,
.primary-btn,
.file-card__button--primary,
.upload-button {
  border-color: hsl(var(--primary));
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.primary-link:hover,
.primary-btn:hover,
.file-card__button--primary:hover,
.upload-button:hover {
  border-color: hsl(var(--primary) / 0.9);
  background: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
}

.secondary-link,
.ghost-btn,
.refresh-button,
.file-card__button,
.link-button,
.tool-link,
.sample-btn,
.mini-btn {
  border-color: hsl(var(--shadcn-border));
  background: hsl(var(--background));
  color: hsl(var(--secondary-foreground));
}

.secondary-link:hover,
.ghost-btn:hover,
.refresh-button:hover,
.file-card__button:hover,
.link-button:hover,
.tool-link:hover,
.sample-btn:hover,
.mini-btn:hover {
  border-color: hsl(var(--shadcn-border));
  background: hsl(var(--shadcn-accent));
  color: hsl(var(--shadcn-accent-foreground));
  transform: none;
}

.badge,
.workflow-step-badge,
.meta-chip {
  border-radius: 999px;
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.badge--local {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

input,
select,
textarea {
  border-color: hsl(var(--shadcn-input));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

input:not([type='range']):focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 2px solid hsl(var(--shadcn-ring));
  outline-offset: 2px;
}

button:disabled,
.primary-btn:disabled,
.upload-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.v-site-header {
  border-color: hsl(var(--shadcn-border));
  border-radius: var(--radius);
  background: hsl(var(--background) / 0.9);
  color: hsl(var(--foreground));
  box-shadow: var(--v-shadow);
}

.v-site-header__brand,
.v-site-header__name {
  color: hsl(var(--foreground));
}

.v-site-header__instagram,
.v-site-header__external {
  color: hsl(var(--destructive)) !important;
}

.v-site-header__instagram:hover {
  background: hsl(var(--destructive) / 0.1);
}

.v-site-header__nav a,
.v-site-header__lang a {
  border-radius: var(--radius);
  color: hsl(var(--shadcn-muted-foreground));
}

.v-site-header__nav a:hover,
.v-site-header__lang a:hover,
.v-site-header__nav a[aria-current='page'],
.v-site-header__lang a[aria-current='page'] {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.v-site-header__lang {
  border-left-color: hsl(var(--shadcn-border));
}

.file-picker {
  border-color: hsl(var(--primary));
  border-radius: var(--radius);
  background: hsl(var(--shadcn-muted));
}

.progress {
  background: hsl(var(--secondary));
}

.progress-bar {
  background: hsl(var(--primary));
}

.upload-status {
  color: hsl(var(--shadcn-muted-foreground));
}

.color-picker__trigger,
.color-picker__reset {
  border-color: hsl(var(--shadcn-border));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--shadcn-muted-foreground));
}

.color-picker__trigger:hover,
.color-picker__reset:hover {
  background: hsl(var(--shadcn-accent));
  color: hsl(var(--shadcn-accent-foreground));
}

.color-picker__selected-swatch {
  border-color: hsl(var(--shadcn-border));
  border-radius: calc(var(--radius) - 2px);
}

.color-picker__panel {
  border-color: hsl(var(--shadcn-border));
  border-radius: var(--radius);
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  box-shadow: var(--shadcn-popover-shadow);
}

.color-picker__swatch {
  border-color: hsl(var(--shadcn-border));
}

.color-picker__swatch.is-active {
  outline-color: hsl(var(--shadcn-ring));
}

.color-picker__swatch.is-family-active:not(.is-active) {
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.18);
}

.color-picker__reset.is-active {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

@media (max-width: 820px) {
  .page-shell,
  main,
  .container,
  .shell,
  .archive-page,
  .font-page {
    width: min(100% - 28px, 620px);
  }

  .tool-block,
  .saved-links,
  .audio-panel,
  .workflow-step,
  .archive-section,
  .font-page-intro {
    padding: var(--v-panel-padding);
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-step-head {
    gap: var(--v-space-3);
  }
}
