/* The Shopify order CSV converter (/free-tools/shopify-order-csv-to-excel/): a drop zone in the hero, then a
   workbench of ruled panels and a spreadsheet preview. Paper, ink and one cobalt accent from editorial.css; numbers in
   the mono face. */

.oct {
  --oct-fill: color-mix(in srgb, var(--cobalt) 12%, var(--card));
  --oct-mono: var(--font-mono);
}

/* ---------- Hero ---------- */
.oct-hero {
  padding-block: var(--s-6) var(--s-8);
}

.oct-hero .crumbs {
  margin-bottom: var(--s-5);
}

.oct-hero .crumbs span {
  color: var(--ink-2);
}

.oct-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-6);
  align-items: center;
}

@media (min-width: 960px) {
  .oct-hero {
    padding-block: var(--s-7) var(--s-9);
  }

  .oct-hero-grid {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    grid-template-areas: "copy drop" "points drop";
    gap: 0 var(--s-8);
  }

  .oct-hero-copy {
    grid-area: copy;
    align-self: end;
  }

  .oct-drop {
    grid-area: drop;
  }

  .oct-hero-grid > .oct-points {
    grid-area: points;
    align-self: start;
  }
}

.oct-hero h1 {
  max-width: 15ch;
  font-size: clamp(2.25rem, 1.5rem + 2.6vw, 3.5rem);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.oct-hero .mast-sub {
  max-width: 36rem;
  text-wrap: pretty;
}

.oct-points {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-5) 0 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
}

.oct-points li {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
}

.oct-points .icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  fill: none;
  stroke: var(--cobalt);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Drop zone ---------- */
.oct-drop {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  padding: var(--s-7) var(--s-5) var(--s-6);
  border: 1.5px dashed color-mix(in srgb, var(--navy) 38%, var(--paper));
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.oct-drop.is-over {
  border-color: var(--cobalt);
  background: var(--tint);
}

.oct-drop-sheet {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1fr;
  gap: 5px;
  width: 132px;
  margin-bottom: var(--s-3);
  padding: 8px;
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--navy);
  border-radius: 3px;
  background: var(--paper);
}

.oct-drop-sheet span {
  height: 9px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--navy) 22%, var(--paper));
}

.oct-drop-sheet .is-gap {
  background: transparent;
  outline: 1px dashed color-mix(in srgb, var(--navy) 26%, var(--paper));
  outline-offset: -1px;
}

@media (prefers-reduced-motion: no-preference) {
  .oct-drop-sheet .is-gap {
    animation: oct-fill 3.6s var(--ease) infinite;
  }

  .oct-drop-sheet .is-gap:nth-child(5),
  .oct-drop-sheet .is-gap:nth-child(9) {
    animation-delay: 0.25s;
  }
}

@keyframes oct-fill {
  0%,
  30% {
    background: transparent;
    outline-color: color-mix(in srgb, var(--navy) 26%, var(--paper));
  }
  45%,
  85% {
    background: var(--cobalt);
    outline-color: transparent;
  }
  100% {
    background: transparent;
  }
}

.oct-drop-title {
  font: 600 1.3125rem/1.25 var(--font-head);
  color: var(--ink);
}

.oct-drop-title code {
  font: 500 0.86em var(--oct-mono);
  overflow-wrap: anywhere;
}

.oct-drop-or {
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

.oct-pick {
  cursor: pointer;
}

.oct-pick:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.oct-drop-sample {
  max-width: 26rem;
  margin-top: var(--s-3);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.oct-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.oct-link:hover {
  color: var(--action-hover);
}

.oct-drop-error,
.oct-dl-error {
  max-width: 28rem;
  margin-top: var(--s-2);
  padding: var(--s-2) var(--s-3);
  border-left: 3px solid var(--navy);
  background: var(--paper-2);
  color: var(--ink);
  font-size: var(--fs-sm);
  text-align: left;
}

@media (max-width: 479px) {
  .oct-drop {
    padding: var(--s-6) var(--s-4) var(--s-5);
  }

  .oct-pick {
    width: 100%;
  }
}

/* ---------- Workbench ---------- */
.oct-bench {
  padding-block: var(--s-7) var(--s-8);
  border-bottom: 1px solid var(--line-2);
  background: var(--paper-2);
  scroll-margin-top: var(--header-h);
}

.oct-bench h2 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
}

.oct-bench h2:focus {
  outline: none;
}

.oct-bench-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4) var(--s-6);
  align-items: flex-end;
  justify-content: space-between;
}

.oct-file {
  margin-top: var(--s-2);
  color: var(--ink-2);
  font: 500 var(--fs-sm) var(--oct-mono);
  overflow-wrap: anywhere;
}

.oct-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

.oct-downloads .oct-dl-error {
  flex-basis: 100%;
}

@media (max-width: 479px) {
  .oct-downloads,
  .oct-downloads .btn {
    width: 100%;
  }
}

.oct-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: var(--s-5) 0 0;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
}

.oct-layout legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.oct-layout label {
  display: flex;
  flex: 1 1 18rem;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-3) var(--s-4);
  color: var(--ink-2);
  cursor: pointer;
}

.oct-layout label + label {
  border-left: 1px solid var(--line);
}

@media (max-width: 640px) {
  .oct-layout label + label {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

.oct-layout label:has(input:checked) {
  background: var(--tint);
  box-shadow: inset 0 -2px 0 var(--cobalt);
  color: var(--ink);
}

.oct-layout input {
  margin-top: 4px;
}

.oct-layout strong {
  color: var(--ink);
}

/* Totals: a ruled strip of figures. */
.oct-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr);
  margin-top: var(--s-5);
  border-block: 1px solid var(--navy);
}

.oct-totals > div {
  padding: var(--s-3) var(--s-4);
}

.oct-totals > div + div {
  border-left: 1px solid var(--line-2);
}

.oct-totals dt {
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.oct-totals dd {
  margin: 2px 0 0;
  font: 500 1.5rem/1.25 var(--oct-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.oct-revenue dd {
  display: flex;
  flex-wrap: wrap;
  gap: 2px var(--s-5);
}

.oct-money {
  white-space: nowrap;
}

.oct-money b {
  font-weight: 500;
}

@media (max-width: 719px) {
  .oct-totals {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .oct-totals > .oct-revenue {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line-2);
    border-left: 0;
  }

  .oct-totals > div {
    padding-inline: var(--s-3);
  }

  .oct-totals > div:first-child {
    padding-left: 0;
  }

  .oct-totals dd {
    font-size: 1.25rem;
  }
}

.oct-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  margin-top: var(--s-6);
}

@media (min-width: 960px) {
  .oct-grid {
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
  }

  .oct-controls {
    position: sticky;
    top: calc(var(--header-h) + var(--s-4));
    max-height: calc(100dvh - var(--header-h) - var(--s-6));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.oct-controls {
  display: grid;
  gap: var(--s-3);
  align-content: start;
}

.oct-panel {
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--card);
}

.oct-panel summary {
  display: flex;
  gap: var(--s-2);
  align-items: baseline;
  justify-content: space-between;
  min-height: 44px;
  padding: var(--s-3) var(--s-4);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.oct-panel summary::-webkit-details-marker {
  display: none;
}

.oct-panel summary::after {
  content: "+";
  margin-left: auto;
  color: var(--ink-3);
  font: 500 1.125rem/1 var(--oct-mono);
}

.oct-panel[open] summary::after {
  content: "–";
}

.oct-count {
  color: var(--ink-3);
  font: 500 var(--fs-sm) var(--oct-mono);
}

.oct-panel-body {
  display: grid;
  gap: var(--s-3);
  padding: 0 var(--s-4) var(--s-4);
}

.oct-hint {
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

.oct-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-2);
}

.oct-dates label {
  display: grid;
  gap: 2px;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.oct input[type="date"],
.oct input[type="text"] {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-sm);
}

.oct input[type="date"]:focus-visible,
.oct input[type="text"]:focus-visible {
  border-color: var(--cobalt);
  outline: 2px solid color-mix(in srgb, var(--cobalt) 30%, transparent);
  outline-offset: 0;
}

.oct-checks {
  margin: 0;
  padding: 0;
  border: 0;
}

.oct-checks legend {
  margin-bottom: var(--s-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.oct-checks > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.oct-chip {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 36px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: var(--fs-sm);
  cursor: pointer;
}

.oct-chip:has(input:checked) {
  border-color: color-mix(in srgb, var(--cobalt) 45%, var(--paper));
  background: var(--tint);
}

.oct-chip small {
  color: var(--ink-3);
  font-family: var(--oct-mono);
}

.oct-col-actions {
  display: flex;
  gap: var(--s-4);
  font-size: var(--fs-sm);
}

.oct-cols {
  display: grid;
  margin: 0 calc(var(--s-4) * -1);
  padding: 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.oct-cols li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  padding: 5px var(--s-4);
  border-bottom: 1px solid var(--line);
  opacity: 0.55;
}

.oct-cols li.is-on {
  opacity: 1;
}

.oct-cols li:focus-within {
  background: var(--tint);
  opacity: 1;
}

.oct-cols input[type="text"] {
  min-height: 34px;
  padding: 4px 6px;
  border-color: transparent;
  background: transparent;
}

.oct-cols input[type="text"]:hover {
  border-color: var(--line-2);
}

.oct-col-name {
  display: grid;
  min-width: 0;
}

.oct-col-src {
  padding-left: 7px;
  color: var(--ink-3);
  font: 500 0.6875rem var(--oct-mono);
}

.oct-move {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-2);
  font: 500 0.875rem/1 var(--oct-mono);
  cursor: pointer;
}

.oct-move:hover:not(:disabled) {
  border-color: var(--ink);
  color: var(--ink);
}

.oct-move:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Preview: the spreadsheet itself. */
.oct-preview {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow);
}

.oct-preview-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  justify-content: space-between;
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  font: 500 0.8125rem/1.5 var(--oct-mono);
}

.oct-legend {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.oct-legend i,
.oct-key {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--cobalt) 40%, var(--card));
  background: var(--oct-fill);
  vertical-align: -1px;
}

.oct-preview-scroll {
  max-height: min(70dvh, 620px);
  overflow: auto;
}

.oct-preview-scroll:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.oct-table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}

.oct-table th,
.oct-table td {
  max-width: 22rem;
  padding: 6px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oct-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper-2);
  color: var(--ink);
  font-weight: 600;
}

.oct-table .is-num {
  font-family: var(--oct-mono);
  font-size: 0.78rem;
  text-align: right;
}

.oct-table td.is-filled {
  background: var(--oct-fill);
}

.oct-table tbody tr:hover td {
  background: var(--tint);
}

.oct-table tbody tr:hover td.is-filled {
  background: color-mix(in srgb, var(--cobalt) 18%, var(--card));
}

/* The next step: after the download, where Columna takes over. */
.oct-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4) var(--s-7);
  align-items: center;
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--navy);
}

@media (min-width: 900px) {
  .oct-next {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

.oct-next h2 {
  font-size: var(--fs-lg);
}

.oct-next p {
  max-width: 44rem;
  margin-top: var(--s-2);
  color: var(--ink-2);
}

.oct-next-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3) var(--s-5);
  align-items: center;
}

.oct-next-actions a:not(.btn) {
  font-weight: 600;
}

@media (max-width: 479px) {
  .oct-next-actions .btn {
    width: 100%;
  }
}

/* ---------- Guide ---------- */
.oct-steps {
  display: grid;
  gap: var(--s-3);
  margin: 0 0 var(--s-5);
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.oct-steps li {
  position: relative;
  padding-left: 44px;
  counter-increment: step;
}

.oct-steps li::before {
  content: counter(step);
  position: absolute;
  top: -1px;
  left: 0;
  width: 28px;
  height: 28px;
  border: 1px solid var(--navy);
  border-radius: 50%;
  color: var(--ink);
  font: 500 0.8125rem/26px var(--oct-mono);
  text-align: center;
}

.oct-fill {
  margin: var(--s-6) 0 0;
  overflow-x: auto;
}

.oct-fill table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  border-top: 3px solid var(--navy);
  background: var(--card);
  font-size: var(--fs-sm);
}

.oct-fill th,
.oct-fill td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.oct-fill thead th {
  background: var(--paper);
  font-weight: 600;
}

.oct-fill td:last-child {
  font-family: var(--oct-mono);
  text-align: right;
}

.oct-fill .is-filled {
  background: var(--oct-fill);
  color: var(--cobalt-deep);
}

.oct-fill figcaption {
  margin-top: var(--s-2);
  color: var(--ink-3);
  font-size: var(--fs-sm);
}

.oct-compare th[scope="row"] {
  font-weight: 600;
}

@media (min-width: 720px) {
  .oct-compare td:last-child {
    background: var(--tint);
  }
}

.oct-tips {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.oct-tips li {
  padding-block: var(--s-4);
  border-bottom: 1px solid var(--line-2);
}

.oct-tips li:first-child {
  padding-top: 0;
}

.oct-tips h3 {
  font-size: var(--fs-md);
}

.oct-tips p {
  margin-top: var(--s-1);
  color: var(--ink-2);
}
