/* Arda integrations launch page.
 *
 * Colour and type come from assets/tokens.css. The only literal colours below
 * are the two logo-plate values: the plate has to stay a light surface in BOTH
 * themes so full-colour vendor marks read correctly, and the token set has no
 * "always light" surface — --background flips in dark mode. They are pinned to
 * the light-theme values of --background and --border.
 */

@font-face {
  font-family: 'Geist';
  src: url('fonts/Geist-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --plate-surface: #FFFFFF;
  --plate-border: #E5E5E5;

  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 12px;

  --shell-max: 1200px;
  --gutter: 16px;
}

@media (min-width: 768px) {
  :root {
    --gutter: 24px;
  }
}

/* ------------------------------------------------------------------ resets */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--font-weight-normal);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ul,
ol,
figure,
fieldset {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

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

code {
  font-family: var(--font-mono);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Focus ------------------------------------------------------------------ */

:where(a, button, input, summary, details, [tabindex]):focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1:focus:not(:focus-visible),
h2:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  transition: top 120ms ease;
}

.skip-link:focus {
  top: 12px;
}

/* Layout ----------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.main {
  padding-block: 32px 56px;
}

.main--narrow {
  max-width: 800px;
}

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

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.brand__mark {
  width: auto;
  height: 26px;
}

/* Progress indicator ----------------------------------------------------- */

.steps__list {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.step + .step::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--border);
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
}

.step--current {
  color: var(--foreground);
  font-weight: var(--font-weight-medium);
}

.step--current .step__num {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}

.step--done .step__num {
  border-color: var(--foreground);
  color: var(--foreground);
}

@media (max-width: 719px) {
  .step:not(.step--current) .step__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .step + .step::before {
    width: 10px;
  }
}

/* Intro ------------------------------------------------------------------ */

.intro {
  max-width: 62ch;
}

.intro__title {
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.intro__sub {
  margin-top: 12px;
  color: var(--muted-foreground);
  font-size: 1.0625rem;
}

/* Controls --------------------------------------------------------------- */

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.search {
  width: 100%;
  max-width: 520px;
}

.search__input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: var(--text-base);
}

.search__input::placeholder {
  color: var(--muted-foreground);
}

.search__input:hover:not(:disabled) {
  border-color: var(--muted-foreground);
}

.search__input:disabled {
  opacity: 0.6;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-filter {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

.chip-filter:hover {
  border-color: var(--muted-foreground);
  color: var(--foreground);
}

.chip-filter[aria-pressed="true"] {
  border-color: var(--foreground);
  background: var(--foreground);
  color: var(--background);
}

.chip-filter__count {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

/* Phones: one swipeable row instead of four wrapped ones, so the list itself
   stays in view. The row bleeds to the screen edge, which leaves a chip cut
   off there as the cue that it scrolls. The block padding is room for the
   focus ring, which a scroll container would otherwise clip. */
@media (max-width: 640px) {
  .filters {
    flex-wrap: nowrap;
    margin: -6px calc(var(--gutter) * -1);
    padding: 6px var(--gutter);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .filters::-webkit-scrollbar {
    display: none;
  }
}

.result-count {
  margin-top: 16px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  min-height: 1.5em;
}

/* Sections and grid ------------------------------------------------------ */

.results {
  margin-top: 8px;
}

.section {
  margin-top: 40px;
}

.section__title {
  font-size: 1.25rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
}

.section__blurb {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  max-width: 68ch;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

/* Tile ------------------------------------------------------------------- */

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: inherit;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.tile:hover {
  border-color: var(--muted-foreground);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.07);
}

.tile__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
  /* Optical: the plate has a border, the text does not. */
  padding-inline: 2px;
}

.tile__name {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.tile__byline {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

/* Logo plate ------------------------------------------------------------- */

.plate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--plate-border);
  border-radius: var(--radius);
  background: var(--plate-surface);
  overflow: hidden;
}

.plate__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.plate__monogram {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--monogram-border, var(--plate-border));
  border-radius: var(--radius-sm);
  background: var(--monogram-bg, var(--plate-surface));
  color: var(--monogram-fg, #0A0A0A);
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.01em;
  line-height: 1;
}

.plate--lg {
  width: 112px;
  height: 80px;
  flex: none;
}

/* Family chips ----------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.chip {
  display: inline-block;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip--more {
  border-style: dashed;
}

/* Cards ------------------------------------------------------------------ */

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
}

.card__title {
  font-size: 1.25rem;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: balance;
}

.card__body {
  margin-top: 8px;
  color: var(--muted-foreground);
  max-width: 62ch;
}

.card--empty {
  margin-top: 32px;
}

/* The card that ends a flow is a handoff, not a completion — the page has
   connected nothing — so it is marked with the forward arrow and the info
   trio, never a check mark, which would read as "done". The emphasis is a
   border and a rail rather than a flood fill: the status trios are fixed light
   values, so a filled panel would fight the dark theme's buttons and text. */
.card--handoff {
  border-color: var(--info-border);
  box-shadow: inset 3px 0 0 0 var(--info-fg);
}

.card--handoff .card__title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.card--handoff .card__title::before {
  content: "\2192";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: none;
  border: 1px solid var(--info-border);
  border-radius: 50%;
  background: var(--info-bg);
  color: var(--info-fg);
  font-size: var(--text-base);
  line-height: 1;
}

.card--handoff .card__body {
  margin-top: 12px;
}

.cta {
  margin-top: 8px;
}

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

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.btn--primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

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

.btn--secondary {
  border-color: var(--border);
  background: var(--background);
  color: var(--foreground);
}

.btn--secondary:hover {
  border-color: var(--muted-foreground);
}

.helper {
  margin-top: 8px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.reassure {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.colophon {
  margin-top: 24px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.subtle-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--link);
  font-size: var(--text-sm);
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 32px 48px;
}

/* Connect page ----------------------------------------------------------- */

.backlink {
  display: inline-block;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  text-decoration: none;
}

.backlink:hover {
  color: var(--foreground);
  text-decoration: underline;
}

.connect-root {
  margin-top: 32px;
}

.vendor {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.vendor__text {
  min-width: 0;
  flex: 1 1 240px;
}

.vendor__name {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.vendor__byline {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.vendor__family {
  margin-top: 6px;
  color: var(--foreground);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
}

.card__lede {
  margin-top: 8px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 60ch;
}

.stage {
  margin-top: 28px;
}

/* Family chooser --------------------------------------------------------- */

.chooser {
  margin-top: 32px;
}

.chooser__title {
  font-size: 1.125rem;
  font-weight: var(--font-weight-semibold);
}

.chooser__blurb {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.chooser__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.linkcard {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background);
  color: inherit;
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease;
}

.linkcard:hover {
  border-color: var(--muted-foreground);
  transform: translateY(-1px);
}

.linkcard__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.linkcard__name {
  font-weight: var(--font-weight-medium);
}

.linkcard__meta {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

/* Fields ----------------------------------------------------------------- */

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  margin-top: 20px;
  border: 0;
}

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

.field__label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.field__input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: var(--text-base);
}

.field__input:hover {
  border-color: var(--muted-foreground);
}

.field__input::placeholder {
  color: var(--muted-foreground);
}

.field__help {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

/* Dropzone --------------------------------------------------------------- */

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-top: 20px;
  padding: 36px 20px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--muted-foreground);
  transition: border-color 120ms ease;
}

.dropzone:hover {
  border-color: var(--muted-foreground);
}

.dropzone__label {
  color: var(--foreground);
  font-size: var(--text-base);
  font-weight: var(--font-weight-medium);
}

/* The native input is kept out of sight (and disabled in the markup). */
.dropzone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Callouts, steps, disclosure -------------------------------------------- */

.callout {
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
  background: var(--info-bg);
  color: var(--info-fg);
  font-size: var(--text-sm);
}

.callout--advice {
  border-color: var(--border);
  background: transparent;
  color: var(--muted-foreground);
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
  counter-reset: arda-step;
}

.steps-list__item {
  display: flex;
  gap: 12px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  counter-increment: arda-step;
}

.steps-list__item::before {
  content: counter(arda-step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--foreground);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
}

.stepper {
  display: flex;
  flex-direction: column;
  margin-top: 20px;
  counter-reset: arda-step;
}

.stepper__item {
  position: relative;
  padding: 0 0 20px 40px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
  counter-increment: arda-step;
}

.stepper__item::before {
  content: counter(arda-step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--background);
  color: var(--foreground);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  line-height: 1;
}

.stepper__item::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 30px;
  bottom: 4px;
  width: 1px;
  background: var(--border);
}

.stepper__item:last-child {
  padding-bottom: 0;
}

.stepper__item:last-child::after {
  display: none;
}

.disclosure {
  margin-top: 20px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.disclosure__summary {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

.disclosure .steps-list {
  margin-top: 12px;
}

/* Provider rows (generic inbox) ------------------------------------------ */

.providers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

.provider {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 2px 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.provider__name {
  min-width: 0;
  font-weight: var(--font-weight-medium);
}

.provider__meta {
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

/* Glyphs ----------------------------------------------------------------- */

.glyph {
  width: 20px;
  height: 20px;
  flex: none;
}

.glyph--upload {
  width: 28px;
  height: 28px;
  color: var(--muted-foreground);
}

.glyph--chevron {
  width: 18px;
  height: 18px;
  color: var(--muted-foreground);
}

/* Scope checklist (oauth card) ------------------------------------------- */

.scopes {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.scopes__label {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}

.scopes__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.scopes__item {
  display: flex;
  gap: 10px;
  color: var(--muted-foreground);
  font-size: var(--text-sm);
}

.scopes__item::before {
  content: "\2713";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  border: 1px solid var(--success-border);
  border-radius: 5px;
  background: var(--success-bg);
  color: var(--success-fg);
  font-size: var(--text-sm);
  line-height: 1;
}

/* Dark theme ------------------------------------------------------------- */

[data-theme="dark"] .tile:hover {
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.5);
}

/* Motion ----------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .tile:hover,
  .linkcard:hover {
    transform: none;
  }
}

/* Narrow screens --------------------------------------------------------- */

@media (max-width: 480px) {
  /* Two columns down to 340px: 67 tiles in a single column is a very long scroll on a phone. */
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .tile {
    padding: 12px;
  }
}

@media (max-width: 339px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .card {
    padding: 20px 16px;
  }

  .actions .btn {
    width: 100%;
  }
}
