/* =========================================================================
   Karteo — Builder / Create page
   Reuses tokens & .pass styles from styles.css
   ========================================================================= */

body.builder { background: var(--ink); }

/* hide ticker etc. unique to home — none here, just keep nav style */

/* nav crumbs */
.builder-crumbs {
  display: flex; align-items: center; gap: 28px;
  justify-self: center;
  font-family: var(--t-mono);
  font-size: 12px;
  color: rgba(239,233,221,0.55);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.crumb-back {
  color: rgba(239,233,221,0.7);
  transition: color .2s var(--ease);
}
.crumb-back:hover { color: var(--paper); }
.crumb-progress { display: inline-flex; align-items: center; gap: 14px; }
.crumb-step {
  display: inline-flex; align-items: center; gap: 8px;
  color: rgba(239,233,221,0.4);
  transition: color .25s var(--ease);
}
.crumb-step.is-active { color: var(--accent); }
.crumb-step.is-done { color: var(--paper); }
.crumb-line {
  width: 36px; height: 1px; background: var(--ink-line);
  display: inline-block;
}
@media (max-width: 980px) {
  .builder-crumbs { display: none; }
}

/* =========================================================================
   Builder layout
   ========================================================================= */
.builder-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 80px) var(--gut) 120px;
}
.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: flex-start;
}

/* ---------- form ---------- */
.builder-form { min-width: 0; }
.bf-head { padding-bottom: 36px; border-bottom: 1px solid var(--ink-line); }
.bf-head .display-2 { margin-top: 14px; font-size: clamp(34px, 4.4vw, 56px); }
.bf-sub {
  margin: 18px 0 0;
  color: rgba(239,233,221,0.65);
  font-size: 15.5px;
  max-width: 480px;
}

.bf-section {
  border: 0; padding: 0; margin: 0;
  border-top: 1px solid var(--ink-line);
  padding: 28px 0;
}
.bf-section:first-of-type { border-top: 0; }

.bf-legend {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 18px;
  width: 100%;
}
.bf-num {
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.bf-l-t {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--paper);
}
.bf-l-req, .bf-l-opt {
  margin-left: auto;
  font-family: var(--t-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--ink-line);
}
.bf-l-req { color: var(--accent); border-color: rgba(224,78,26,0.4); }
.bf-l-opt { color: rgba(239,233,221,0.5); }

.bf-row { display: grid; gap: 12px; margin-top: 12px; }
.bf-row.two { grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .bf-row.two { grid-template-columns: 1fr; } }

.bf-field {
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
}
.bf-k {
  font-family: var(--t-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(239,233,221,0.5);
}
.bf-field input {
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  padding: 14px 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  transition: border-color .2s var(--ease), background .2s var(--ease);
  font-family: var(--t-1);
}
.bf-field input::placeholder { color: rgba(239,233,221,0.3); }
.bf-field input:hover { border-color: rgba(239,233,221,0.18); }
.bf-field input:focus {
  outline: 0;
  border-color: var(--accent);
  background: var(--ink-3);
}

/* ---------- style picker ---------- */
.style-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.style-card {
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  padding: 14px;
  border-radius: 16px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
  transition: border-color .25s var(--ease), background .25s var(--ease), transform .25s var(--ease);
}
.style-card:hover { border-color: rgba(239,233,221,0.2); transform: translateY(-2px); }
.style-card.is-active {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(224,78,26,0.08), rgba(224,78,26,0.02));
}
.style-card.is-active::before {
  content: ""; position: absolute;
  inset: -3px;
  border-radius: 18px;
  border: 1.5px solid var(--accent);
  pointer-events: none;
  opacity: 0.4;
}
.style-card { position: relative; }

.sc-thumb {
  position: relative;
  aspect-ratio: 5 / 3.2;
  border-radius: 10px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12px;
  overflow: hidden;
  font-family: var(--t-1);
}
.sc-mark {
  position: absolute; top: 10px; left: 10px;
  width: 14px; height: 14px;
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  background: rgba(255,255,255,0.92); color: #0E0E10;
}
.sc-name { display: block; line-height: 1; font-size: 11px; opacity: 0.85; }
.sc-name-2 { display: block; line-height: 1; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; margin-top: 3px; }
.sc-onyx { background: #0A0A0C; color: #fff; border: 1px solid rgba(255,255,255,0.06); }
.sc-onyx::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 50% 0%, rgba(255,255,255,0.08), transparent 60%);
}
.sc-linen { background: var(--linen); color: #1A1714; border: 1px solid rgba(0,0,0,0.05); }
.sc-linen .sc-mark { background: #0E0E10; color: #EFE9DD; }
.sc-linen .sc-name-2 { font-weight: 400; }
.sc-spectrum {
  background:
    radial-gradient(60% 50% at 15% 10%, rgba(77,91,255,0.95), transparent 60%),
    radial-gradient(60% 60% at 90% 0%, rgba(224,52,134,0.85), transparent 60%),
    radial-gradient(80% 80% at 100% 100%, rgba(76,18,140,0.95), transparent 70%),
    linear-gradient(135deg, #1a1466, #2a0a55);
  color: #fff;
}
.sc-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 16px 16px;
  pointer-events: none;
}
.sc-meta { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.sc-name-l {
  font-size: 16px; font-weight: 600; letter-spacing: -0.01em;
}
.sc-tag {
  font-family: var(--t-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(239,233,221,0.55);
}

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

/* ---------- accents ---------- */
.accents {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.accent {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--c, #E04E1A);
  border: 0;
  cursor: pointer;
  position: relative;
  transition: transform .2s var(--ease);
}
.accent:hover { transform: scale(1.08); }
.accent.is-active::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--paper);
}

/* ---------- action ---------- */
.bf-actions {
  margin-top: 32px;
  position: sticky; bottom: 16px;
}
.auth-panel {
  margin: 8px 0 22px;
  padding: 18px;
  border: 1px solid var(--ink-line);
  border-radius: 14px;
  background: rgba(239,233,221,0.035);
}
.auth-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.auth-title {
  color: var(--paper);
  font-weight: 650;
}
.auth-status {
  color: rgba(239,233,221,0.58);
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: right;
}
.auth-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.auth-signin,
.auth-signout {
  min-height: 46px;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .auth-copy { display: block; }
  .auth-status { text-align: left; margin-top: 6px; }
  .auth-row { flex-direction: column; align-items: stretch; }
}
.btn-block {
  display: flex; width: 100%; justify-content: center;
}
.btn-ico {
  display: inline-flex; align-items: center;
  width: 18px;
  margin-right: -2px;
}
.bf-fine {
  margin: 14px 0 0;
  text-align: center;
  font-family: var(--t-mono); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(239,233,221,0.45);
}

/* =========================================================================
   Live preview (right side)
   ========================================================================= */
.builder-preview {
  position: sticky;
  top: 96px;
  align-self: flex-start;
}
.preview-stage {
  display: flex; flex-direction: column; gap: 16px;
}
.preview-frame {
  position: relative;
  background: linear-gradient(180deg, rgba(239,233,221,0.04), rgba(239,233,221,0.01));
  border: 1px solid var(--ink-line);
  border-radius: 24px;
  padding: clamp(40px, 6vw, 64px);
  min-height: 540px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.preview-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(239,233,221,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(239,233,221,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,1), transparent 75%);
  -webkit-mask-image: radial-gradient(circle at center, rgba(0,0,0,1), transparent 75%);
}
.pass-live {
  width: clamp(260px, 100%, 360px);
  transform: rotate(-2deg);
  transition: transform .35s var(--ease);
}
.pass-live:hover { transform: rotate(0deg) translateY(-3px); }

.preview-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--t-mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(239,233,221,0.5);
}
.pm-k { color: var(--accent-3); }

/* accent stripe in pass */
.pass-accent-stripe {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  background: var(--c, transparent);
  opacity: 0.9;
}

/* style-specific live overrides applied via JS data-style="onyx" etc. */
.pass-live[data-style="linen"] .pass-name {
  font-family: var(--t-serif);
  font-weight: 400;
  font-size: clamp(34px, 3vw, 46px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.pass-live[data-style="linen"] .pass-given {
  font-style: italic;
  font-size: 0.9em;
  opacity: 1;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}
.pass-live[data-style="linen"] .pass-family { font-size: 1em; }

/* mobile reorganization */
@media (max-width: 980px) {
  .builder-grid { grid-template-columns: 1fr; }
  .builder-preview {
    position: relative; top: 0;
    order: -1;
  }
  .preview-frame { min-height: 420px; padding: 32px; }
}

/* =========================================================================
   SUCCESS overlay
   ========================================================================= */
.success-overlay {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.success-overlay[hidden] { display: none; }
.success-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(224,78,26,0.18), transparent 60%),
    radial-gradient(80% 80% at 50% 120%, rgba(77,91,255,0.16), transparent 70%),
    rgba(10,10,12,0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: fadeIn .35s var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } }

.success-panel {
  position: relative;
  width: min(1080px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 28px;
  padding: 48px clamp(28px, 4vw, 56px);
  animation: panelIn .5s var(--ease);
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.7);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.success-close {
  position: absolute; top: 20px; right: 20px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s var(--ease);
}
.success-close:hover { background: var(--ink-3); }

.success-head {
  text-align: center;
  margin-bottom: 36px;
}
.success-checkbar {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--t-mono);
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
  padding: 8px 14px;
  border: 1px solid rgba(224,78,26,0.3);
  border-radius: 999px;
}
.success-tick {
  width: 16px; height: 16px;
  background: var(--accent);
  border-radius: 50%;
  color: #0E0E10;
  display: inline-flex; align-items: center; justify-content: center;
}
.success-title {
  margin: 18px 0 0;
  font-size: clamp(32px, 4.4vw, 56px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-weight: 700;
}
.success-title .serif { font-weight: 400; display: block; }

.success-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
}
@media (max-width: 860px) {
  .success-body { grid-template-columns: 1fr; }
}

.success-card-wrap {
  display: flex; align-items: center; justify-content: center;
}
.success-card-stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.success-card-stage .pass-show {
  width: clamp(280px, 36vw, 360px);
  transform: rotate(-3deg);
  animation: cardIn .8s var(--ease);
}
@keyframes cardIn {
  from { transform: rotate(-12deg) translateY(20px) scale(0.92); opacity: 0; }
  to { transform: rotate(-3deg) translateY(0) scale(1); opacity: 1; }
}

.success-actions { display: flex; flex-direction: column; gap: 28px; }

.action-block { display: flex; flex-direction: column; gap: 10px; }
.ab-k {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(239,233,221,0.55);
  margin-bottom: 6px;
}

/* wallet buttons */
.wallet-btn {
  background: linear-gradient(180deg, #1A1A1F, #0D0D10);
  border: 1px solid var(--ink-line);
  color: var(--paper);
  padding: 14px 18px;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 14px;
  text-align: left;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.wallet-btn:hover { border-color: rgba(239,233,221,0.2); transform: translateY(-1px); }
.wallet-btn .wb-l1 {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(239,233,221,0.6);
  line-height: 1;
  margin-bottom: 2px;
}
.wallet-btn .wb-l2 {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.wallet-btn .wb-l1, .wallet-btn .wb-l2 { grid-column: 2; }
.wallet-btn .wb-status {
  grid-column: 3;
  font-family: var(--t-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-3);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.wallet-btn.is-added .wb-status { opacity: 1; }
.wallet-btn.is-added {
  border-color: rgba(181,232,83,0.35);
  background: linear-gradient(180deg, rgba(181,232,83,0.04), rgba(181,232,83,0.01));
}
.wallet-vcard { grid-template-columns: 22px 1fr 1fr auto; }
.wallet-vcard .wb-l1, .wallet-vcard .wb-l2 {
  grid-column: auto;
  text-transform: none; letter-spacing: -0.01em;
  font-size: 15px; font-weight: 500;
  color: var(--paper);
  margin: 0;
}
.wallet-vcard .wb-l1 { font-family: var(--t-1); }
.wallet-vcard .wb-l2 { font-family: var(--t-mono); font-size: 12px; color: rgba(239,233,221,0.5); letter-spacing: 0.04em; }

/* share */
.share-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  background: var(--ink-2);
  border: 1px solid var(--ink-line);
  border-radius: 14px;
  padding: 16px;
}
.share-qr {
  width: 110px; height: 110px;
  background: white;
  border-radius: 10px;
  padding: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.share-qr img, .share-qr svg { width: 100%; height: 100%; display: block; }
.share-copy { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.copy-k {
  font-family: var(--t-mono); font-size: 10.5px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(239,233,221,0.5);
}
.copy-row {
  display: flex; gap: 6px;
  background: var(--ink);
  border: 1px solid var(--ink-line);
  border-radius: 10px;
  padding: 4px 4px 4px 12px;
  align-items: center;
}
.copy-row input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--paper);
  font: inherit;
  font-family: var(--t-mono);
  font-size: 12px;
  padding: 8px 0;
  outline: 0;
  min-width: 0;
}
.copy-btn {
  background: var(--paper);
  color: var(--ink);
  border: 0;
  padding: 8px 12px;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
  transition: background .2s var(--ease);
}
.copy-btn:hover { background: #fff; }
.copy-btn.is-copied {
  background: var(--accent-3); color: #0E0E10;
}

.share-native {
  background: transparent;
  border: 1px solid var(--ink-line);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  align-self: flex-start;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .2s var(--ease);
}
.share-native:hover { border-color: var(--paper); }

@media (max-width: 480px) {
  .share-row { grid-template-columns: 1fr; }
  .share-qr { width: 100%; max-width: 200px; height: auto; aspect-ratio: 1; align-self: center; }
}

.action-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap;
  padding-top: 18px;
  border-top: 1px solid var(--ink-line);
  font-size: 13.5px;
  color: rgba(239,233,221,0.6);
}
.foot-cta {
  color: var(--accent);
  font-weight: 500;
}
.foot-cta:hover { color: var(--paper); }

/* shake error feedback */
.shake { animation: shake .4s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.invalid input { border-color: var(--accent) !important; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--paper);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6);
  z-index: 300;
  opacity: 0;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
  pointer-events: none;
}
.toast.is-on {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
