/*
  Data Vortex site styles, built on the brand tokens in kk.css.
  Dark chrome, light work surface: the header and each page's intro sit on
  forest green, the work itself on cream with flat white cards. Anything
  inside .on-dark (the chrome, a forest card) switches to the dark palette.
*/

:root {
  --surface: var(--kk-cream);
  --card: var(--kk-white);
  --ink: var(--kk-ink);
  --muted: var(--fg-muted);
  --rule: #e1e1e1;
  --field-border: #c9ccc0;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  color: var(--kk-forest-green);
  letter-spacing: var(--track-display);
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.05;
}

h2 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}

h3 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--kk-forest-green);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--kk-forest-deep);
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

:focus-visible {
  outline: 2px solid var(--kk-forest-green);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ---------- the dark palette ---------- */
.on-dark {
  color: var(--fg-2-on-dark);

  h1,
  h2,
  h3 {
    color: var(--kk-white);
  }

  a {
    color: var(--kk-neon-green);
  }

  a:hover {
    color: var(--kk-white);
  }

  :focus-visible {
    outline-color: var(--kk-neon-green);
  }
}

/* ---------- layout ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: max(16px, 24px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, 24px, env(safe-area-inset-right, 0px));
}

.chrome {
  background: var(--kk-forest-green);
  overflow: hidden;
}

.brand-band {
  height: 14px;
  background: var(--kk-forest-green) url("/assets/pattern-band-d4a4926e.jpg") repeat-x left center / auto 100%;
}

.intro .container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 44px;
  padding-bottom: 48px;
}

main.container {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding-top: 48px;
  padding-bottom: 96px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

.narrow {
  width: 100%;
  max-width: 560px;
}

/* A form or main card beside a short explanation */
.split {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
  align-items: flex-start;

  > :first-child {
    flex: 2 1 520px;
    min-width: 0;
  }

  > :last-child {
    flex: 1 1 300px;
    min-width: 0;
  }
}

/* ---------- type helpers ---------- */
.eyebrow,
.lbl,
.btn,
.tag,
.chip,
.badge,
.breadcrumbs,
.table th {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
}

.eyebrow {
  font-size: 13px;
  font-weight: 500;
  color: var(--kk-forest-green);
}

.on-dark .eyebrow {
  color: var(--kk-neon-green);
}

.sub {
  max-width: 56ch;
  font-size: 19px;
  color: var(--muted);
}

.on-dark .sub {
  color: rgba(255, 255, 255, 0.8);
}

.muted,
.note {
  color: var(--muted);
}

.note {
  font-size: 15px;
}

.on-dark .muted,
.on-dark .note {
  color: rgba(255, 255, 255, 0.7);
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.error {
  color: var(--kk-orange);
  font-size: 15px;
}

.page-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: var(--radius-button);
  border: 1px solid var(--kk-forest-green);
  background: var(--kk-forest-green);
  color: var(--kk-white);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 100ms linear, color 100ms linear, border-color 100ms linear;
}

.btn:hover {
  background: var(--kk-neon-green);
  border-color: var(--kk-neon-green);
  color: var(--kk-forest-green);
}

.btn.ghost {
  font-weight: 400;
  background: transparent;
  color: var(--kk-forest-green);
  border-color: rgba(2, 98, 81, 0.35);
}

.btn.ghost:hover {
  background: var(--kk-forest-green);
  border-color: var(--kk-forest-green);
  color: var(--kk-white);
}

.on-dark .btn {
  background: var(--kk-neon-green);
  border-color: var(--kk-neon-green);
  color: var(--kk-forest-green);
}

.on-dark .btn:hover {
  background: var(--kk-white);
  border-color: var(--kk-white);
}

.on-dark .btn.ghost {
  background: transparent;
  color: var(--kk-white);
  border-color: rgba(255, 255, 255, 0.35);
}

.on-dark .btn.ghost:hover {
  border-color: var(--kk-neon-green);
  color: var(--kk-neon-green);
}

.btn.small {
  padding: 7px 14px;
  font-size: 12px;
}

.btn.done,
.on-dark .btn.done {
  background: var(--kk-neon-green);
  border-color: var(--kk-neon-green);
  color: var(--kk-forest-green);
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card.dark {
  background: var(--kk-forest-green);
}

.card > .actions {
  margin-top: auto;
  padding-top: 6px;
}

.card ol,
.card ul:not(.link-list) {
  margin: 0;
  padding-left: 1.2em;
}

.tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--kk-forest-green);
}

.on-dark .tag {
  color: var(--kk-neon-green);
}

.chip,
.badge {
  align-self: flex-start;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--kk-forest-green);
  background: var(--kk-neon-green);
  border-radius: var(--radius-button);
  padding: 4px 10px;
}

/* Home page: whole-card links to each tool */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 20px;
}

.tile {
  grid-column: span 2;
  min-height: 260px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 100ms linear;

  p {
    font-size: 17px;
    color: var(--muted);
  }

  .go {
    margin-top: auto;
    align-self: flex-end;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(2, 98, 81, 0.3);
    display: grid;
    place-items: center;
    color: var(--kk-forest-green);
    transition: background 100ms linear, color 100ms linear;
  }
}

.tile:hover {
  color: inherit;
  box-shadow: inset 0 0 0 2px var(--kk-forest-green);

  .go {
    background: var(--kk-forest-green);
    border-color: var(--kk-forest-green);
    color: var(--kk-neon-green);
  }
}

@media (max-width: 900px) {
  .tile {
    grid-column: span 6;
    min-height: 0;
  }
}

/* Numbered "how it works" steps */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 17px;

  li {
    counter-increment: step;
    display: flex;
    gap: 14px;
  }

  li::before {
    content: counter(step);
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--kk-forest-green);
    color: var(--kk-neon-green);
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
  }
}

/* ---------- forms ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.form .submit-row {
  border-top: 1px solid var(--rule);
  padding-top: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lbl {
  font-size: 13px;
  font-weight: 700;
  color: var(--kk-forest-green);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.on-dark .lbl {
  font-weight: 500;
  color: var(--kk-white);
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--kk-forest-green);
}

textarea,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  background: var(--kk-white);
  color: var(--ink);
  border: 1px solid var(--field-border);
  border-radius: var(--radius-form);
  padding: 14px 16px;
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.4;
}

input[type="number"] {
  max-width: 280px;
}

.on-dark textarea,
.on-dark input[type="text"] {
  background: var(--kk-forest-deep);
  color: var(--kk-white);
  border-color: rgba(255, 255, 255, 0.2);
}

select {
  appearance: none;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23026251' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 14px 9px;
  cursor: pointer;
}

textarea {
  min-height: 116px;
  resize: vertical;
  line-height: 1.45;
}

textarea:focus,
select:focus,
input:focus {
  outline: 2px solid var(--kk-forest-green);
  outline-offset: 1px;
  border-color: transparent;
}

.on-dark textarea:focus,
.on-dark input:focus {
  outline-color: var(--kk-neon-green);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

/* A file input drawn as a drop zone: drop a file on it or click to choose */
input[type="file"] {
  width: 100%;
  padding: 34px 20px;
  border: 1.5px dashed rgba(2, 98, 81, 0.35);
  border-radius: 14px;
  background: var(--kk-white);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 17px;
  text-align: center;
  cursor: pointer;
  transition: border-color 100ms linear, background 100ms linear;
}

input[type="file"]:hover {
  border-color: var(--kk-forest-green);
  background: var(--kk-cream);
}

input[type="file"]::file-selector-button {
  margin-right: 14px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: var(--track-eyebrow);
  font-size: 12px;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: var(--radius-button);
  border: 1px solid var(--kk-forest-green);
  background: var(--kk-forest-green);
  color: var(--kk-white);
  cursor: pointer;
}

/* ---------- flash ---------- */
.flash {
  display: flex;
  gap: 14px;
  align-items: baseline;
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 16px 22px;

  .tag {
    flex: none;
  }
}

.flash-alert .tag {
  color: var(--kk-orange);
}

/* ---------- breadcrumbs (in the dark intro) ---------- */
.breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 8px;
  opacity: 0.5;
}

.breadcrumbs a {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--kk-neon-green);
}

.breadcrumbs [aria-current] {
  color: var(--kk-neon-green);
}

/* ---------- tables ---------- */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius-card);
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  font-variant-numeric: tabular-nums;

  th,
  td {
    padding: 13px 18px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--rule);
  }

  th {
    font-size: 11px;
    font-weight: 700;
    color: var(--kk-forest-green);
    white-space: nowrap;
  }

  tbody tr:last-child td {
    border-bottom: 0;
  }

  tbody tr:hover td {
    background: var(--kk-cream);
  }

  .num {
    text-align: right;
  }

  .nowrap {
    white-space: nowrap;
  }
}

/* ---------- lists ---------- */
.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;

  li {
    border-bottom: 1px solid var(--rule);
  }

  li:last-child {
    border-bottom: 0;
  }

  a {
    display: flex;
    justify-content: space-between;
    padding: 13px 0;
    text-decoration: none;
  }

  a::after {
    content: "→";
    opacity: 0.5;
  }

  a:hover::after {
    opacity: 1;
  }
}

dl.meta {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 12px 20px;
  margin: 0;

  dt {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--track-eyebrow);
    color: var(--kk-forest-green);
    padding-top: 3px;
  }

  dd {
    margin: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 600px) {
  dl.meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;

    dd {
      margin-bottom: 10px;
    }
  }
}

/* ---------- home ---------- */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 40px;
}

.hero-text {
  flex: 0 1 720px;
  min-width: 0;
  padding: 88px 0 96px;
  display: flex;
  flex-direction: column;
  gap: 18px;

  h1 {
    font-size: clamp(2.8rem, 6vw, 4.5rem);
    line-height: 1.02;
    letter-spacing: -0.015em;
  }

  .sub {
    font-size: 21px;
  }
}

@media (max-width: 900px) {
  .hero-text {
    padding: 48px 0 24px;
  }
}

.marquee {
  background: var(--kk-neon-green);
  color: var(--kk-forest-green);
  overflow: hidden;
  white-space: nowrap;
  padding: 14px 0;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: var(--track-eyebrow);
}

.marquee-track {
  display: inline-block;
  animation: marquee 60s linear infinite;
}

@keyframes marquee {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track {
    animation: none;
  }
}

/* The brand's ring pattern, two whole rings at the right of a page intro */
.intro {
  position: relative;
}

.intro-art {
  position: absolute;
  top: 50%;
  right: max(24px, calc((100% - 1200px) / 2 + 24px));
  height: 84%;
  width: auto;
  transform: translateY(-50%);
  pointer-events: none;
}

.intro .container {
  position: relative;
  z-index: 1;
}

@media (max-width: 1100px) {
  .intro-art {
    display: none;
  }
}
