/*
 * NKI NFC — Approved design tokens
 *
 * SOT: docs/DESIGN_SYSTEM_SOT.md
 * Visual reference: ../welcome-mock.html — ONLY section[data-design-sot="welcome-content"]
 * plus shared page background/palette/typography (owner-approved, 2026-10-19).
 * Preview controls, badges, dialogs, and demo interactions outside the frame
 * are intentionally excluded and MUST NOT generate product design tokens.
 *
 * Use these tokens across Welcome, certificate, authentication, My Collection,
 * ownership/transfer flows. Do not fork palette/type/size values per page.
 * Ornamental one-off details may remain in page styles.
 */
:root {
  color-scheme: dark;

  /* Core palette — exact values from the approved Welcome Mock */
  --bg: #080908;
  --surface: #131310;
  --gold: #d8b875;
  --gold-light: #f3db9d;
  --gold-dark: #8d6c36;
  --text: #f7f0dc;
  --muted: #b1a58b;
  --muted-low: #817967;
  --line: rgba(206, 170, 105, .23);
  --sans: "LINE Seed Sans TH", Tahoma, system-ui, sans-serif;

  /* Reusable component colors and materials */
  --color-panel-border: rgba(204, 162, 93, .35);
  --color-panel-inset-border: rgba(204, 162, 93, .12);
  --color-action-primary-start: #bf974f;
  --color-action-primary-center: #f0d18a;
  --color-action-primary-end: #c09a56;
  --color-action-primary-text: #241a0b;
  --color-action-primary-border: #eac580;
  --color-action-secondary-text: #efd5a2;
  --color-action-secondary-bg: rgba(221, 180, 108, .05);
  --color-action-secondary-border: rgba(217, 177, 107, .67);
  --color-focus: var(--gold-light);

  /* Typography: only loaded families are Regular (400) and Bold (700) */
  --weight-regular: 400;
  --weight-bold: 700;
  --size-display: clamp(39px, 6vw, 54px);
  --size-display-mobile: 40px;
  --size-display-small: 35px;
  --size-subheading: clamp(19px, 3.4vw, 24px);
  --size-subheading-mobile: 19px;
  --size-subheading-small: 17px;
  --size-body: 14px;
  --size-description: 12px;
  --size-button: 14px;
  --size-eyebrow: 10px;

  /* Shared viewport-anchored GatewayFrame shell (Owner locked 2026-10-20). */
  --shell-edge: clamp(14px, 3.8vw, 29px);
  --shell-slot-gap: 6px;
  --shell-bottom-gap: 12px;
  --gateway-max-width: 550px;
  --gateway-content-inline: clamp(18px, 5vw, 39px);
  --member-dock-height: 68px;

  /* Layout: actual approved Welcome values, not a new spacing framework */
  --welcome-max-width: 550px;
  --welcome-desktop-padding-inline: clamp(25px, 6vw, 61px);
  --welcome-desktop-padding-top: 44px;
  --welcome-desktop-padding-bottom: 43px;
  --welcome-mobile-padding-inline: 25px;
  --welcome-mobile-padding-top: 30px;
  --welcome-mobile-padding-bottom: 31px;
  --welcome-small-padding-inline: 20px;
  --action-min-height: 57px;
  --action-gap: 12px;
  --action-radius: 3px;
  --panel-radius: 2px;
}

/* Auth pages extend the same Welcome shell and Design SOT tokens. */
.auth-hero{padding-top:10px;padding-bottom:28px}
.auth-layout{width:100%;max-width:var(--welcome-max-width);position:relative}
.auth-back{display:inline-flex;align-items:center;gap:7px;min-height:44px;margin:0 0 8px 2px;color:var(--gold);font-size:12px;text-decoration:none;font-weight:var(--weight-regular)}
.auth-back:hover,.auth-prompt a:hover{text-decoration:underline}
.auth-back svg{width:16px;height:16px;flex-shrink:0}
.auth-gateway{padding:28px clamp(25px,6vw,51px) 27px;text-align:left;align-items:stretch}
.auth-gateway form{width:100%;max-width:100%;margin-inline:auto}
.auth-heading{display:flex;align-items:center;justify-content:center;gap:12px;margin:0 0 20px;text-align:center}
.auth-heading svg{width:36px;height:36px;color:var(--gold);flex-shrink:0}
.auth-heading h1{font-size:clamp(30px,4vw,37px);line-height:1.3;margin:0}
.auth-fields{display:grid;gap:12px}
.auth-field{min-width:0;display:flex;flex-direction:column;gap:5px}
.auth-field label{font-size:13px;line-height:1.35;color:var(--text);font-weight:var(--weight-bold);display:flex;align-items:center;justify-content:space-between;gap:8px}
.auth-optional{color:var(--muted);font-size:11px;font-weight:var(--weight-regular)}
.auth-control{width:100%;height:46px;min-height:44px;padding:9px 12px;border:1px solid var(--color-panel-border);border-radius:var(--action-radius);background:rgba(8,9,8,.62);color:var(--text);font:inherit;font-size:14px}
.auth-control::placeholder{color:var(--muted-low)}
.auth-control:hover{border-color:var(--color-action-secondary-border)}
.auth-control:focus{outline:2px solid var(--color-focus);outline-offset:2px;border-color:var(--gold-light)}
.auth-control[aria-invalid="true"]{border-color:var(--gold-light)}
.auth-submit{width:100%;margin-top:18px}
.auth-gateway .auth-prompt{text-align:center;margin:13px 0 0;font-size:12px;color:var(--muted);line-height:1.5}
.auth-prompt a{color:var(--color-action-secondary-text);font-weight:var(--weight-bold);text-underline-offset:3px}
.auth-error,.auth-service{color:var(--gold-light);font-size:12px;line-height:1.55;margin:10px 0 0;text-align:center}
.auth-service[data-state="success"]{color:var(--gold-light)}
.auth-submit:disabled{opacity:.68;cursor:progress}
.auth-error{text-align:left}
@media(max-width:640px){
  .auth-hero{padding:4px 15px 14px;align-items:center}
  .auth-back{min-height:44px;margin-bottom:4px}
  .auth-gateway{padding:24px 23px 22px}
  .auth-heading{gap:9px;margin-bottom:14px}
  .auth-heading svg{height:29px;width:29px}
  .auth-heading h1{font-size:30px}
  .auth-fields{gap:8px}
  .auth-field{gap:3px}
  .auth-field label{font-size:12px;line-height:1.35}
  .auth-control{height:44px;min-height:44px;padding:8px 11px;font-size:14px}
  .auth-submit{margin-top:15px}
  .auth-gateway .auth-prompt{margin-top:11px}
}
@media(max-width:360px){
  .auth-hero{padding:3px 15px 12px}
  .auth-gateway{padding:20px 19px 19px}
  .auth-heading{margin-bottom:12px}
  .auth-heading h1{font-size:28px}
  .auth-fields{gap:7px}
  .auth-gateway .auth-prompt{margin-top:9px}
}
@media(max-height:720px) and (max-width:640px){
  .auth-hero{padding-top:1px;padding-bottom:9px}
  .auth-back{min-height:44px;margin-bottom:2px}
  .auth-gateway{padding-top:18px;padding-bottom:17px}
  .auth-heading{margin-bottom:10px}
  .auth-heading svg{width:25px;height:25px}
  .auth-heading h1{font-size:27px}
  .auth-fields{gap:6px}
  .auth-field{gap:2px}
  .auth-submit{margin-top:11px}
  .auth-gateway .auth-prompt{margin-top:8px}
}

/* Owner-locked NKI GatewayFrame: responsive background geometry, not content-sized.
 * Shared by Welcome, Login, Register, account views and all subsequent screens.
 * The decoration is outside the independently scrollable .gateway-content.
 */
.stage{height:100dvh;min-height:0;overflow:hidden}
.stage .topbar{
  width:min(1140px,100%);flex-shrink:0;
  padding:calc(var(--shell-edge) + env(safe-area-inset-top,0px))
          var(--shell-edge) 0;
}
.stage .hero,.stage.member-stage .account-main{
  display:flex;flex:1 1 0;min-height:0;min-width:0;width:100%;
  justify-content:center;align-items:stretch;
  overflow:hidden;
  padding:var(--shell-edge) var(--shell-edge) var(--shell-bottom-gap);
}
.stage .hero > div,.stage .account-layout{
  width:100%;height:100%;min-height:0;min-width:0;
  max-width:var(--gateway-max-width);position:relative;
  display:flex;flex-direction:column;margin:0 auto;
}
.stage .auth-back,.stage .account-back,.stage .frame-back-slot{
  flex:0 0 44px;height:44px;min-height:44px;
  width:max-content;max-width:100%;margin:0 0 var(--shell-slot-gap);
  align-items:center;
}
.stage .frame-back-slot{pointer-events:none}
.stage .gateway{
  flex:1 1 0;height:100%;max-height:100%;min-height:0;
  width:100%;max-width:100%;min-width:0;
  padding:0;display:flex;flex-direction:column;
  justify-content:stretch;align-items:stretch;
  text-align:left;overflow:hidden;
}
.stage .gateway-content{
  position:relative;z-index:1;
  flex:1 1 0;min-height:0;width:100%;min-width:0;
  display:flex;flex-direction:column;align-items:stretch;justify-content:safe center;
  overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;
  scrollbar-width:thin;scrollbar-color:var(--line) transparent;
  padding:clamp(14px,2.5vh,29px) var(--gateway-content-inline);
}
.stage .gateway[data-design-sot="welcome-content"] .gateway-content{text-align:center}
.stage .auth-gateway .gateway-content{text-align:left}
.stage .account-gateway .gateway-content{text-align:left}
.stage .collection-gateway .gateway-content{justify-content:flex-start}
.stage .dashboard-panel{min-height:0;text-align:center;justify-content:stretch;padding:0}
.stage .dashboard-panel .gateway-content{align-items:center;text-align:center}
.stage.member-stage{
  height:100dvh;min-height:0;overflow:hidden;
  padding-bottom:calc(var(--member-dock-height) + var(--shell-edge) + env(safe-area-inset-bottom,0px));
}
.stage.member-stage .account-main{overflow:hidden}
.stage .account-layout{margin:0 auto}
.stage .account-gateway{padding:0;min-height:0}
.stage .gateway .corner{z-index:2}
.stage .gateway::before{z-index:2}
.stage.member-stage .member-dock{
  width:min(calc(100% - 2 * var(--shell-edge)),var(--gateway-max-width));
  max-width:100%;min-width:0;
  left:50%;right:auto;transform:translateX(-50%);
  bottom:env(safe-area-inset-bottom,0px);
}
@media(max-width:640px){
  .stage .hero,.stage.member-stage .account-main{
    padding:var(--shell-edge) var(--shell-edge) var(--shell-bottom-gap);
  }
  .stage .gateway-content{padding:clamp(12px,2vh,20px) var(--gateway-content-inline)}
  .stage .auth-gateway .gateway-content{padding:clamp(12px,2vh,20px) var(--gateway-content-inline)}
}
@media(max-width:360px){
  .stage .gateway-content{padding:11px 15px}
  .stage .auth-gateway .gateway-content{padding:11px 15px}
}
/* Export tools uses the same shell/frame, but is not a signed-in member page. */
body:has(.tool-gateway){display:block;min-height:0;padding:0}
.stage .tool-layout{width:100%;height:100%;max-width:var(--gateway-max-width);min-height:0;display:flex;flex-direction:column}
.stage .tool-back{display:inline-flex;gap:7px;min-height:44px;color:var(--gold);font-size:12px;text-decoration:none}
.stage .tool-back svg{width:16px;height:16px;flex-shrink:0}
.stage .tool-gateway .gateway-content{justify-content:flex-start}
.stage .tool-gateway .panel{width:100%;max-width:100%;border:0;background:transparent;padding:0;margin:0}
