/* The product lab homepage. Dark, terminal-flavored, and the only page that
   uses this theme: the amber is the logo's yellow pushed toward an old
   phosphor display, so the hacker look comes from the brand rather than the
   usual acid green. */

/* The theme hangs off <body>, not <html>: Turbo replaces the body on every
   visit but keeps <html>, so a class there would leak the dark theme onto
   the next page. The <html> background follows along via :has() so overscroll
   matches. */
body.lab-dark {
  --lab-ink: #101318;
  --lab-panel: #171b21;
  --lab-panel-raised: #1c2128;
  --lab-rule: #262b33;
  --lab-paper: #e8e4d8;
  --lab-dim: #8a909a;
  --lab-faint: #747b86;
  --lab-amber: #f5c84c;
  --lab-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --lab-sans: "FF Meta", ui-sans-serif, system-ui, sans-serif;

  color-scheme: dark;
  background: var(--lab-ink);
  color: var(--lab-paper);
}

html:has(> body.lab-dark) {
  background: #101318;
  color-scheme: dark;
}

body.lab-dark ::selection {
  background: var(--lab-amber);
  color: var(--lab-ink);
}

/* Header and footer from the shared lab chrome, recolored for the dark page. */
body.lab-dark header svg path[fill="#7C7C7C"] {
  fill: var(--lab-paper);
}

body.lab-dark footer {
  margin-top: 5rem;
  padding-top: 2rem;
}

body.lab-dark .lab-header-link {
  font-family: var(--lab-mono);
  font-size: 13px;
  color: var(--lab-dim);
}

body.lab-dark .lab-header-slashes li + li::before,
body.lab-dark .lab-header-links + .lab-header-auth li:first-child::before {
  font-family: var(--lab-mono);
  font-size: 13px;
  color: #4d535d;
}

body.lab-dark .lab-header-link:hover,
body.lab-dark .lab-header-link:focus-visible {
  color: var(--lab-amber);
}

body.lab-dark .lab-header-signup {
  color: var(--lab-amber);
}

body.lab-dark .lab-header-signup:hover,
body.lab-dark .lab-header-signup:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

body.lab-dark .lab-header-icon svg {
  color: var(--lab-dim);
  transition: color 120ms ease;
}

body.lab-dark .lab-header-icon:hover svg,
body.lab-dark .lab-header-icon:focus-visible svg {
  color: var(--lab-amber);
}

body.lab-dark footer .footer-link {
  font-family: var(--lab-mono);
  font-size: 13px;
  color: var(--lab-dim);
}

body.lab-dark footer .footer-link:hover,
body.lab-dark footer .footer-link:focus-visible {
  color: var(--lab-amber);
}

/* Flash and page notices (layouts/_notice_message) are styled for the light
   site: a navy card for notices and pale red for alerts. On the dark pages
   they become panels in the page's own palette. */
body.lab-dark #flash .max-w-2xl {
  border: 1px solid var(--lab-rule);
  border-left: 3px solid var(--lab-amber);
  border-radius: 6px;
  background: var(--lab-panel);
  color: var(--lab-paper);
  padding: 0.9rem 1.1rem;
  font-family: var(--lab-sans);
}

body.lab-dark #flash .max-w-2xl.bg-red-100 {
  border-left-color: #e5675a;
  background: #221719;
}

body.lab-dark #flash .max-w-2xl .text-\[18px\] {
  font-size: 15px;
  line-height: 1.5;
}

body.lab-dark #flash .max-w-2xl svg path[stroke="#F0F0FA"] {
  stroke: var(--lab-amber);
}

body.lab-dark #flash .max-w-2xl .fill-red-700 {
  fill: #e5675a;
}

body.lab-dark #flash .max-w-2xl a {
  color: var(--lab-amber);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

body.lab-dark #flash .max-w-2xl .bg-gray-500 {
  border: 1px solid var(--lab-rule);
  background: var(--lab-panel-raised);
}

body.lab-dark #flash .max-w-2xl .bg-gray-500 svg {
  fill: var(--lab-dim);
}

/* Layout: the page shares the header's container, so the logo and the
   content line up on the same left edge. */
.lab {
  padding-bottom: 1rem;
}

/* Hero: a terminal session that prints the README. */
.lab-hero {
  padding: 2.5rem 0 2.5rem;
}

@media (min-width: 768px) {
  .lab-hero {
    padding: 3.5rem 0 3.25rem;
  }
}

.lab-prompt {
  margin: 0;
  font-family: var(--lab-mono);
  font-size: 14px;
  color: var(--lab-dim);
}

.lab-prompt-path {
  color: var(--lab-amber);
}

.lab-prompt-command {
  color: var(--lab-paper);
}

.lab-intro {
  /* Printed output of the command above: the prompt's typeface, two steps
     up the scale (14 -> 18px) so it still reads as the headline. */
  margin: 0.4rem 0 0;
  font-family: var(--lab-mono);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.45;
  color: var(--lab-paper);
}

.lab-intro a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--lab-faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.lab-intro a:hover,
.lab-intro a:focus-visible {
  text-decoration-color: var(--lab-amber);
}

/* Only the name is underlined; the arrow sits just after it. */
.lab-intro a {
  text-decoration: none;
}

.lab-intro-name {
  text-decoration: underline;
  text-decoration-color: var(--lab-faint);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.lab-intro a:hover .lab-intro-name,
.lab-intro a:focus-visible .lab-intro-name {
  text-decoration-color: var(--lab-amber);
}

.lab-intro-arrow {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.15em;
  vertical-align: -0.1em;
  fill: currentColor;
  color: var(--lab-dim);
}

.lab-intro a:hover .lab-intro-arrow,
.lab-intro a:focus-visible .lab-intro-arrow {
  color: var(--lab-amber);
}

/* Sections are directories. */
.lab-section + .lab-section {
  margin-top: 3.5rem;
}

/* The starred section sits first and is hidden until something is starred. */
.lab-section[hidden] + .lab-section {
  margin-top: 0;
}

.lab-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--lab-rule);
  font-family: var(--lab-mono);
}

.lab-section-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--lab-paper);
}

.lab-section-count {
  font-size: 13px;
  color: var(--lab-faint);
}

.lab-section-note {
  margin: -0.25rem 0 1rem;
  font-family: var(--lab-sans);
  font-size: 15px;
  color: var(--lab-dim);
}

.lab-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .lab-grid--list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .lab-grid--featured {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  .lab-grid--list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Cards */
.lab-card {
  position: relative;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--lab-rule);
  border-radius: 6px;
  background: var(--lab-panel);
  color: var(--lab-paper);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.lab-card:hover {
  border-color: var(--lab-amber);
  background: var(--lab-panel-raised);
}

/* The card clips its corners, so the focus ring is drawn on the card itself
   rather than on the link inside it. */
.lab-card:has(.lab-card-link:focus-visible) {
  outline: 2px solid var(--lab-amber);
  outline-offset: 3px;
  border-color: var(--lab-amber);
}

.lab-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}

.lab-card-link:focus-visible {
  outline: none;
}

.lab-card-media {
  position: relative;
  aspect-ratio: 8 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--lab-rule);
  background: #0c0e12;
}

.lab-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lab-card-illustration {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: #eff0e6;
  color: #697263;
  font: 14px var(--lab-mono);
  letter-spacing: 0.15em;
}

.lab-card-illustration-plane {
  display: block;
  transform: rotate(-15deg);
  font-size: 64px;
  line-height: 1;
}

.lab-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem 1rem 1.1rem;
}

.lab-card-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--lab-mono);
}

.lab-card-name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--lab-paper);
  transition: color 120ms ease;
}

.lab-card:hover .lab-card-name,
.lab-card-link:focus-visible .lab-card-name {
  color: var(--lab-amber);
}

.lab-card-date {
  flex: none;
  font-size: 12px;
  color: var(--lab-faint);
}

.lab-card-description {
  margin: 0;
  font-family: var(--lab-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--lab-dim);
}

/* Featured cards get a little more room. */
.lab-grid--featured .lab-card-body {
  padding: 1.1rem 1.25rem 1.3rem;
}

.lab-grid--featured .lab-card-name {
  font-size: 17px;
}

/* Star: a small chip over the top-right of the card image. */
.lab-star {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(232, 228, 216, 0.18);
  border-radius: 6px;
  background: rgba(16, 19, 24, 0.85);
  color: var(--lab-paper);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}

.lab-star[hidden] {
  display: none;
}

.lab-star svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.lab-card:hover .lab-star,
.lab-card:focus-within .lab-star,
.lab-card.is-starred .lab-star {
  opacity: 1;
}

.lab-star:hover {
  border-color: var(--lab-amber);
  color: var(--lab-amber);
}

.lab-star:focus-visible {
  outline: 2px solid var(--lab-amber);
  outline-offset: 2px;
}

.lab-star[aria-pressed="true"] {
  border-color: rgba(245, 200, 76, 0.55);
  color: var(--lab-amber);
}

.lab-star[aria-pressed="true"] svg {
  fill: currentColor;
}

/* Drag handle on starred cards, when there is more than one to order. It
   mirrors the star in the opposite corner. */
.lab-drag {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(232, 228, 216, 0.18);
  border-radius: 6px;
  background: rgba(16, 19, 24, 0.85);
  color: var(--lab-paper);
  cursor: grab;
  opacity: 0;
  touch-action: none;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}

.lab-drag svg {
  fill: currentColor;
}

.lab-card:hover .lab-drag,
.lab-card:focus-within .lab-drag,
.lab-card.is-dragging .lab-drag {
  opacity: 1;
}

.lab-drag:hover {
  border-color: var(--lab-amber);
  color: var(--lab-amber);
}

.lab-drag:focus-visible {
  outline: 2px solid var(--lab-amber);
  outline-offset: 2px;
}

.lab-grid.is-sorting {
  cursor: grabbing;
  user-select: none;
}

.lab-grid.is-sorting .lab-drag {
  cursor: grabbing;
}

.lab-card.is-dragging {
  border-color: var(--lab-amber);
  border-style: dashed;
}

/* No hover on touch screens, so the star and handle are always showing. */
@media (hover: none) {
  .lab-star,
  .lab-drag {
    opacity: 1;
  }
}

/* About page: long-form text in the brand sans, at a reading measure. */
.lab-prose {
  max-width: 64ch;
  font-family: var(--lab-sans);
  font-size: 17px;
  line-height: 1.65;
  color: #cfcbc0;
}

.lab-prose p {
  margin: 0 0 1.1em;
}

.lab-prose a,
.lab-person a {
  color: var(--lab-paper);
  text-decoration: underline;
  text-decoration-color: var(--lab-faint);
  text-underline-offset: 0.2em;
}

.lab-prose a:hover,
.lab-prose a:focus-visible,
.lab-person a:hover,
.lab-person a:focus-visible {
  color: var(--lab-amber);
  text-decoration-color: var(--lab-amber);
}

.lab-about-team {
  margin-top: 3rem;
  max-width: 64ch;
}

.lab-person {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.lab-person-photo {
  flex: none;
  width: 72px;
  height: 72px;
  border: 1px solid var(--lab-rule);
  border-radius: 6px;
}

.lab-person-body {
  min-width: 0;
}

.lab-person-name {
  margin: 0 0 0.4rem;
  font-family: var(--lab-mono);
  font-size: 15px;
  color: var(--lab-paper);
}

.lab-person-name span {
  margin-left: 0.5em;
  color: var(--lab-faint);
}

.lab-person-bio {
  margin: 0 0 0.75rem;
  font-family: var(--lab-sans);
  font-size: 16px;
  line-height: 1.6;
  color: #cfcbc0;
}

.lab-person-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--lab-mono);
  font-size: 13px;
}

@media (max-width: 480px) {
  .lab-person {
    flex-direction: column;
  }
}

/* Account pages: log in, sign up, password reset. A single narrow column of
   terminal-styled form controls. */
.lab-auth {
  max-width: 400px;
  margin: 0 auto;
  padding: 3rem 0 2rem;
}

.lab-auth-title {
  margin: 0;
  font-family: var(--lab-mono);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.3;
  color: var(--lab-paper);
}

.lab-auth-lede,
.lab-auth-foot {
  margin: 0.6rem 0 1.5rem;
  font-family: var(--lab-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--lab-dim);
}

.lab-auth-foot {
  margin: 1.5rem 0 0;
}

.lab-auth a {
  color: var(--lab-amber);
  text-decoration: underline;
  text-decoration-color: rgba(245, 200, 76, 0.4);
  text-underline-offset: 0.2em;
}

.lab-auth a:hover,
.lab-auth a:focus-visible {
  text-decoration-color: var(--lab-amber);
}

/* The shared Google button (shared/_omniauth_legacy) and its "or" divider. */
.lab-auth button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--lab-rule);
  border-radius: 6px;
  background: var(--lab-panel);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.lab-auth button[type="submit"]:hover {
  border-color: var(--lab-faint);
  background: var(--lab-panel-raised);
}

.lab-auth button[type="submit"] span {
  font-family: var(--lab-sans);
  color: var(--lab-paper);
}

.lab-auth .text-gray-400 {
  margin: 1.1rem 0;
  font-family: var(--lab-mono);
  font-size: 12px;
  color: var(--lab-faint);
}

.lab-auth-field {
  margin-bottom: 1rem;
}

.lab-auth-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--lab-mono);
  font-size: 13px;
  color: var(--lab-dim);
}

.lab-auth-hint {
  display: block;
  margin: -0.15rem 0 0.35rem;
  font-family: var(--lab-sans);
  font-size: 13px;
  color: var(--lab-faint);
}

.lab-auth .form-input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--lab-rule);
  border-radius: 6px;
  background: #0c0e12;
  color: var(--lab-paper);
  font-family: var(--lab-mono);
  font-size: 15px;
  box-shadow: none;
}

.lab-auth .form-input::placeholder {
  color: var(--lab-faint);
}

.lab-auth .form-input:focus {
  outline: none;
  border-color: var(--lab-amber);
  box-shadow: 0 0 0 3px rgba(245, 200, 76, 0.18);
}

.lab-auth-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 1.25rem;
  font-family: var(--lab-sans);
  font-size: 15px;
  color: var(--lab-dim);
}

.lab-auth-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--lab-amber);
}

.lab-auth-captcha {
  margin: 0.5rem 0 1rem;
}

.lab-auth .primary-button.lab-auth-submit {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--lab-amber);
  border-radius: 6px;
  background: var(--lab-amber);
  color: var(--lab-ink);
  font-family: var(--lab-mono);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.lab-auth .primary-button.lab-auth-submit:hover {
  background: #ffd76a;
  color: var(--lab-ink);
}

.lab-auth .primary-button.lab-auth-submit:focus-visible,
.lab-auth button[type="submit"]:focus-visible {
  outline: 2px solid var(--lab-amber);
  outline-offset: 3px;
}

/* Devise error messages (devise/shared/_error_messages). */
.lab-auth .bg-red-100 {
  max-width: none;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--lab-rule);
  border-left: 3px solid #e5675a;
  border-radius: 6px;
  background: #221719;
  color: var(--lab-paper);
  font-family: var(--lab-sans);
  font-size: 14px;
}

.lab-auth .bg-red-100 ul {
  margin-top: 0.4rem;
  color: #f0b7b0;
}

/* Terms and Privacy: long-form legal text (home/_policy_page) on the dark
   page, at a comfortable reading measure. */
body.lab-dark .rich-text {
  max-width: 68ch;
  color: #cfcbc0;
  font-family: var(--lab-sans);
  font-size: 16px;
  line-height: 1.65;
}

body.lab-dark .rich-text h1,
body.lab-dark .rich-text h2,
body.lab-dark .rich-text h3 {
  color: var(--lab-paper);
  font-family: var(--lab-mono);
  font-weight: 400;
}

body.lab-dark .rich-text h1 {
  font-size: 22px;
}

body.lab-dark .rich-text h2 {
  margin-top: 2.2em;
  font-size: 17px;
}

body.lab-dark .rich-text h3 {
  font-size: 15px;
}

body.lab-dark .rich-text a {
  color: var(--lab-amber);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

body.lab-dark .rich-text b,
body.lab-dark .rich-text strong {
  color: var(--lab-paper);
}

@media (prefers-reduced-motion: reduce) {
  .lab-card,
  .lab-card-name,
  .lab-auth button[type="submit"],
  .lab-auth .primary-button.lab-auth-submit,
  .lab-star,
  .lab-drag {
    transition: none;
  }
}
