/* BOMView — neutral gray only. Layout: info left, upload right. */

:root {
  color-scheme: light;
  --bg: #f2f2f2;
  --surface: #f7f7f7;
  --inset: #ececec;
  --inset-hover: #e4e4e4;
  --ink: #2a2a2a;
  --body: #333;
  --muted: #666;
  --faint: #8a8a8a;
  --line: #d9d9d9;
  --line-strong: #c8c8c8;
  --hover: #3a3a3a;
  --on-ink: #f2f2f2;
  --content: 1184px;
  --header-h: 64px;
  --radius: 16px;
  --radius-sm: 8px;
  --font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Source Code Pro", Menlo, Consolas, "Liberation Mono", monospace;
  --ease: 180ms ease;
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--body);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
p {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  background: transparent;
}

a {
  color: inherit;
}

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

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid #2a2a2a;
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

#main,
[id] {
  scroll-margin-top: calc(var(--header-h) + 8px);
}

.container {
  width: min(var(--content), calc(100% - 64px));
  margin-inline: auto;
}

.page {
  padding-block: 48px 32px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.5;
  color: var(--faint);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: 8px;
  z-index: 80;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--on-ink);
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: static;
  z-index: 40;
  min-height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #2a2a2a;
  color: #f2f2f2;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
}

.header-title {
  margin: 0;
  min-width: 0;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.5;
  text-align: right;
}

.page-head {
  max-width: 42em;
  margin-bottom: 32px;
}

.page-title {
  margin-top: 8px;
  color: #2a2a2a;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.page-intro {
  margin-top: 16px;
  color: #666;
  font-size: 13px;
  line-height: 1.6;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}

.workspace > * {
  min-width: 0;
}

.bom-display,
.bom-panel {
  max-width: none;
  margin: 0;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bom-display h2,
.bom-panel h2 {
  color: #2a2a2a;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.bom-display h2 {
  margin: 16px 0 24px;
}

.bom-panel h2 {
  margin: 0 0 24px;
}

.step {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 24px;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 8px;
  background: #2a2a2a;
  color: #f2f2f2;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  vertical-align: middle;
}

.bom-illustration {
  display: grid;
  place-items: center;
  min-height: 192px;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.letter-badge {
  display: grid;
  place-items: center;
  min-width: 72px;
  height: 72px;
  padding: 0 8px;
  border-radius: 8px;
  background: #2a2a2a;
  color: #f2f2f2;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
}

.display-description,
.display-note,
.bom-hint,
.bom-drop-sub {
  color: #666;
  font-size: 13px;
  line-height: 1.6;
}

.display-description {
  margin-top: 16px;
}

.bom-summary {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.display-note {
  margin-top: 16px;
}

.bom-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 224px;
  margin: 0;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--ink);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--ease), background-color var(--ease);
}

.bom-drop:hover,
.bom-drop.is-dragover {
  border-color: var(--ink);
  background: var(--inset-hover);
}

.bom-drop.is-dragover {
  border-style: solid;
}

.bom-drop.is-disabled {
  cursor: default;
  color: var(--faint);
}

.bom-drop-title,
.bom-drop-sub {
  max-width: 100%;
  overflow-wrap: break-word;
}

.bom-drop-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  color: #2a2a2a;
}

.bom-hint {
  margin-top: 16px;
}

.bom-file-meta {
  margin-top: 16px;
  color: #666;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.bom-progress {
  margin-top: 24px;
}

.bom-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--inset);
}

.bom-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  transition: width var(--ease);
}

.bom-progress.is-processing .bom-progress-bar {
  width: 36%;
  animation: bom-slide 1.1s ease-in-out infinite;
}

.bom-progress-label {
  margin-top: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.bom-status {
  margin-top: 16px;
  color: #333;
  font-size: 15px;
  line-height: 1.6;
}

.bom-status.is-busy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: #2a2a2a;
  font-weight: 600;
}

.bom-status.is-busy::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: bom-spin 0.8s linear infinite;
}

.bom-error {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: #2a2a2a;
  font-size: 15px;
  line-height: 1.6;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--ease), color var(--ease), border-color var(--ease);
}

.btn-primary {
  background: #2a2a2a;
  border-color: #2a2a2a;
  color: #f2f2f2;
}

.btn-primary:hover {
  background: #3a3a3a;
  border-color: #3a3a3a;
}

.btn-ghost {
  height: 44px;
  min-height: 44px;
  background: #ececec;
  border-color: #c8c8c8;
  color: #2a2a2a;
}

.btn-ghost:hover {
  background: #e4e4e4;
  border-color: #c8c8c8;
}

.btn:disabled,
.btn:disabled:hover {
  background: #d9d9d9;
  border-color: #d9d9d9;
  color: #8a8a8a;
  cursor: default;
}

.site-footer {
  background: transparent;
  color: var(--faint);
  border-top: 1px solid var(--line);
  padding: 0;
  margin-top: 32px;
}

.tool-footer {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 24px 0;
  font-size: 12px;
  line-height: 1.6;
}

.tool-footer a {
  color: inherit;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}

.tool-footer a:hover {
  color: #2a2a2a;
}

@media (max-width: 760px) {
  .container {
    width: calc(100% - 32px);
  }

  .page {
    padding-block: 32px 24px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  .bom-display,
  .bom-panel {
    padding: 16px;
  }

  .bom-illustration {
    min-height: 128px;
  }

  .tool-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 520px) {
  .header-inner {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .header-title {
    flex: 1 0 100%;
    margin-left: 0;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .bom-status.is-busy::before,
  .bom-progress.is-processing .bom-progress-bar {
    animation: none;
  }

  .bom-progress.is-processing .bom-progress-bar {
    width: 100%;
    transform: none;
  }

  .bom-progress-bar,
  .bom-drop {
    transition: none;
  }
}

@media print {
  .skip-link {
    display: none !important;
  }

  .site-header,
  .site-footer {
    position: static;
    background: var(--bg);
    color: var(--ink);
  }
}

@keyframes bom-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bom-slide {
  from {
    transform: translateX(-20%);
  }

  to {
    transform: translateX(200%);
  }
}
