/* Tiny Design Shop — shared storefront components (catalog, guides index, legal) */

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
  color: var(--foreground);
  scroll-behavior: smooth;
  width: 100%;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  color: var(--ink-2);
  background:
    linear-gradient(180deg, var(--body-gradient-top), var(--body-gradient-bottom)),
    var(--background);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  font-stretch: 100%;
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.wrap {
  width: min(var(--layout-max-width), calc(100% - var(--layout-gutter)));
  margin: 0 auto;
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--layout-nav-gap);
  min-height: var(--layout-nav-height);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--layout-logo-gap);
  color: var(--foreground);
  font-family: var(--font-pixel);
  font-size: var(--fs-logo);
  line-height: var(--lh-tight);
  text-decoration: none;
}

.logo-mark {
  display: grid;
  width: var(--layout-logo-mark);
  height: var(--layout-logo-mark);
  place-items: center;
  border: 1px solid var(--foreground);
  border-radius: var(--radius-xs);
  background: var(--foreground);
  color: var(--accent-2);
  font-size: var(--fs-logo-mark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--layout-nav-link-gap);
  color: var(--muted-foreground);
  font-size: var(--fs-ui);
  font-weight: var(--fw-ui);
}

.nav-links a {
  min-height: var(--layout-nav-link-min-h);
  padding: var(--layout-nav-link-pad-y) var(--layout-nav-link-pad-x);
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus {
  background: var(--secondary);
  color: var(--foreground);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--layout-button-min-h);
  padding: 0 var(--layout-button-pad-x);
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: var(--fs-ui);
  font-weight: var(--fw-button);
  line-height: var(--lh-tight);
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover,
.button:focus {
  transform: translateY(-1px);
  background: var(--button-primary-hover);
}

.button.secondary {
  border-color: var(--border-strong);
  background: var(--card);
  color: var(--foreground);
}

.button.secondary:hover,
.button.secondary:focus {
  border-color: var(--foreground);
  background: var(--secondary);
  transform: translateY(-1px);
}

/* Hero */
.hero {
  padding: var(--layout-hero-pad-top) 0 var(--layout-hero-pad-bottom);
}

.eyebrow,
.section-label,
.chip,
.status,
.footer,
.tool-number,
.breadcrumb {
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.breadcrumb {
  margin: 0 0 var(--layout-eyebrow-mb);
  color: var(--ink-4);
  font-size: var(--fs-ui-sm);
  line-height: 1.3;
  text-transform: uppercase;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--layout-chip-gap);
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb a {
  color: var(--muted-foreground);
  text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.breadcrumb-separator {
  color: var(--ink-4);
}

.breadcrumb [aria-current="page"] {
  color: var(--ink-4);
}

.eyebrow,
.section-label {
  margin: 0 0 var(--layout-eyebrow-mb);
  color: var(--ink-4);
  font-size: var(--fs-ui-sm);
  line-height: 1.3;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--foreground);
  font-weight: var(--fw-heading);
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-family: var(--font-pixel);
  font-size: var(--fs-h1);
  font-weight: 500;
  line-height: var(--lh-heading);
}

.intro {
  max-width: 62ch;
  margin: var(--layout-hero-intro-mt) 0 0;
  color: var(--muted-foreground);
  font-size: var(--fs-intro);
  line-height: var(--lh-intro);
}

.catalog-hub-link {
  margin: var(--s-7) 0 0;
  color: var(--muted-foreground);
  font-size: var(--fs-body-sm);
}

.catalog-hub-link a {
  color: var(--foreground);
  font-weight: var(--fw-heading);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Catalog rows / tool cards */
.tool-list {
  margin: var(--layout-list-mt) 0 var(--layout-section-mb);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.tool-card {
  display: grid;
  grid-template-columns: var(--layout-card-col-number) minmax(0, 1fr) auto;
  gap: var(--layout-card-gap);
  align-items: start;
  padding: var(--layout-card-pad);
  border-bottom: 1px solid var(--border);
}

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

.tool-card:hover {
  background: var(--surface-hover);
}

.tool-number {
  color: var(--accent-foreground);
  font-family: var(--font-pixel);
  font-size: var(--fs-tool-number);
  line-height: var(--lh-tight);
}

.tool-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--layout-tool-head-gap);
  margin-bottom: var(--layout-tool-head-mb);
}

.tool-head h2 {
  font-size: var(--fs-tool-title);
  line-height: 1.2;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: var(--s-13);
  padding: 0 var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--secondary);
  color: var(--muted-foreground);
  font-size: var(--fs-ui-xs);
  line-height: var(--lh-tight);
  white-space: nowrap;
}

.status.live {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
  background: var(--accent-soft);
  color: var(--accent-foreground);
}

.tool-card p {
  max-width: 72ch;
  margin: 0;
  color: var(--muted-foreground);
  font-size: var(--fs-body-sm);
  line-height: var(--lh-intro);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--layout-chip-gap);
  margin-top: var(--layout-chip-row-mt);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-chip);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: var(--fs-ui-sm);
  line-height: var(--lh-tight);
}

.tool-features {
  display: flex;
  flex-wrap: wrap;
  gap: var(--layout-tool-features-gap);
  margin: var(--layout-tool-features-mt) 0 0;
  padding: 0;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: var(--fs-ui-sm);
  line-height: 1.5;
  list-style: none;
}

.tool-features li {
  position: relative;
  padding-left: var(--s-8);
}

.tool-features li::before {
  position: absolute;
  left: 0;
  color: var(--accent-foreground);
  content: "•";
}

.tool-actions {
  display: flex;
  flex-direction: column;
  gap: var(--layout-tool-actions-gap);
  min-width: var(--layout-tool-actions-min-w);
}

/* Dark note band */
.note-band {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(240px, 0.42fr);
  gap: var(--layout-note-band-gap);
  align-items: start;
  margin-bottom: var(--layout-section-mb);
  padding: var(--layout-note-band-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
}

.note-band h2,
.note-band .section-label {
  color: var(--primary-foreground);
}

.note-band h2 {
  font-family: var(--font-pixel);
  font-size: var(--fs-note-band);
  font-weight: 500;
  line-height: 0.95;
}

.note-band p {
  margin: var(--s-10) 0 0;
  color: var(--on-ink-muted);
  line-height: 1.75;
}

.note-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--on-ink-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.note-list li {
  display: grid;
  grid-template-columns: var(--s-15) minmax(0, 1fr);
  gap: var(--layout-logo-gap);
  align-items: center;
  padding: var(--s-7);
  border-bottom: 1px solid var(--on-ink-divider);
  color: var(--on-ink-subtle);
  font-size: var(--fs-ui);
}

.note-list li:last-child {
  border-bottom: 0;
}

.note-list span {
  color: var(--accent-2);
  font-family: var(--font-pixel);
  font-size: var(--fs-note-number);
}

/* Footer */
.footer {
  padding: var(--layout-footer-pad-top) 0 var(--layout-footer-pad-bottom);
  border-top: 1px solid var(--border);
  color: var(--ink-4);
  font-size: var(--fs-ui-sm);
  line-height: 1.5;
}

.footer.wrap,
.footer > .wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: var(--layout-footer-gap) var(--layout-footer-links-gap);
}

.footer.wrap > span,
.footer > .wrap > span {
  white-space: nowrap;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--layout-footer-links-gap);
}

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

/* Footer ghost controls — support link + language switcher share one metrics row. */
.footer .support-link,
.lang-switcher[data-placement="footer"] .lang-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  font-size: inherit;
  font-weight: 560;
  line-height: inherit;
}

.footer .support-link:hover,
.footer .support-link:focus,
.lang-switcher[data-placement="footer"] .lang-switcher-trigger:hover,
.lang-switcher[data-placement="footer"] .lang-switcher-trigger:focus-visible {
  background: transparent;
  color: var(--foreground);
}

.footer .support-icon,
.lang-switcher[data-placement="footer"] .lang-switcher-globe {
  width: 14px;
  height: 14px;
  flex: none;
}

.lang-switcher[data-placement="footer"] .lang-switcher-caret {
  width: 12px;
  height: 12px;
  margin-left: 0;
  color: inherit;
}

/* Language switcher — a COSS-style <select>-look dropdown built from a native
   <details> element (zero-JS toggle). A bordered trigger shows a globe + the
   current language + caret; opening reveals a popup menu of the other languages.
   Used in two placements via [data-placement]: the top of the guide sidebar and
   the footer. */
.lang-switcher {
  position: relative;
  font-size: var(--fs-ui-sm);
}

/* Trigger — mirrors the COSS SelectTrigger / .toc-action proportions. */
.lang-switcher-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: var(--layout-nav-link-min-h);
  padding: var(--s-3) var(--s-5);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--foreground);
  font-size: var(--fs-ui-sm);
  font-weight: 600;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  user-select: none;
  transition: border-color 160ms ease, background 160ms ease;
}

.lang-switcher-trigger::-webkit-details-marker {
  display: none;
}

.lang-switcher-trigger:hover,
.lang-switcher-trigger:focus-visible {
  border-color: var(--foreground);
}

.lang-switcher-globe {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--muted-foreground);
}

.lang-switcher-value {
  white-space: nowrap;
}

.lang-switcher-caret {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted-foreground);
  transition: transform 160ms ease;
}

.lang-switcher[open] .lang-switcher-caret {
  transform: rotate(180deg);
}

/* Popup menu — mirrors the COSS SelectPopup (bordered card, soft shadow). */
.lang-switcher-menu {
  position: absolute;
  z-index: 50;
  min-width: 100%;
  max-height: 16rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: var(--s-2);
  padding: var(--s-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  box-shadow: var(--shadow);
}

.lang-switcher-item {
  display: block;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-xs);
  color: var(--muted-foreground);
  font-size: var(--fs-ui-sm);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

a.lang-switcher-item:hover,
a.lang-switcher-item:focus-visible {
  background: var(--secondary);
  color: var(--foreground);
}

.lang-switcher-item.is-current {
  color: var(--foreground);
  font-weight: 700;
}

/* Footer placement — support + language sit on the right; menu opens UPWARD. */
.lang-switcher[data-placement="footer"] {
  flex: 0 0 auto;
}

.lang-switcher[data-placement="footer"] .lang-switcher-menu {
  bottom: 100%;
  left: auto;
  right: 0;
  width: max-content;
  min-width: 9rem;
  max-width: 14rem;
  margin-top: 0;
  margin-bottom: var(--s-2);
}

/* Sidebar placement — full-width trigger at the top of the guide sidebar; menu
   opens downward. */
.lang-switcher[data-placement="sidebar"] {
  display: block;
  margin-bottom: var(--s-5);
}

.lang-switcher[data-placement="sidebar"] .lang-switcher-trigger {
  width: 100%;
}

.lang-switcher[data-placement="sidebar"] .lang-switcher-menu {
  left: 0;
  right: 0;
}

/* Flex page shell (short index pages) */
.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  min-height: 100svh;
}

.page-shell main {
  flex: 1 1 auto;
}

@media (max-width: 900px) {
  .tool-card,
  .note-band {
    grid-template-columns: 1fr;
  }

  .tool-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(100% - var(--layout-gutter-mobile), var(--layout-max-width));
  }

  .nav-inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: var(--s-9) 0;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: var(--s-1);
  }

  h1 {
    font-size: var(--fs-h1-mobile);
  }

  .intro {
    font-size: var(--fs-body);
  }

  .tool-card {
    padding: var(--layout-card-pad-mobile);
  }

  .tool-actions .button {
    width: 100%;
  }

  .note-band {
    padding: var(--layout-note-band-pad-mobile);
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer.wrap,
  .footer > .wrap {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-links {
    flex: none;
    width: 100%;
  }

  .footer .support-link {
    margin-left: 0;
  }
}

@media (min-width: 641px) {
  .footer.wrap,
  .footer > .wrap {
    flex-wrap: nowrap;
  }

  .footer-links {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .footer .support-link {
    margin-left: auto;
  }
}
