/* One world: a dark warm olive worktop, bone ink, a single ochre that only marks what is live.
   The page has one signature object — the converter itself — and everything else stays quiet. */

@font-face {
  font-family: 'Sentient';
  src: url('sentient-medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #13150f;
  --bg-lift: #191c14;
  --panel: #1e2118;
  --panel-2: #23271c;
  --ink: #ece7d8;
  --ink-dim: #9c9a86;
  --ink-faint: #8a8876;
  --edge: rgba(236, 231, 216, 0.11);
  --edge-strong: rgba(236, 231, 216, 0.2);
  --live: #c9922e;
  --live-dim: rgba(201, 146, 46, 0.22);
  --warn: #b4653f;
  --cut: 26px;
  --measure: 1120px;
  --display: 'Sentient', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* One directional wash from the top left, carried down the whole page so no section seams.
   Grain sits on the substrate, never over the content. */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    linear-gradient(148deg, rgba(201, 146, 46, 0.13) 0%, rgba(201, 146, 46, 0.04) 26%,
      rgba(19, 21, 15, 0) 58%),
    linear-gradient(180deg, #171a12 0%, #13150f 40%, #101208 100%);
}

body::after {
  opacity: 0.5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

.page {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 0 0;
}

.wordmark {
  font-family: var(--display);
  font-size: 21px;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark span { color: var(--live); }

.masthead nav a {
  font-size: 14px;
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 140ms ease, border-color 140ms ease;
}

.masthead nav a:hover { color: var(--ink); border-bottom-color: var(--edge-strong); }

/* ---------------------------------------------------------------- stage */

/* The first screen belongs to the tool: headline, one sentence, the object, and the line under it
   all sit inside the fold, with nothing from the next section peeking in. */
.stage {
  min-height: calc(100svh - 62px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 24px 0 32px;
}

h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.1rem, 4.3vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
  max-width: 20ch;
}

.lede {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-dim);
  font-size: 1.02rem;
}

/* ---------------------------------------------------------------- the converter */

.converter-frame {
  filter: drop-shadow(7px 9px 14px rgba(0, 0, 0, 0.5));
}

/* The one invented shape on the page: two corners cut off, like a filing card. The outline follows
   the cut because the panel is two stacked layers — an edge-coloured shape and the surface inset by
   a pixel inside it — rather than a border that a clip would slice away. */
.converter {
  --chamfer: polygon(var(--cut) 0, 100% 0, 100% 100%, calc(100% - var(--cut)) 100%,
    0 100%, 0 var(--cut));
  position: relative;
  background: var(--edge-strong);
  clip-path: var(--chamfer);
  min-height: 300px;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.35fr);
}

.converter::before {
  content: '';
  position: absolute;
  inset: 1px;
  background: var(--panel);
  clip-path: var(--chamfer);
  transition: background 180ms ease;
  z-index: 0;
}

.converter.is-dragging::before { background: var(--panel-2); }
.converter.is-dragging { background: rgba(201, 146, 46, 0.55); }

.pane, .controls { position: relative; z-index: 1; }

.pane {
  padding: 32px 26px 24px;
  min-width: 0;
}

.pane-raw {
  border-right: 1px solid var(--edge);
  background: rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.pane-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px;
}

.pane-table .pane-label {
  letter-spacing: 0.01em;
  text-transform: none;
  font-size: 13px;
  color: var(--ink-dim);
}

/* The file is longer than the pane, so it dissolves at the bottom instead of being guillotined. */
.raw {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--ink-dim);
  margin: 0;
  white-space: pre;
  overflow: hidden;
  max-height: 218px;
  mask-image: linear-gradient(to bottom, #000 78%, rgba(0, 0, 0, 0.35) 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, rgba(0, 0, 0, 0.35) 92%, transparent 100%);
}

.raw .key { color: var(--ink-faint); }
.raw .val { color: var(--ink); }

/* The read head: a warm rule travelling down the specimen while the page waits for a file.
   It stops the moment real data arrives — the demo moves, your data sits still. */
.read-head {
  position: absolute;
  left: 0;
  right: 0;
  height: 34px;
  top: 0;
  background: linear-gradient(180deg, rgba(201, 146, 46, 0) 0%, rgba(201, 146, 46, 0.09) 55%,
    rgba(201, 146, 46, 0) 100%);
  border-bottom: 1px solid rgba(201, 146, 46, 0.5);
  animation: sweep 7.5s cubic-bezier(0.6, 0, 0.4, 1) infinite;
  pointer-events: none;
}

@keyframes sweep {
  0% { transform: translateY(40px); opacity: 0; }
  8% { opacity: 1; }
  86% { opacity: 1; }
  100% { transform: translateY(320px); opacity: 0; }
}

.converter[data-state='loaded'] .read-head { display: none; }

/* There are more columns than fit; they fade out rather than ending on a hard cut, and the label
   above says the table scrolls. */
.table-scroll {
  overflow: auto;
  max-height: 218px;
  border-top: 1px solid var(--edge);
  mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent 100%);
}

table {
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
  width: max-content;
  min-width: 100%;
}

th, td {
  text-align: left;
  padding: 7px 14px 7px 0;
  white-space: nowrap;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid rgba(236, 231, 216, 0.06);
}

th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  padding-top: 10px;
  padding-bottom: 10px;
}

td { color: var(--ink-dim); }
td:first-child, th:first-child { padding-left: 2px; }
td.filled { color: var(--ink); }

/* ---------------------------------------------------------------- controls */

.controls {
  grid-column: 1 / -1;
  border-top: 1px solid var(--edge);
  padding: 18px 26px 22px 26px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  /* Without this the row's minimum content width widens the whole grid, and the page ends up wider
     than a phone screen. */
  min-width: 0;
}

.status {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 14px;
  color: var(--ink-dim);
}

.status strong { color: var(--ink); font-weight: 600; }
.status.is-error { color: var(--warn); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

button {
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--edge-strong);
  padding: 11px 18px;
  cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, 100% 100%, calc(100% - 10px) 100%, 0 100%, 0 10px);
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

button:hover:not(:disabled) { background: #2b3022; border-color: rgba(236, 231, 216, 0.34); }
button:focus-visible { outline: 2px solid var(--live); outline-offset: 2px; }

button:disabled { color: var(--ink-faint); cursor: default; border-color: var(--edge); }

button.primary { background: rgba(201, 146, 46, 0.14); border-color: rgba(201, 146, 46, 0.5); }
button.primary:hover:not(:disabled) { background: rgba(201, 146, 46, 0.22); }
/* Nothing is live until a file is loaded, so a disabled button must not look like the loud one. */
button.primary:disabled { background: transparent; border-color: var(--edge); }

button .ext { font-family: var(--mono); color: var(--live); margin-left: 7px; font-size: 12.5px; }
button:disabled .ext { color: var(--ink-faint); }

.assurance {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-faint);
  max-width: 70ch;
}

.assurance a { color: var(--ink-dim); }

/* ---------------------------------------------------------------- prose */

.prose {
  padding: 20px 0 90px;
  max-width: 68ch;
}

/* On a wide screen the headings move into a left gutter beside their text, so the section reads as
   a composed column rather than a narrow strip with the right half of the page left empty. */
@media (min-width: 1000px) {
  .prose { max-width: none; }
  .block {
    display: grid;
    grid-template-columns: 260px minmax(0, 62ch);
    column-gap: 56px;
    align-items: start;
  }
  /* Headings start on the same left edge as the headline and the panel above, so the page keeps
     one vertical axis, and heading and body top-align instead of drifting apart. */
  .block h2 { margin: 0 0 14px; }
  .block + .block { margin-top: 60px; }
  .block-body { min-width: 0; }
}

.prose h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.15;
  margin: 54px 0 14px;
}

.prose h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 30px 0 6px;
  color: var(--ink);
}

.prose p { margin: 0 0 14px; color: var(--ink-dim); }
.prose a { color: var(--ink); text-decoration-color: var(--edge-strong); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--live); }
.prose ul { margin: 0 0 16px; padding-left: 18px; color: var(--ink-dim); }
.prose li { margin-bottom: 6px; }
.prose code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--ink);
}

.app-note {
  margin-top: 44px;
  border-top: 1px solid var(--edge);
  padding-top: 22px;
  display: flex;
  gap: 18px;
  align-items: baseline;
  flex-wrap: wrap;
}

.app-note p { margin: 0; }

/* ---------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--edge);
  padding: 22px 0 40px;
  display: flex;
  gap: 10px 26px;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-faint);
}

footer a { color: var(--ink-dim); text-decoration: none; }
footer a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 860px) {
  .page { padding: 0 18px; }
  .converter { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .pane { padding: 24px 18px 18px; }
  .pane-raw { border-right: none; border-bottom: 1px solid var(--edge); }
  .raw { max-height: 168px; }
  .table-scroll { max-height: 200px; }
  .controls { padding: 16px 18px 18px; }
  .status { flex: 1 1 100%; }
  .actions { width: 100%; }
  .actions button { flex: 1 1 auto; }
  h1 { max-width: 100%; font-size: clamp(1.85rem, 7.4vw, 2.6rem); }
  .stage { min-height: 0; padding: 18px 0 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .read-head { animation: none; opacity: 0.65; transform: translateY(120px); }
  * { transition-duration: 1ms !important; }
}
