/* Account pages (sign in, sign up and the rest), shared form controls and the header account
   control. Tokens only: no colour, size or weight is defined here that tokens.css does not own.
   Colour pairs are checked by tests/contrast.test.mjs (UI-SPEC pairs 24 to 33). */

/* ---------- auth layout ---------- */
.auth-main{
  flex:1;
  width:100%;
  max-width:480px;
  margin:0 auto;
  padding:var(--space-2xl) var(--space-lg);
  display:flex;
  flex-direction:column;
  gap:var(--space-md);
}
.auth-main h1{
  font-family:var(--font-display);
  font-weight:400;
  font-size:var(--heading-size);
  line-height:var(--heading-line);
  letter-spacing:.01em;
  text-transform:uppercase;
}
.auth-panel{
  background:var(--ink-soft);
  color:var(--paper);
  border-radius:var(--space-sm);
  padding:var(--space-lg);
  display:flex;
  flex-direction:column;
  gap:var(--space-md);
}
.auth-panel form{display:flex;flex-direction:column;gap:var(--space-md)}
.field{display:flex;flex-direction:column}
@media (min-width:400px){
  .auth-panel{padding:var(--space-xl)}
}
@media (min-width:768px){
  .auth-main{padding:var(--space-3xl) var(--space-lg)}
  .field-row{display:flex;gap:var(--space-md)}
  .field-row .field{flex:1}
}

/* ---------- form controls ---------- */
input[type="password"],input[type="tel"],input[type="url"],select{
  width:100%;
  min-height:48px;
  padding:0 var(--space-md);
  font-family:var(--font-body);
  font-size:var(--body-size);
  line-height:var(--body-line);
  background-color:var(--paper);
  color:var(--ink);
  border:2px solid var(--ink);
  border-radius:var(--space-sm);
}
select{
  appearance:none;
  -webkit-appearance:none;
  padding-right:var(--space-2xl);
  background-image:
    linear-gradient(45deg,transparent 50%,var(--ink) 50%),
    linear-gradient(135deg,var(--ink) 50%,transparent 50%);
  background-position:calc(100% - 22px) 50%,calc(100% - 16px) 50%;
  background-size:6px 6px,6px 6px;
  background-repeat:no-repeat;
}
.auth-panel input[aria-invalid="true"],.auth-panel select[aria-invalid="true"]{border-color:var(--coral-light)}

.checkbox-field{display:flex;align-items:flex-start;gap:var(--space-md)}
.checkbox-field label{
  display:flex;
  align-items:center;
  gap:var(--space-md);
  min-height:48px;
  margin-bottom:0;
  font-size:var(--body-size);
  font-weight:var(--body-weight);
  line-height:var(--body-line);
  cursor:pointer;
}
.checkbox-field input[type="checkbox"]{
  flex:none;
  width:24px;
  height:24px;
  accent-color:var(--accent);
}

.password-field{position:relative}
.password-field input{padding-right:72px}
.password-toggle{
  position:absolute;
  right:0;
  bottom:0;
  width:64px;
  height:48px;
  background:transparent;
  border:0;
  color:var(--ink);
  font-family:var(--font-body);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
  text-decoration:underline;
  cursor:pointer;
}
.password-toggle:focus-visible{outline-color:var(--ink);outline-offset:-3px}

.field-hint{
  margin-top:var(--space-xs);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
  color:rgba(250,249,245,.75);
}
.field-hint:empty{display:none}
.field-hint button{
  min-height:48px;
  padding:0 var(--space-sm);
  background:transparent;
  border:0;
  color:var(--paper);
  font-family:var(--font-body);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  text-decoration:underline;
  cursor:pointer;
}
.field-hint button:hover{color:var(--accent-text-on-ink)}
.field-error,.form-error{
  margin-top:var(--space-xs);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
  color:var(--coral-light);
}
.form-error{padding:var(--space-md);border:2px solid var(--coral-light);border-radius:var(--space-sm)}
.form-status{
  padding-left:var(--space-md);
  border-left:4px solid var(--accent);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
}
.form-status:empty{display:none}

.auth-links{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:var(--space-sm);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
}
.auth-links a{
  color:var(--paper);
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:4px;
}
.auth-links a:hover{color:var(--accent-text-on-ink)}

/* "Link not working?" paste box on the link pages: open with no token, folded once the script has one. */
.link-paste summary{
  cursor:pointer;
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:4px;
}
.link-paste[open] summary{margin-bottom:var(--space-sm)}

.auth-main .btn-primary{width:100%}
@media (min-width:768px){
  .auth-main .btn-primary{width:auto}
}

/* ---------- header account control ---------- */
.site-header{align-items:center}
.site-header .wordmark{margin-right:auto}
.account-slot{position:relative;display:flex;align-items:center}
.account-signin,.account-btn{
  white-space:nowrap;
  display:inline-flex;
  align-items:center;
  gap:var(--space-sm);
  min-height:48px;
  padding:0 var(--space-xs);
  background:transparent;
  border:0;
  color:var(--paper);
  font-family:var(--font-body);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
  letter-spacing:.08em;
  text-transform:uppercase;
  text-decoration:underline;
  text-decoration-thickness:2px;
  text-underline-offset:4px;
  cursor:pointer;
}
.account-signin:hover,.account-btn:hover{color:var(--accent-text-on-ink)}
.account-btn{text-decoration:none}
.account-name{
  display:inline-block;
  max-width:160px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.account-btn::after{
  content:"";
  width:6px;
  height:6px;
  border-right:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg) translateY(-2px);
  transition:transform .2s;
}
.account-btn[aria-expanded="true"]::after{transform:rotate(225deg)}

#account-menu{
  position:absolute;
  top:100%;
  right:0;
  z-index:25;
  min-width:224px;
  max-width:calc(100vw - 48px);
  padding:var(--space-sm);
  list-style:none;
  background:var(--ink-soft);
  color:var(--paper);
  border:1px solid rgba(250,249,245,.12);
  border-radius:var(--space-sm);
}
#account-menu[hidden]{display:none}
#account-menu form{display:block}
#account-menu a,#account-menu button{
  display:flex;
  align-items:center;
  width:100%;
  min-height:48px;
  padding:0 var(--space-md);
  background:transparent;
  border:0;
  border-radius:var(--space-xs);
  color:var(--paper);
  font-family:var(--font-body);
  font-size:var(--body-size);
  font-weight:var(--body-weight);
  line-height:var(--body-line);
  text-align:left;
  text-decoration:none;
  cursor:pointer;
}
#account-menu a:hover,#account-menu button:hover,
#account-menu a:focus-visible,#account-menu button:focus-visible{
  background:var(--accent);
  color:var(--ink);
}
#account-menu a:focus-visible,#account-menu button:focus-visible{outline-offset:-3px;outline-color:var(--ink)}

/* ---------- notices ---------- */
.notice-line{
  margin:var(--space-md) var(--space-lg) 0;
  padding-left:var(--space-md);
  border-left:4px solid var(--accent);
  color:var(--paper);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
}

@media (prefers-reduced-motion:reduce){
  .account-btn::after{transition:none}
}

/* ---------- unconfirmed-email banner ---------- */
.confirm-banner{
  display:flex;
  flex-direction:column;
  gap:var(--space-md);
  padding:var(--space-md) var(--space-lg);
  background:var(--paper);
  color:var(--ink);
  border-left:4px solid var(--accent);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
}
.confirm-banner p{margin:0}
.confirm-banner button{
  min-height:48px;
  padding:0 var(--space-lg);
  background:var(--paper);
  color:var(--ink);
  border:2px solid var(--ink);
  border-radius:var(--space-sm);
  font:inherit;
  font-weight:800;
  cursor:pointer;
}
.confirm-banner button:hover{background:var(--ink);color:var(--paper)}
.confirm-banner :focus-visible{outline:3px solid var(--ink);outline-offset:2px}
@media (min-width:768px){
  .confirm-banner{flex-direction:row;align-items:center;justify-content:space-between}
}

/* ---------- button-page result ---------- */
.auth-result{display:flex;flex-direction:column;align-items:flex-start;gap:var(--space-md)}
.auth-result h2{margin:0}
.auth-result p{margin:0}

/* ---------- My Account ---------- */
.account-main{max-width:720px}
.account-main h1{margin:0}
.account-cards{display:flex;flex-direction:column;gap:var(--space-lg)}
.account-card h2{
  margin:0;
  font-family:var(--font-display);
  font-weight:400;
  font-size:var(--heading-size);
  line-height:var(--heading-line);
  letter-spacing:.01em;
  text-transform:uppercase;
}
.account-card p{margin:0}
.account-email{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-sm);font-weight:800}
.badge-unconfirmed{
  display:inline-block;
  padding:var(--space-xs) var(--space-sm);
  background:var(--paper);
  color:var(--ink);
  border-radius:var(--space-xs);
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  line-height:var(--label-line);
}
.account-pending{display:flex;flex-direction:column;gap:var(--space-md)}
.account-pending-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-md)}
.account-pending-actions form{display:block}
.btn-text{
  min-height:48px;
  padding:0 var(--space-md);
  background:transparent;
  border:0;
  color:var(--paper);
  font:inherit;
  font-size:var(--label-size);
  font-weight:var(--label-weight);
  text-decoration:underline;
  cursor:pointer;
}
.btn-text:hover{color:var(--accent-text-on-ink)}
.btn-text:focus-visible{outline:3px solid var(--accent-text-on-ink);outline-offset:2px}
.account-card .btn-primary,.account-card .btn-secondary{width:auto;align-self:flex-start}

/* ---------- welcome card ---------- */
.welcome-main{max-width:560px}
.welcome-main h1{
  font-size:var(--display-size);
  line-height:var(--display-line);
}
.welcome-main .auth-panel h2{
  margin:0;
  font-family:var(--font-display);
  font-weight:400;
  font-size:var(--heading-size);
  line-height:var(--heading-line);
  letter-spacing:.01em;
  text-transform:uppercase;
}
.welcome-main .auth-panel p{margin:0}

/* ---------- contact message box ---------- */
textarea{
  width:100%;
  min-height:192px;
  padding:var(--space-md);
  font-family:var(--font-body);
  font-size:var(--body-size);
  line-height:var(--body-line);
  background-color:var(--paper);
  color:var(--ink);
  border:2px solid var(--ink);
  border-radius:var(--space-sm);
  resize:vertical;
}
textarea:focus-visible{outline:3px solid var(--chartreuse);outline-offset:3px}
body[data-site="pickleball"] textarea:focus-visible{outline-color:var(--coral-light)}
.auth-panel textarea[aria-invalid="true"]{border-color:var(--coral-light)}
.auth-panel[hidden]{display:none}
