/* adiworks.dev: design tokens and component styles layered on Bootstrap 5.3 */

/* Light theme (default). Dark theme overrides follow in :root[data-theme="dark"]. */
:root {
  color-scheme: light;

  --ink: #2e3524;
  --ink-rgb: 46, 53, 36;
  --ink-muted: rgba(var(--ink-rgb), 0.72);
  --ink-hairline: rgba(var(--ink-rgb), 0.25);
  --ink-hover: #434c36;
  --ink-active: #1f2418;
  --paper: #f7f2eb;
  --paper-deep: #eae2d6;
  --surface: var(--paper);
  --live: #8b9a6e;

  /* Per-app themes (accent square, tag fill, "open" command colour) */
  --sage-accent: #7ea99f;
  --sage-tag: #cee3de;
  --sage-cmd: #496e65;
  --clay-accent: #c2734f;
  --clay-tag: #eed3c6;
  --clay-cmd: #9a5235;

  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-body: "Open Sans", system-ui, sans-serif;

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;

  /* Bootstrap overrides */
  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-body-font-family: var(--font-body);
  --bs-link-color-rgb: var(--ink-rgb);
  --bs-link-hover-color-rgb: var(--ink-rgb);
  --bs-border-color: var(--ink);
  --bs-focus-ring-color: rgba(var(--ink-rgb), 0.35);
}

/* Dark theme: linen text and rules on a deep green canvas. Roles flip from light: tints carry coloured text,
   deeps sit behind linen text (tag chips). Set by the toggle in the nav; the choice is saved in localStorage. */
:root[data-theme="dark"] {
  color-scheme: dark;

  --ink: #f2ece2;
  --ink-rgb: 242, 236, 226;
  --ink-hover: #e0d9d2;
  --ink-active: #d5cdc1;
  --paper: #1c2117;
  --paper-deep: #30362a;
  --surface: #272d20;

  --sage-tag: #496e65;
  --sage-cmd: #cee3de;
  --clay-tag: #9a5235;
  --clay-cmd: #eed3c6;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.muted {
  color: var(--ink-muted);
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Layout */

.page {
  max-width: 1232px;
  margin: 0 auto;
  padding: 16px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.panel {
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-rule {
  border-top: 1px solid var(--ink);
  padding-top: 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

/* Hero */

.hero-nav {
  padding: 16px;
  border-bottom: 1px solid var(--ink);
}

.brand {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 20px;
  line-height: 27px;
  letter-spacing: -0.2px;
}

.nav-links {
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 18px;
}

.hero-content {
  gap: 32px;
  padding: 32px 16px;
}

.hero-copy {
  gap: 16px;
  flex: 1 1 0;
  min-width: 0;
}

.hero-copy > .eyebrow {
  color: var(--ink-muted);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 36px;
  line-height: 40px;
}

.hero-lede {
  max-width: 520px;
  font-size: 16px;
  line-height: 26px;
}

.hero-actions {
  gap: 12px;
  padding-top: 8px;
}

.hero-art {
  width: 100%;
  max-width: 440px;
  flex-shrink: 0;
}

.hero-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
}

.hero-stats {
  gap: 8px 20px;
  padding: 16px;
  border-top: 1px solid var(--ink);
}

.stat {
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}

/* Theme toggle: icon-only button pinned to a corner of the window (bottom-right until the top-right margin is wide
   enough to hold it without covering the nav) */

.theme-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  width: 44px;
  height: 44px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  font-size: 26px;
  line-height: 1;
}

.theme-toggle:hover {
  background: var(--paper-deep);
}

@media (min-width: 1340px) {
  .theme-toggle {
    top: 16px;
    bottom: auto;
  }
}

/* Buttons */

.btn-ink,
.btn-outline-ink {
  --bs-btn-padding-x: 20px;
  --bs-btn-padding-y: 12px;
  --bs-btn-font-family: var(--font-body);
  --bs-btn-font-size: 14px;
  --bs-btn-font-weight: 600;
  --bs-btn-line-height: 18px;
  --bs-btn-border-radius: var(--radius-md);
  --bs-btn-border-width: 1px;
  --bs-btn-focus-box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
  gap: 10px;
}

.btn-ink {
  --bs-btn-color: var(--paper);
  --bs-btn-bg: var(--ink);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-color: var(--paper);
  --bs-btn-hover-bg: var(--ink-hover);
  --bs-btn-hover-border-color: var(--ink-hover);
  --bs-btn-active-color: var(--paper);
  --bs-btn-active-bg: var(--ink-active);
  --bs-btn-active-border-color: var(--ink-active);
}

.btn-outline-ink {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--paper);
  --bs-btn-border-color: var(--ink);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--paper-deep);
  --bs-btn-hover-border-color: var(--ink);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--paper-deep);
  --bs-btn-active-border-color: var(--ink);
}

.btn:hover {
  text-decoration: none;
}

.kbd {
  padding: 1px 6px;
  background: var(--paper-deep);
  color: var(--ink);
  border: 1px solid var(--ink-hairline);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  line-height: 16px;
  box-shadow: none;
}

/* Apps section */

.apps {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.section-header {
  gap: 20px;
}

.section-title {
  gap: 16px;
}

.section-title h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  line-height: 32px;
}

.search {
  gap: 8px;
  width: 100%;
  padding: 8px 10px 8px 12px;
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 18px;
  cursor: text;
}

.search:focus-within {
  box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
}

.search-prompt {
  color: var(--ink-muted);
}

.search input {
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.search input::placeholder {
  color: var(--ink-muted);
  opacity: 1;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

/* App card */

.app-card {
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--radius-lg);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 -2px var(--ink);
}

.app-card[data-theme="sage"] {
  --accent: var(--sage-accent);
  --tag: var(--sage-tag);
  --cmd: var(--sage-cmd);
}

.app-card[data-theme="clay"] {
  --accent: var(--clay-accent);
  --tag: var(--clay-tag);
  --cmd: var(--clay-cmd);
}

.card-path {
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

.accent {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--accent, var(--ink));
}

.badge-status {
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
}

.badge-key {
  padding: 2px 7px;
  background: var(--ink);
  color: var(--paper);
}

.badge-value {
  gap: 6px;
  padding: 2px 7px;
  background: var(--paper-deep);
}

.card-art {
  display: block;
}

.card-art img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 350 / 198;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.card-text {
  gap: 8px;
}

.card-text h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 28px;
}

.card-text > p:not(.meta) {
  font-size: 14px;
  line-height: 22px;
}

.tags {
  gap: 6px;
  padding-top: 4px;
}

.tags li {
  padding: 2px 8px;
  background: var(--tag, var(--paper-deep));
  border: 1px solid var(--ink-hairline);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
}

.meta {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 16px;
  opacity: 0.72;
}

.card-footer-row {
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-hairline);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
}

.card-footer-row .cmd {
  color: var(--cmd, var(--ink));
  font-weight: 500;
}

/* Placeholder for the next app, and the empty search state */

.next-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 220px;
  padding: 0 32px;
  border: 1px dashed var(--ink);
  border-radius: var(--radius-lg);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 18px;
}

.next-card .next-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  line-height: 24px;
}

.noscript {
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Footer */

.site-footer {
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
}

.footer-links {
  gap: 8px 14px;
}

/* Tablet and up */

@media (min-width: 768px) {
  .hero-nav {
    padding: 16px 28px;
  }

  .nav-links {
    gap: 24px;
  }

  .hero-stats {
    gap: 8px 32px;
    padding: 16px 28px;
  }

  .search {
    width: 260px;
  }

  .footer-links {
    gap: 8px 24px;
  }
}

/* Desktop: matches the 1440px design frame */

@media (min-width: 992px) {
  .page {
    padding: 48px 16px;
    gap: 80px;
  }

  .hero-content {
    gap: 40px;
    padding: 56px 28px;
  }

  .hero-title {
    font-size: 52px;
    line-height: 56px;
  }

  .section-title h2 {
    font-size: 30px;
    line-height: 36px;
  }

  .next-card {
    min-height: 493px;
  }
}

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

  .app-card {
    transition: none;
  }

  .app-card:hover {
    transform: none;
  }
}

/* Inline links inside running text (author credit) */

.eyebrow a,
.site-footer p a {
  text-decoration: underline;
  text-decoration-color: var(--ink-hairline);
}

.eyebrow a:hover,
.site-footer p a:hover {
  text-decoration-color: currentColor;
}

/* Download and source links on the right of the card footer */

.card-links {
  gap: 14px;
}

.download-link {
  color: var(--cmd, var(--ink));
  font-weight: 500;
}
