/* Secondary pages: account (sign-up, login, verification, password reset, account settings)
   and plain documents (privacy, terms). Loaded after styles.css, which holds the tokens. */

/* Auth: form on the left, teal brand panel on the right. */

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, .85fr);
  min-height: 100vh;
  min-height: 100svh;
}

.auth-main {
  display: flex;
  flex-direction: column;
  width: min(100% - 48px, 440px);
  margin: 0 auto;
  padding: 32px 0;
}

.auth-main > .brand { align-self: flex-start; }

.auth-card {
  margin: auto 0;
  padding: 48px 0;
}

.auth-card h1 {
  margin: 14px 0 12px;
  font-size: clamp(2.1rem, 4vw, 2.7rem);
  letter-spacing: -.035em;
  line-height: 1.05;
}

.lede {
  margin: 0 0 32px;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.lede strong { color: var(--ink); font-weight: 600; word-break: break-all; }

.auth-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  color: var(--ink-soft);
  font-size: .8rem;
}

.auth-foot a:hover { color: var(--ink); text-decoration: underline; }

.auth-aside {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100vh - 32px);
  height: calc(100svh - 32px);
  margin: 16px 16px 16px 0;
  padding: clamp(32px, 4vw, 56px);
  overflow: hidden;
  border-radius: 28px;
  background: var(--ink);
  color: var(--paper);
}

.auth-aside img { width: min(60%, 34vh, 340px); margin: auto auto 48px; }

.auth-aside h2 {
  max-width: 440px;
  margin: 0 0 32px;
  font-size: clamp(2.2rem, 3.4vw, 3.4rem);
}

.auth-aside .hero-prompt { font-size: .86rem; }
.auth-aside .prompt-output { display: block; }
.prompt-ok { color: var(--amber); }

/* Forms */

.form { display: grid; gap: 20px; }

.field { display: grid; gap: 8px; }

.field-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

label,
.label {
  font-size: .86rem;
  font-weight: 600;
}

.field-top a,
.text-link {
  color: var(--ink);
  font-size: .84rem;
  font-weight: 600;
  border-bottom: 1px solid var(--vermilion);
}

.field-top a:hover,
.text-link:hover { color: var(--vermilion-deep); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"] {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1.5px solid rgba(14, 59, 67, .24);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}

input::placeholder { color: rgba(77, 104, 109, .7); }
input:hover { border-color: rgba(14, 59, 67, .45); }

input:focus {
  border-color: var(--ink);
  outline: none;
  box-shadow: 0 0 0 4px rgba(14, 59, 67, .12);
}

input[aria-invalid="true"] { border-color: var(--vermilion-deep); }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(224, 83, 61, .16); }
input[readonly] { background: var(--paper-deep); color: var(--ink-soft); }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 76px; }

.reveal {
  position: absolute;
  top: 7px;
  right: 7px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font: 600 .78rem var(--mono);
  cursor: pointer;
}

.reveal:hover { background: var(--paper-deep); color: var(--ink); }

.hint,
.field-error {
  margin: 0;
  font-size: .8rem;
  line-height: 1.5;
}

.hint { color: var(--ink-soft); }
.field-error { color: var(--vermilion-deep); font-weight: 600; }
.field-error:empty { display: none; }

.code-input {
  height: 64px !important;
  font-family: var(--mono) !important;
  font-size: 1.7rem !important;
  font-weight: 700;
  letter-spacing: .5em;
  text-align: center;
  padding-left: calc(16px + .25em) !important;
}

.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, opacity .15s ease;
}

.button:hover { background: var(--ink-deep); }
.button:focus-visible { outline: 3px solid var(--vermilion); outline-offset: 3px; }
.button[disabled] { cursor: progress; opacity: .7; }
.button.block { width: 100%; }
.button.secondary { background: transparent; color: var(--ink); }
.button.secondary:hover { background: var(--ink); color: var(--paper); }
.button.danger { border-color: var(--vermilion-deep); background: var(--vermilion-deep); }
.button.danger:hover { background: var(--ink); border-color: var(--ink); }
.button.small { height: 42px; padding: 0 18px; font-size: .86rem; }

.button[data-busy]::before {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.notice {
  display: flex;
  gap: 12px;
  margin: 0 0 24px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--paper-deep);
  font-size: .9rem;
  line-height: 1.55;
}

.notice[hidden] { display: none; }
.notice::before {
  flex: none;
  width: 4px;
  border-radius: 4px;
  background: var(--ink);
  content: "";
}

.notice.error { background: rgba(224, 83, 61, .1); }
.notice.error::before { background: var(--vermilion-deep); }
.notice.success::before { background: var(--amber); }

.legal-line,
.switch {
  margin: 0;
  color: var(--ink-soft);
  font-size: .84rem;
  line-height: 1.6;
}

.legal-line a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.switch { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); font-size: .9rem; }
.switch a { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--vermilion); }

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: 20px;
  font-size: .88rem;
  color: var(--ink-soft);
}

.link-button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--vermilion);
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.link-button[disabled] { border-color: transparent; color: var(--ink-soft); cursor: default; }

.state-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--amber);
  font: 700 1.5rem var(--mono);
}

/* Header state: pages start with the signed-out links; account.js swaps them. */

.nav-login[hidden],
.nav-cta[hidden],
.nav-account[hidden] { display: none; }

/* Account settings */

.page-main {
  width: min(100% - 48px, 880px);
  margin: 0 auto;
  padding: 64px 0 96px;
}

/* The greeting sits inside #account-content, so this matches any heading on the page; a long name wraps instead of
   pushing the page wider than a phone. */
.page-main h1 {
  margin: 14px 0 12px;
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  letter-spacing: -.04em;
  line-height: 1;
  overflow-wrap: anywhere;
}

.panel {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}

.panel[hidden] { display: none; }

.panel h2 {
  font-size: 1.15rem;
  letter-spacing: -.02em;
  line-height: 1.3;
}

.panel-intro { margin: 8px 0 0; color: var(--ink-soft); font-size: .86rem; line-height: 1.55; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 14px 28px;
  margin: 0;
  font-size: .95rem;
}

.facts dt { color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 500; word-break: break-word; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper-deep);
  font: 700 .66rem var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.badge::before { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); content: ""; }

.product-list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }

.product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.product-row strong { display: block; font-family: var(--display); font-size: 1.1rem; letter-spacing: -.02em; }
.product-row span { color: var(--ink-soft); font-size: .86rem; }

.panel .form { max-width: 420px; }

.change-name { margin-top: 24px; }
.change-name summary { display: inline; cursor: pointer; }
.change-name .form { margin-top: 20px; }
.panel-intro.flush { margin: 0 0 16px; }

details.danger summary {
  color: var(--vermilion-deep);
  font-weight: 600;
  cursor: pointer;
}

details.danger[open] summary { margin-bottom: 20px; }

.account-loading { padding: 120px 0; color: var(--ink-soft); text-align: center; }

/* Plain documents: privacy and terms */

.doc {
  width: min(100% - 48px, 760px);
  margin: 0 auto;
  padding: 72px 0 112px;
  font-size: 1.02rem;
  line-height: 1.7;
}

.doc h1 {
  margin: 14px 0 8px;
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  letter-spacing: -.04em;
  line-height: 1;
}

.doc .updated { margin: 0 0 48px; color: var(--ink-soft); font-family: var(--mono); font-size: .78rem; }
.doc h2 { margin: 48px 0 12px; font-size: 1.5rem; letter-spacing: -.025em; line-height: 1.2; }
.doc h3 { margin: 28px 0 8px; font-size: 1.12rem; letter-spacing: -.01em; line-height: 1.3; }
.doc p, .doc ul { margin: 0 0 16px; }
.doc ul { padding-left: 1.2em; }
.doc li { margin-bottom: 8px; }
.doc a { border-bottom: 1px solid var(--vermilion); }
.doc table { width: 100%; margin: 0 0 16px; border-collapse: collapse; font-size: .92rem; }
.doc th, .doc td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc th { font-weight: 600; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .panel { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 600px) {
  .auth-main { width: min(100% - 32px, 440px); padding: 20px 0 24px; }
  .auth-card { padding: 40px 0 36px; }
  .lede { margin-bottom: 26px; }
  .page-main,
  .doc { width: min(100% - 32px, 880px); padding-top: 44px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 12px; }
  .product-row { align-items: flex-start; flex-direction: column; }
}

.not-found-prompt { margin: 0 0 24px; padding: 0; border: 0; color: var(--ink-soft); }
.not-found-prompt .prompt-output { color: var(--ink); }
.doc a.button { border-bottom: 1.5px solid var(--ink); }
