/*
 * chardsoft.com in the Chardsoft design system.
 *
 * Tokens, fonts and base rules: ../chardsoft/chardsoft.css (the
 * Chardsoft design kit, unchanged). This file lays out the website with
 * those tokens only: hairlines, 0-2 px radius, neutral grays and the
 * kit's blue accent, light and dark theme (follows the system).
 *
 * A website is not an application, so it keeps a product header and a
 * project list, drawn in the kit's language. One exception to the kit:
 * the "Chardsoft" wordmark has a quiet gradient from the text color into
 * the accent (one color family only).
 */


/* ---------- Base ---------- */

html {
  scroll-behavior: smooth;
  scroll-padding-top: 48px;
}

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

/* The footer always reaches the bottom of the window. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-surface);
}

main {
  flex: 1 0 auto;
}

a {
  color: var(--color-accent);
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

section {
  padding: var(--space-6) 0;
  border-bottom: var(--hairline) solid var(--color-border);
}


/* ---------- Header bar ---------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-panel);
  border-bottom: var(--hairline) solid var(--color-border);
}

.navbar .container {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 40px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.brand img {
  width: 22px;
  height: 22px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.nav-links a:not(.btn) {
  display: flex;
  align-items: center;
  height: 28px;
  padding: 0 var(--space-3);
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius);
}

.nav-links a:not(.btn):hover {
  background: var(--color-hover);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 32px;
  height: 28px;
  padding: 0;
  border: var(--hairline) solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.nav-toggle span {
  display: block;
  width: 14px;
  height: 1.5px;
  margin: 3px auto;
  background: var(--color-text);
}


/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 28px;
  padding: 0 var(--space-4);
  border: var(--hairline) solid var(--color-border-strong);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-md);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-text-muted);
}

.btn:active {
  background: var(--color-pressed);
}

.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-text);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn-small {
  height: 24px;
  padding: 0 var(--space-3);
}

.btn:focus-visible,
.nav-toggle:focus-visible,
.copy-btn:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: 1px;
}


/* ---------- Labels (the kit's badge) ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-panel);
  border: var(--hairline) solid var(--color-border-strong);
  white-space: nowrap;
}

.pill.live {
  color: var(--color-success);
  background: var(--color-success-subtle);
  border-color: currentColor;
}


/* ---------- Product header ---------- */

.hero {
  padding: var(--space-6) 0;
  background: var(--color-surface);
}

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

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero h1 {
  margin: var(--space-4) 0 var(--space-3);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  letter-spacing: -.01em;
}

/* Product pages: the key words in the accent. */
.hero h1 .accent {
  color: var(--color-accent);
}

/* The wordmark keeps its own gradient (the one exception to the kit):
   light "C", turquoise "hard", blue to indigo "soft". The original
   colors are for dark backgrounds; on light ones the same stops are
   darker, so the light "C" does not vanish on white. */
.brand-title {
  width: fit-content;
  background-image: linear-gradient(90deg,
    #1c4a46 0%,
    #1d7f78 10%,
    #18a399 22%,
    #14a8a0 38%,
    #1b9dbf 50%,
    #2a86e0 62%,
    #3a73f0 76%,
    #5864e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* The original gradient (dark theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .brand-title {
    background-image: linear-gradient(90deg,
      #f4fffd 0%,
      #b9f4ee 10%,
      #6ee8de 22%,
      #3ed9cf 38%,
      #33cbd6 50%,
      #44b2f0 62%,
      #4ea1ff 76%,
      #6a83ff 100%);
  }
}

:root[data-theme='dark'] .brand-title {
  background-image: linear-gradient(90deg,
    #f4fffd 0%,
    #b9f4ee 10%,
    #6ee8de 22%,
    #3ed9cf 38%,
    #33cbd6 50%,
    #44b2f0 62%,
    #4ea1ff 76%,
    #6a83ff 100%);
}

.brand-meaning {
  display: block;
  margin: calc(-1 * var(--space-1)) 0 var(--space-4);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.hero p {
  max-width: 560px;
  font-size: var(--text-lg);
  line-height: 22px;
  color: var(--color-text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.hero-logo img {
  width: 240px;
  height: 240px;
}


/* ---------- Section title ---------- */

.section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: var(--hairline) solid var(--color-border);
}

.section-title h2 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.section-title p {
  color: var(--color-text-muted);
}


/* ---------- Projects: a list, one row per project ---------- */

.grid-cards {
  display: flex;
  flex-direction: column;
  border: var(--hairline) solid var(--color-border);
}

.card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon title badge"
    "icon text  text"
    "icon link  link";
  gap: var(--space-1) var(--space-4);
  padding: var(--space-4);
  color: var(--color-text);
  text-decoration: none;
  background: var(--color-surface);
  border-bottom: var(--hairline) solid var(--color-border);
}

.card:last-child {
  border-bottom: 0;
}

a.card:hover {
  background: var(--color-surface-alt);
}

/* The head's icon and badge take their own grid places. */
.card-head {
  display: contents;
}

.card-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--color-text-muted);
  background: var(--color-panel);
  border: var(--hairline) solid var(--color-border-strong);
}

.card-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.card-head .pill {
  grid-area: badge;
  align-self: center;
}

.card h3 {
  grid-area: title;
  align-self: center;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.card p {
  grid-area: text;
  max-width: 720px;
  color: var(--color-text-muted);
}

.card-link {
  grid-area: link;
  margin-top: var(--space-1);
  color: var(--color-accent);
}

a.card:hover .card-link {
  text-decoration: underline;
}


/* ---------- Router OS: features and install ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-6);
}

.feature-text h2 {
  margin: var(--space-3) 0 var(--space-2);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

.feature-text > p {
  color: var(--color-text-muted);
}

/* What it does: a checked list in a box. */
.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: var(--space-4);
  border: var(--hairline) solid var(--color-border);
}

.check-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 28px;
  padding: var(--space-1) var(--space-3);
  border-bottom: var(--hairline) solid var(--color-border);
}

.check-list li:nth-child(odd) {
  border-right: var(--hairline) solid var(--color-border);
}

.check-list li:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.check-list li::before {
  content: "✓";
  color: var(--color-success);
  font-weight: var(--weight-semibold);
}

.feature-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* The dashboard's own status bar, as a preview. */
.router-preview {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-panel);
  border: var(--hairline) solid var(--color-border);
}

.router-preview-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}

.router-preview-row > * {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 24px;
  padding: 0 var(--space-3);
  border-right: var(--hairline) solid var(--color-border);
}

.router-preview-row .pill {
  margin: var(--space-1) 0 var(--space-1) var(--space-2);
  padding: 0 var(--space-1);
  height: 16px;
  border-right: var(--hairline) solid currentColor;
}

.router-preview-item strong {
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.router-preview-bar {
  height: 6px;
  margin: 0 var(--space-3) var(--space-2);
  background: var(--color-surface);
  border: var(--hairline) solid var(--color-border-strong);
}

.router-preview-bar i {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--color-accent);
}

/* Install: a box with a title strip and the command. */
.install {
  padding: var(--space-3);
  background: var(--color-surface);
  border: var(--hairline) solid var(--color-border);
}

.install h3 {
  display: flex;
  align-items: center;
  min-height: var(--panel-header-height);
  margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-3)) var(--space-3);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background: var(--color-panel);
  border-bottom: var(--hairline) solid var(--color-border);
}

.install p {
  color: var(--color-text-muted);
}

.command {
  display: flex;
  align-items: stretch;
  margin: var(--space-2) 0;
  background: var(--color-surface-alt);
  border: var(--hairline) solid var(--color-border-strong);
}

.command code {
  flex: 1;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-x: auto;
  white-space: nowrap;
}

.command .prompt {
  color: var(--color-text-muted);
  user-select: none;
}

.copy-btn {
  flex: none;
  padding: 0 var(--space-3);
  border: 0;
  border-left: var(--hairline) solid var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.copy-btn:hover {
  background: var(--color-hover);
}

.copy-btn.copied {
  color: var(--color-success);
}

.install-note {
  font-size: var(--text-sm);
}

.install-note code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* Several command lines: kept as written, scroll sideways if long. */
.command-block {
  align-items: flex-start;
}

.command-block code {
  white-space: pre;
  line-height: 20px;
}

.command-block .copy-btn {
  align-self: stretch;
}

.feature-side .install + .install {
  margin-top: 0;
}

/* A small table in the kit's style (e.g. where a product runs). */
.spec-table {
  width: 100%;
  margin-top: var(--space-4);
  border: var(--hairline) solid var(--color-border);
  border-collapse: collapse;
}

.spec-table caption {
  padding: 0 var(--space-3);
  min-height: var(--panel-header-height);
  line-height: var(--panel-header-height);
  text-align: left;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  background: var(--color-panel);
  border: var(--hairline) solid var(--color-border);
  border-bottom: 0;
}

.spec-table th,
.spec-table td {
  padding: var(--space-1) var(--space-3);
  text-align: left;
  vertical-align: top;
  border-bottom: var(--hairline) solid var(--color-border);
  border-right: var(--hairline) solid var(--color-border);
}

.spec-table th:last-child,
.spec-table td:last-child {
  border-right: 0;
}

.spec-table th {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  background: var(--color-panel);
}

.spec-table td:first-child {
  color: var(--color-text-muted);
}


/* ---------- Legal pages ---------- */

.legal {
  padding: var(--space-6) 0;
}

.legal-content {
  max-width: 720px;
}

.legal-content h1 {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  border-bottom: var(--hairline) solid var(--color-border);
}

.legal-content h2 {
  margin: var(--space-5) 0 var(--space-1);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
}

.legal-content p,
.legal-content li {
  max-width: 680px;
  line-height: 20px;
}

.legal-content p + p {
  margin-top: var(--space-2);
}

.legal-content ul {
  margin: var(--space-2) 0;
  padding-left: var(--space-5);
  list-style: square;
}


/* ---------- Footer ---------- */

.footer {
  padding: var(--space-5) 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-panel);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-5);
}

.footer-brand .brand {
  font-size: var(--text-md);
}

.footer-brand p {
  margin-top: var(--space-2);
}

.footer h4 {
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.footer ul li + li {
  margin-top: var(--space-1);
}

.footer a {
  color: var(--color-text);
  text-decoration: none;
}

.footer a:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: var(--hairline) solid var(--color-border);
  font-size: var(--text-xs);
}


/* ---------- Narrow windows and phones ---------- */

@media (max-width: 900px) {

  .hero-grid,
  .feature-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-logo {
    display: none;
  }

  .footer-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

}

@media (max-width: 640px) {

  .container {
    padding: 0 var(--space-5);
  }

  .nav-toggle {
    display: block;
  }

  /* The links open as a menu under the header bar. */
  .nav-links {
    position: absolute;
    top: 40px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-1) 0;
    background: var(--color-surface);
    border-bottom: var(--hairline) solid var(--color-border-strong);
    box-shadow: var(--shadow-popup);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a:not(.btn) {
    height: 36px;
    padding: 0 var(--space-5);
  }

  .nav-links .btn {
    margin: var(--space-1) var(--space-5);
  }

  .check-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .check-list li:nth-child(odd) {
    border-right: 0;
  }

  .check-list li:nth-last-child(2) {
    border-bottom: var(--hairline) solid var(--color-border);
  }

  .card {
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas:
      "icon title"
      "icon badge"
      "text text"
      "link link";
  }

  .card-head .pill {
    justify-self: start;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn {
    height: 32px;
  }

}
