/* ==========================================================
   ONELINK — app styles (marketing + dashboard)

   Direction: a sticker sheet. The product is a page people
   decorate, so the chrome around it is bold and tactile —
   solid borders, offset shadows, no blur. Boldness is spent
   on one thing: the live phone preview.
   ========================================================== */

:root {
  --ink:        #1b1a17;
  --ink-soft:   #6b675d;
  --ink-faint:  #9d988c;
  --paper:      #fffdf6;
  --sand:       #f2eee2;
  --line:       #e0dacb;

  --violet:      #5b3df5;
  --violet-deep: #4429d8;
  --sun:         #ffc93c;
  --mint:        #17c3a2;
  --rose:        #ff5f6d;

  --shadow-hard: 4px 4px 0 var(--ink);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body:    'Public Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'Space Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.025em;
  margin: 0 0 .5rem;
}
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); }
h2 { font-size: clamp(1.4rem, 3.4vw, 2rem); }
h3 { font-size: 1.1rem; letter-spacing: -.01em; }

a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid var(--violet); outline-offset: 2px; border-radius: 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.15rem; }
.wrap--narrow { max-width: 560px; }

.skip { position: absolute; left: -9999px; background: #fff; padding: .6rem 1rem; z-index: 99; }
.skip:focus { left: 1rem; top: .5rem; }

/* ---------- header ---------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  min-height: 68px; flex-wrap: wrap;
}
.logo {
  font-family: var(--font-display); font-weight: 800; font-size: 1.4rem;
  letter-spacing: -.04em; color: var(--ink); display: inline-flex; align-items: center; gap: .45rem;
}
.logo:hover { text-decoration: none; }
.logo__mark {
  width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 8px;
  background: var(--sun); display: inline-block; position: relative;
}
.logo__mark::after {
  content: ''; position: absolute; inset: 5px 5px auto 5px; height: 3px;
  background: var(--ink); border-radius: 2px;
  box-shadow: 0 6px 0 var(--ink);
}

.topnav { margin-left: auto; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.topnav a { color: var(--ink); padding: .45rem .75rem; border-radius: 9px; font-size: .93rem; font-weight: 500; }
.topnav a:hover { background: var(--sand); text-decoration: none; }
.topnav a.is-current { background: var(--sand); }

/* ---------- buttons --------------------------------------- */
.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: .95rem;
  padding: .7rem 1.3rem; border-radius: 11px; cursor: pointer; text-align: center;
  border: 2px solid var(--ink); background: var(--violet); color: #fff;
  box-shadow: var(--shadow-hard);
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { text-decoration: none; color: #fff; transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn--sun  { background: var(--sun);  color: var(--ink); }
.btn--sun:hover { color: var(--ink); }
.btn--quiet {
  background: #fff; color: var(--ink); box-shadow: none;
  border-color: var(--line); font-weight: 600;
}
.btn--quiet:hover { background: var(--sand); color: var(--ink); transform: none; box-shadow: none; }
.btn--sm { padding: .4rem .8rem; font-size: .85rem; border-radius: 9px; }
.btn--wide { display: block; width: 100%; }
.btn--danger { background: #fff; color: var(--rose); border-color: var(--line); box-shadow: none; }
.btn--danger:hover { background: #fff0f1; color: var(--rose); transform: none; box-shadow: none; }

/* ---------- hero ------------------------------------------ */
.hero { padding: 2rem 0 3.5rem; }
.hero__grid { display: grid; gap: 2.5rem; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 900px) { .hero__grid { grid-template-columns: 1.05fr .95fr; gap: 3rem; } }

.hero p.lede { font-size: 1.1rem; color: var(--ink-soft); max-width: 42ch; margin: .6rem 0 1.6rem; }

.hero__mark {
  display: inline-block; background: var(--mint); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 999px;
  padding: .2rem .8rem; font-size: .82rem; font-weight: 700; margin-bottom: 1rem;
}

/* claim form */
.claim { display: flex; align-items: stretch; gap: .5rem; flex-wrap: wrap; }
.claim__field {
  display: flex; align-items: center; flex: 1 1 260px;
  border: 2px solid var(--ink); border-radius: 11px; background: #fff;
  padding: 0 .8rem; min-width: 0;
}
.claim__prefix { font-family: var(--font-mono); font-size: .92rem; color: var(--ink-faint); white-space: nowrap; }
.claim__field input {
  border: 0; outline: 0; font: inherit; font-family: var(--font-mono);
  padding: .75rem .2rem; width: 100%; min-width: 0; background: transparent; color: var(--ink);
}
.claim__note { font-size: .85rem; margin: .55rem 0 0; min-height: 1.2em; }
.claim__note.is-free  { color: #157a4a; }
.claim__note.is-taken { color: var(--rose); }

/* ---------- SIGNATURE: phone preview ---------------------- */
.phone {
  width: 300px; max-width: 100%; margin: 0 auto;
  border: 3px solid var(--ink); border-radius: 34px;
  background: #fff; padding: 9px;
  box-shadow: 8px 8px 0 var(--ink);
}
.phone__screen {
  border-radius: 26px; overflow: hidden; height: 540px;
  position: relative; background: var(--sand);
}
.phone__screen iframe { width: 100%; height: 100%; border: 0; display: block; }
.phone__notch {
  position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 82px; height: 6px; border-radius: 99px; background: rgba(0,0,0,.25); z-index: 2;
}
.phone__empty {
  display: flex; align-items: center; justify-content: center; height: 100%;
  padding: 2rem; text-align: center; color: var(--ink-soft); font-size: .9rem;
}

/* ---------- feature row ----------------------------------- */
.features { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 0 0 3rem; }
@media (min-width: 760px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { border: 2px solid var(--ink); border-radius: 14px; padding: 1.2rem; background: #fff; }
.feature h3 { margin-bottom: .3rem; }
.feature p { margin: 0; font-size: .92rem; color: var(--ink-soft); }
.feature__chip {
  width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--ink);
  display: grid; place-items: center; margin-bottom: .8rem; font-weight: 800;
  font-family: var(--font-display);
}

/* ---------- panels / dashboard ---------------------------- */
.page { padding: 1.5rem 0 3rem; }
.panel {
  background: #fff; border: 2px solid var(--ink); border-radius: 14px;
  padding: 1.2rem; margin-bottom: 1.1rem;
}
.panel--quiet { border: 1px solid var(--line); }
.panel__head {
  display: flex; justify-content: space-between; align-items: center;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem;
}
.panel__head h2, .panel__head h3 { margin: 0; }

.dash { display: grid; gap: 1.5rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 980px) { .dash { grid-template-columns: 1fr 330px; } }
.dash__side { position: sticky; top: 1rem; }

/* handle strip */
.handle {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--sand); border: 2px solid var(--ink); border-radius: 12px;
  padding: .6rem .9rem; margin-bottom: 1.1rem;
}
.handle code { font-family: var(--font-mono); font-size: .9rem; word-break: break-all; }

.qr-panel {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  border: 2px solid var(--ink); border-radius: 12px; background: #fff;
  padding: .9rem; margin-bottom: 1.1rem;
}
.qr-panel img {
  width: 140px; height: 140px; flex: none; border-radius: 8px;
  background: var(--sand); border: 2px solid var(--ink);
}

/* ---------- link rows ------------------------------------- */
.linklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.linkrow {
  display: grid; grid-template-columns: auto 1fr auto; gap: .3rem .7rem;
  align-items: center;
  border: 2px solid var(--ink); border-radius: 12px; background: #fff; padding: .7rem .8rem;
}
.linkrow.is-off { opacity: .55; background: var(--sand); }
.linkrow.is-header { background: var(--sand); border-style: dashed; }
.linkrow.is-dragging { opacity: .4; }
.linkrow.is-over { border-color: var(--violet); }

.grip {
  cursor: grab; color: var(--ink-faint); background: none; border: 0;
  padding: .2rem .1rem; font-size: 1.1rem; line-height: 1; touch-action: none;
}
.grip:active { cursor: grabbing; }

.linkrow__body { min-width: 0; }
.linkrow__body::after { content: ''; display: block; clear: both; }
.linkrow__thumb {
  width: 38px; height: 38px; border-radius: 9px; object-fit: cover;
  border: 2px solid var(--ink); float: left; margin: .1rem .55rem 0 0;
}
.linkrow__title { font-weight: 700; font-size: .97rem; word-break: break-word; }
.linkrow__url {
  font-family: var(--font-mono); font-size: .76rem; color: var(--ink-soft);
  word-break: break-all; display: block;
}
.linkrow__tags { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .3rem; }
.chip {
  font-size: .68rem; font-weight: 700; padding: .05rem .45rem;
  border: 1px solid var(--ink); border-radius: 999px; background: #fff;
}
.chip--sun   { background: var(--sun); }
.chip--mint  { background: var(--mint); }
.chip--muted { border-color: var(--line); color: var(--ink-soft); }

.linkrow__actions { display: flex; gap: .3rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.linkrow__clicks {
  font-family: var(--font-mono); font-size: .8rem; color: var(--ink-soft);
  white-space: nowrap; padding-right: .2rem;
}

/* toggle */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; background: #fff; border: 2px solid var(--ink);
  border-radius: 999px; transition: background .12s ease; pointer-events: none;
}
.switch span::after {
  content: ''; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px;
  background: var(--ink); border-radius: 50%; transition: transform .12s ease;
}
.switch input:checked + span { background: var(--mint); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }

/* ---------- forms ----------------------------------------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 700; font-size: .88rem; margin-bottom: .3rem; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: .82rem; }
.field input[type="text"], .field input[type="url"], .field input[type="email"],
.field input[type="password"], .field input[type="date"], .field select, .field textarea {
  width: 100%; font: inherit; font-size: .95rem; padding: .65rem .75rem;
  border: 2px solid var(--ink); border-radius: 11px; background: #fff; color: var(--ink);
}
.field textarea { min-height: 88px; resize: vertical; }
.field--split { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 620px) { .field--split { grid-template-columns: 1fr 1fr; } }
.charcount { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-soft); float: right; }

/* theme picker */
.themegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .7rem; }
.themecard { position: relative; }
.themecard input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.themecard span.swatch {
  display: block; height: 68px; border: 2px solid var(--ink); border-radius: 11px;
  margin-bottom: .3rem; position: relative; overflow: hidden;
}
.themecard span.swatch i {
  position: absolute; left: 14%; right: 14%; height: 9px; border-radius: 99px;
  border: 1.5px solid; top: 22%;
}
.themecard span.swatch i + i { top: 45%; }
.themecard span.swatch i + i + i { top: 68%; }
.themecard span.label { font-size: .78rem; font-weight: 600; display: block; text-align: center; }
.themecard input:checked + span.swatch { outline: 3px solid var(--violet); outline-offset: 2px; }
.themecard input:focus-visible + span.swatch { outline: 3px solid var(--ink); outline-offset: 2px; }

/* segmented control */
.segmented { display: flex; flex-wrap: wrap; gap: .4rem; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.segmented span {
  display: block; padding: .4rem .85rem; border: 2px solid var(--ink); border-radius: 999px;
  font-size: .85rem; font-weight: 700; background: #fff;
}
.segmented input:checked + span { background: var(--sun); }
.segmented input:focus-visible + span { outline: 3px solid var(--violet); outline-offset: 2px; }

/* avatar row */
.avatarrow { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.avatar-preview {
  width: 76px; height: 76px; border-radius: 50%; border: 2px solid var(--ink);
  object-fit: cover; background: var(--sun);
  display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 800; font-size: 1.6rem; flex: none;
}
/* `display: grid` above wins over the browser's own `[hidden]` rule at
   equal specificity (author styles beat user-agent styles on a tie), so
   without this override a hidden preview would still take up space. */
.avatar-preview[hidden] { display: none; }

.cover-preview {
  width: 100%; max-width: 360px; aspect-ratio: 3 / 1; border-radius: 10px;
  border: 2px solid var(--ink); object-fit: cover; background: var(--sand);
  display: block; margin-bottom: .7rem;
}
.cover-preview[hidden] { display: none; }

/* ---------- stats ----------------------------------------- */
.statgrid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin-bottom: 1.1rem; }
.statbox { border: 2px solid var(--ink); border-radius: 12px; padding: .85rem 1rem; background: #fff; }
.statbox b { display: block; font-family: var(--font-display); font-size: 1.8rem; line-height: 1.05; }
.statbox span { font-size: .82rem; color: var(--ink-soft); }

.chart { display: flex; align-items: flex-end; gap: 2px; height: 150px; margin-top: .5rem; }
.chart__bar { flex: 1; background: var(--violet); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart__bar:hover { background: var(--violet-deep); }
.chart__axis {
  display: flex; justify-content: space-between; font-family: var(--font-mono);
  font-size: .7rem; color: var(--ink-faint); margin-top: .4rem;
}

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
table.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
table.data td.num { font-family: var(--font-mono); text-align: right; }
.table-scroll { overflow-x: auto; }

/* ---------- alerts ---------------------------------------- */
.alert { border: 2px solid var(--ink); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; font-size: .92rem; }
.alert--success { background: #dff5ec; }
.alert--error   { background: #ffe9ea; }
.alert--info    { background: #fff4d6; }
.alert ul { margin: .3rem 0 0; padding-left: 1.1rem; }

/* ---------- empty state ----------------------------------- */
.empty {
  border: 2px dashed var(--ink); border-radius: 14px; padding: 2.2rem 1.4rem;
  text-align: center; background: var(--sand);
}
.empty p { color: var(--ink-soft); margin: .3rem 0 1.1rem; }

/* ---------- footer ---------------------------------------- */
.foot { border-top: 2px solid var(--ink); margin-top: 2.5rem; padding: 1.5rem 0; font-size: .88rem; }
.foot__row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--ink-soft); }
.foot a { color: var(--ink); }

/* ---------- page cards (pages.php) ------------------------- */
.pagegrid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 1.3rem; }
.pagecard {
  background: #fff; border: 2px solid var(--ink); border-radius: 14px;
  padding: 1.1rem; display: flex; flex-direction: column; gap: .7rem;
}
.pagecard__head { display: flex; align-items: center; gap: .7rem; }
.pagecard__name { font-weight: 700; font-family: var(--font-display); font-size: 1.05rem; word-break: break-word; }
.pagecard__handle { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-soft); word-break: break-all; }
.pagecard__actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: auto; }
.pagecard--new {
  border-style: dashed; align-items: center; justify-content: center;
  text-align: center; color: var(--ink-soft); min-height: 168px; gap: .5rem;
}

/* ---------- wizard progress -------------------------------- */
.wizard-steps { display: flex; gap: .4rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.wizard-steps__step {
  flex: 1 1 90px; text-align: center; font-size: .76rem; font-weight: 700;
  padding: .5rem .4rem; border: 2px solid var(--ink); border-radius: 10px;
  background: #fff; color: var(--ink-soft);
}
.wizard-steps__step.is-current { background: var(--sun); color: var(--ink); }
.wizard-steps__step.is-done { background: var(--mint); color: var(--ink); }

/* ---------- publish success + share (wizard.php step 5) ---- */
.publish-success {
  text-align: center; padding: 1.8rem 1.3rem;
  background: linear-gradient(180deg, #eafbf3 0%, #fff 65%);
  border: 2px solid var(--ink); border-radius: 14px;
}
.publish-success__icon {
  width: 56px; height: 56px; margin: 0 auto .7rem;
  border-radius: 50%; background: #fff; border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; box-shadow: var(--shadow-hard);
}
.publish-success .handle { margin: 1rem 0 1.3rem; }

.share-row { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin: 0 0 1.3rem; }
.share-btn {
  width: 48px; height: 48px; border-radius: 50%;
  border: 2px solid var(--ink); background: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform .1s ease, box-shadow .1s ease;
}
.share-btn svg { width: 20px; height: 20px; }
.share-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); text-decoration: none; }
.share-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.share-btn--whatsapp { color: #1fa855; }
.share-btn--facebook { color: #1877f2; }
.share-btn--x        { color: var(--ink); }
.share-btn--email    { color: var(--violet); }

/* ---------- printable business card (card.php) ------------- */
.bizcard-stage {
  display: flex; justify-content: center;
  padding: 1.6rem; margin-bottom: 1.3rem;
  background: var(--sand); border: 2px solid var(--ink); border-radius: 14px;
  overflow: auto;
}
.bizcard-print {
  width: 3.5in; height: 2in; flex: none;
  display: flex; align-items: stretch; justify-content: space-between; gap: .18in;
  background: #fff; border: 2px solid var(--ink); border-radius: 10px;
  padding: .26in; box-shadow: var(--shadow-hard);
  font-family: var(--font-body); color: var(--ink);
}
.bizcard-print__info {
  display: flex; flex-direction: column; justify-content: center; gap: .09in;
  min-width: 0;
}
.bizcard-print__logo {
  width: .48in; height: .48in; border-radius: 8px; object-fit: cover;
  border: 2px solid var(--ink); background: var(--sun);
  display: grid; place-items: center; font-family: var(--font-display);
  font-weight: 800; font-size: 11px; flex: none; margin-bottom: .04in;
}
.bizcard-print__name { font-family: var(--font-display); font-weight: 800; font-size: 14px; line-height: 1.15; word-break: break-word; }
.bizcard-print__tagline { font-size: 8.5px; color: var(--ink-soft); line-height: 1.3; word-break: break-word; }
.bizcard-print__contact {
  display: flex; flex-direction: column; gap: 1px;
  font-size: 8px; font-family: var(--font-mono); color: var(--ink-soft); word-break: break-all;
}
.bizcard-print__qr {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05in;
}
.bizcard-print__qr img { width: 1in; height: 1in; }
.bizcard-print__qr span { font-size: 6.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; text-align: center; }

/* Print only the card, at its true size, on its own tiny page.
   Everything else on the page collapses to nothing (display:none,
   not just hidden) so it doesn't leave a stack of blank pages behind
   it — scoped to this page alone via the body class from card.php. */
@media print {
  body.print-card .wrap > h1,
  body.print-card .wrap > p,
  body.print-card .wrap > button,
  body.print-card header,
  body.print-card .foot {
    display: none;
  }
  body.print-card { margin: 0; }
  body.print-card .page { padding: 0; }
  body.print-card .wrap { padding: 0; max-width: none; }
  body.print-card .bizcard-stage {
    padding: 0; margin: 0; border: 0; background: none; overflow: visible; justify-content: flex-start;
  }
  body.print-card .bizcard-print { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
  @page { size: 3.5in 2in; margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
