/* The Things ID — page styles, in line with www.thethingsnetwork.org.
   Every page has the website's structure: its header bar with the logo, its page header band, the content
   on the 1200px grid, and the base line of its footer. The band (`tn-ph…`), the grid (`tn-wrap`) and the
   eyebrow (`tn-eyebrow`) are the website's OWN classes: they ship in /ttn-tokens.css, which is GENERATED
   from the website's brand foundation (`node scripts/export-brand-tokens.mjs
   ../identity/public/ttn-tokens.css ../identity/public/fonts /fonts`, run from platform/).
   The `id-` classes below mirror the website's app primitives one to one:
     id-card  = tn-box        id-field / input = tn-field / tn-input      id-btn = tn-btn
     id-alert = tn-alert      id-console / id-nav / id-head = tn-cp-console / tn-cp-nav / tn-cp-head
   (platform/app/styles/site.css, tn-app.css, community-people.css). When those change, change these.
   The logos in /logos are copies of platform/public/assets/logos. No site navigation here: these pages
   keep to one task. */

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

body {
  margin: 0;
  background: #fff;
  color: var(--grey-900);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

.id-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header: the website's bar, with the logo only ---------- */
.id-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgb(255 255 255 / 88%);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--grey-100);
}

.id-header__bar {
  max-width: 1200px;
  height: 72px;
  margin-inline: auto;
  padding-inline: 24px;
  display: flex;
  align-items: center;
}

.id-header__logo {
  display: block;
  border-radius: var(--br-s);
}

.id-header__logo img {
  display: block;
  height: 28px;
  width: auto;
}

.id-header__logo:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ---------- Body (tn-body) ---------- */
.id-body {
  flex: 1;
  width: 100%;
  padding-block: 40px 80px;
}

/* ---------- Box (tn-box) ---------- */
.id-card {
  max-width: 480px;
  padding: 24px;
  border: 1px solid var(--grey-100);
  border-radius: var(--br-l);
  background: #fff;
}

.id-card--wide {
  max-width: none;
}

/* the application's logo on the sign-in and consent pages (lib/client-logo.ts) */
.id-client-logo {
  display: block;
  max-width: 200px;
  max-height: 48px;
  margin: 0 0 16px;
}

.id-card--danger {
  border-color: var(--error-100);
}

.id-card h2 {
  margin: 0;
  color: var(--tn-navy);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.id-card--danger h2 {
  color: var(--error-700);
}

.id-card h3 {
  margin: 0 0 12px;
  color: var(--tn-navy);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.id-card p {
  margin: 0 0 16px;
  color: var(--grey-700);
}

.id-card > :last-child,
.id-card form > :last-child {
  margin-bottom: 0;
}

/* a box's title and the line under it (tn-cp-head) */
.id-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.id-card .id-head p {
  margin: 0;
}

.id-card a:not(.id-btn) {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.id-card a:not(.id-btn):hover {
  color: var(--link-hover);
}

.id-card a:not(.id-btn):focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: var(--focus-ring);
}

.id-card code {
  font-family: var(--font-mono);
  font-size: 0.95em;
  overflow-wrap: anywhere;
}

/* ---------- Account pages: menu + boxes (tn-cp-console) ---------- */
.id-console {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.id-nav {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.id-nav a {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--br-m);
  color: var(--grey-800);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.id-nav a:hover {
  background: var(--grey-050);
  color: var(--grey-900);
}

.id-nav a[aria-current="page"] {
  background: var(--tn-tint);
  color: var(--tn-navy);
  font-weight: 600;
}

.id-nav a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.id-nav .id-nav__out {
  margin-top: 12px;
  color: var(--grey-700);
}

.id-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.id-panel > .id-alert,
.id-panel > .id-notice {
  margin: 0;
}

/* ---------- Fields (tn-field / tn-input) ---------- */
.id-field {
  display: block;
  margin: 0 0 18px;
}

.id-field--short {
  max-width: 240px;
}

.id-field span {
  display: block;
  margin: 0 0 6px;
  color: var(--grey-900);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.id-field input,
.id-field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--grey-200);
  border-radius: var(--br-m);
  background: #fff;
  color: var(--grey-900);
  font: inherit;
  font-size: 15px;
  outline: none;
}

.id-field input:focus,
.id-field select:focus {
  border-color: var(--tn-blue);
  box-shadow: var(--focus-ring);
}

.id-field input::placeholder {
  color: var(--grey-600);
}

.id-field input[readonly] {
  background: var(--grey-050);
  color: var(--grey-700);
}

.id-field input[aria-invalid="true"] {
  border-color: var(--error-500);
}

.id-field input[type="file"] {
  padding: 8px;
  font-size: 14px;
}

/* two fields side by side (tn-cp-two) */
.id-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.id-hint,
.id-error {
  display: block;
  margin-top: 6px;
  color: var(--grey-700);
  font-size: 13px;
  line-height: 1.4;
}

.id-error {
  color: var(--error-600);
}

.id-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 8px;
  color: var(--grey-900);
}

.id-check input {
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--tn-blue);
}

/* ---------- Alerts (tn-alert) ---------- */
.id-alert,
.id-notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--error-100);
  border-radius: var(--br-m);
  background: var(--error-050);
  color: var(--error-700);
  font-size: 14px;
}

.id-card .id-alert {
  color: var(--error-700);
}

.id-notice,
.id-card .id-notice {
  border-color: var(--success-100);
  background: var(--success-050);
  color: var(--success-900);
}

/* ---------- Buttons (tn-btn) ---------- */
.id-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.id-actions--end {
  justify-content: flex-end;
}

.id-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: var(--br-m);
  background: var(--tn-blue);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.id-btn:hover {
  background: var(--tn-blue-600);
  color: #fff;
}

.id-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.id-btn[disabled] {
  opacity: 0.6;
  pointer-events: none;
}

.id-btn-secondary {
  background: #fff;
  border-color: var(--grey-200);
  color: var(--tn-navy);
}

.id-btn-secondary:hover {
  background: var(--grey-050);
  border-color: var(--grey-300);
  color: var(--tn-navy);
}

.id-btn-danger {
  background: var(--error-600);
}

.id-btn-danger:hover {
  background: var(--error-700);
}

.id-linkbtn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.id-linkbtn:hover {
  color: var(--link-hover);
}

.id-linkbtn:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: var(--focus-ring);
}

/* ---------- Smaller parts ---------- */
/* the CAPTCHA on the sign-up page (the widget is 300 x 65) */
.id-captcha {
  margin: 0 0 16px;
}

.id-captcha__box {
  min-height: 65px;
}

.id-card .id-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 20px 0 0;
}

.id-scopes {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--grey-900);
}

.id-more {
  margin: 16px 0 0;
}

.id-more summary {
  width: fit-content;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.id-more summary:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: var(--focus-ring);
}

.id-more[open] summary {
  margin-bottom: 16px;
}

.id-passkey {
  margin: 0 0 20px;
}

.id-qr {
  width: 200px;
  max-width: 100%;
  margin: 0 0 16px;
  padding: 8px;
  border: 1px solid var(--grey-100);
  border-radius: var(--br-m);
  background: #fff;
}

.id-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.id-codes h2 {
  margin-bottom: 6px;
}

.id-codes ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px 16px;
  margin: 0;
  padding: 16px;
  border-radius: var(--br-m);
  background: var(--grey-050);
  list-style: none;
}

.id-list {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--grey-100);
}

.id-list li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--grey-100);
  color: var(--grey-900);
}

.id-list li span {
  color: var(--grey-700);
  font-size: 14px;
}

/* the picture row of the Profile box (tn-cp-logo + tn-cp-avatar--md) */
.id-picture {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.id-picture img {
  flex: none;
  width: 72px;
  height: 72px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--tn-tint);
  box-shadow: var(--bs-s);
  object-fit: cover;
}

.id-picture > div {
  flex: 1;
  min-width: min(100%, 260px);
}

/* ---------- Footer: the base line of the website's footer ---------- */
.id-footer {
  background: var(--tn-ink);
  color: var(--tn-muted-invert);
  font-size: 13px;
  line-height: 1.4;
}

.id-footer__bar {
  max-width: 1200px;
  margin-inline: auto;
  padding: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}

.id-footer__bar img {
  display: block;
  height: 24px;
  width: auto;
}

.id-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.id-footer a {
  border-radius: 2px;
  color: var(--tn-muted-invert);
  text-decoration: none;
}

.id-footer a:hover {
  color: #fff;
}

.id-footer a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-on-dark);
}

/* ---------- Narrow screens ---------- */
@media (max-width: 860px) {
  .id-console {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  /* the menu becomes one scrolling row (as on the website's Settings) */
  .id-nav {
    position: static;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    margin-inline: -24px;
    padding: 0 24px 8px;
    border-bottom: 1px solid var(--grey-100);
  }

  .id-nav .id-nav__out {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .id-two {
    grid-template-columns: minmax(0, 1fr);
  }

  .id-body {
    padding-block: 24px 56px;
  }

  .id-card {
    max-width: none;
  }
}

@media (max-width: 480px) {
  /* one button per row is easier to hit on a phone */
  .id-actions .id-btn {
    flex: 1 1 100%;
  }
}
