/* ==========================================================================
   page-lite.css - layout for the pages outside the app shell (2026)
   Entry screens (login, register, verified, 404, billing-return) and public
   screens (share, folder-share). Components come from sns.css; this file only
   holds the page frames and the few widgets unique to these pages. If a rule
   here looks like a button, input, badge or card, it belongs in sns.css.
   Tokens only: every colour, size, radius, shadow and spacing value is a
   var() from public/css/sns.css.
   ========================================================================== */

/* --- 1. Page frame: slim brand header, main column, quiet footer ---------- */

.pl-frame {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.pl-header {
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  padding: 0 var(--s-6);
  background: var(--sns-surface);
  border-bottom: 1px solid var(--sns-line);
}

.pl-brand {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--sns-ink);
  font-size: var(--fs-base);
  font-weight: 600;
  text-decoration: none;
}

.pl-brand:hover {
  text-decoration: none;
}

.pl-header-end {
  margin-left: auto;
}

.pl-main {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: var(--s-12) var(--s-4);
}

/* Entry screens centre the card in the remaining height. */
.pl-main--center {
  align-items: center;
}

.pl-col {
  width: 100%;
  max-width: 440px;
}

/* Public screens use a wider reading column. */
.pl-col--wide {
  max-width: 920px;
}

.pl-col--grid {
  max-width: 1040px;
}

.pl-foot {
  flex: none;
  padding: var(--s-4) var(--s-6);
  background: var(--sns-surface);
  border-top: 1px solid var(--sns-line);
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
  text-align: center;
}

.pl-foot a {
  color: inherit;
  text-decoration: none;
}

.pl-foot a:hover {
  text-decoration: underline;
}

/* --- 2. Entry card --------------------------------------------------------- */

.pl-card {
  display: flex;
  flex-direction: column;
}

.pl-card-head {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-6);
}

.pl-foot-line {
  margin-top: var(--s-5);
  text-align: center;
}

.pl-card--center {
  text-align: center;
}

.pl-card--center .sns-icon-circle,
.pl-card--center .sns-icon-circle--soft,
.pl-card--center .sns-icon-circle--danger {
  margin-inline: auto;
  margin-bottom: var(--s-4);
}

.pl-card--center .sns-btn {
  align-self: center;
  margin-top: var(--s-2);
}

.pl-card--center .sns-type-lead {
  margin-bottom: var(--s-6);
}

/* The carried-destination line on register. */
.pl-carry {
  word-break: break-all;
}

/* --- 3. Stacks and grids shared by the public screens ---------------------- */

.pl-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

/* Card titles that are not wrapped in .sns-card-header keep the same air. */
.sns-card > .sns-type-h3 {
  margin-bottom: var(--s-5);
}

.pl-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
}

/* --- 4. Payment status spinner (billing-return) ----------------------------- */

.spin {
  width: var(--s-5);
  height: var(--s-5);
  flex: none;
  border: 2px solid var(--sns-line);
  border-top-color: var(--sns-brand);
  border-radius: var(--r-full);
  animation: pl-spin 1s linear infinite;
}

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

/* Poll outcome colours: status colour for state only (spec 1.1). */
#title.ok { color: var(--sns-success); }
#title.pending { color: var(--sns-warn); }

/* Payment card rhythm. */
#title { margin-bottom: var(--s-2); }
#sub { margin-bottom: var(--s-5); }
#statusRow { margin-bottom: var(--s-2); }
#meta { margin-bottom: var(--s-6); }

/* --- 5. Share page chart and bar lists (drawn by share.js) -------------------
   Same token treatment as the Insights chart, scoped to this page. */

#sh-chart {
  height: 240px;
}

#sh-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

#sh-chart .ax { stroke: var(--sns-line-strong); stroke-width: 1; }
#sh-chart .ln { fill: none; stroke: var(--sns-brand); stroke-width: 2; }
#sh-chart .ar { fill: var(--sns-brand-tint); }
#sh-chart .dot { fill: var(--sns-brand); }
#sh-chart .lbl {
  fill: var(--sns-ink-4);
  font-size: var(--fs-xs);
  font-family: var(--sns-font);
}

#sh-countries,
#sh-devices {
  list-style: none;
  margin: 0;
  padding: 0;
}

#sh-countries .row,
#sh-devices .row {
  display: block;
  padding: var(--s-2) 0;
  font-size: var(--fs-sm);
}

#sh-countries .top,
#sh-devices .top {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

#sh-countries .name,
#sh-devices .name {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--sns-ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sh-countries .val,
#sh-devices .val {
  flex: 0 0 auto;
  min-width: var(--s-10);
  text-align: right;
  color: var(--sns-ink-3);
  font-variant-numeric: tabular-nums;
}

#sh-countries .flag,
#sh-devices .flag {
  flex: 0 0 auto;
  font-size: var(--fs-base);
  line-height: 1;
}

#sh-countries .bar,
#sh-devices .bar {
  display: block;
  height: 4px;
  margin-top: var(--s-2);
  background: var(--sns-brand);
  border-radius: var(--r-full);
}

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

  .pl-stats .sns-stat-row {
    flex-direction: column;
  }

  .pl-stats .sns-stat {
    border-left: none;
    padding-left: 0;
    padding-top: var(--s-4);
    padding-bottom: var(--s-4);
    border-top: 1px solid var(--sns-line);
  }

  .pl-stats .sns-stat:first-child {
    border-top: none;
    padding-top: 0;
  }
}

/* --- 6. Shared project card grid (folder-share.js injects these names) ------ */

#fname {
  margin-bottom: var(--s-2);
}

#fcount {
  margin-bottom: var(--s-6);
}

#content .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-4);
}

#content .card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--sns-surface);
  border: 1px solid var(--sns-line);
  border-radius: var(--r-lg);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--dur-1) var(--ease);
}

#content .card:hover {
  border-color: var(--sns-line-strong);
  text-decoration: none;
}

#content .cover {
  aspect-ratio: 3 / 4;
  background: var(--sns-surface-2) center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
}

#content .meta {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-3) var(--s-4);
}

#content .ttl {
  color: var(--sns-ink-2);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#content .small {
  color: var(--sns-ink-4);
  font-size: var(--fs-sm);
}

/* Password-protected badge: state colour (spec 1.1). */
#content .lock {
  display: inline-flex;
  color: var(--sns-warn);
}

#content .lock .sns-icon {
  width: var(--s-4);
  height: var(--s-4);
}

#content .empty,
#content .err {
  padding: var(--s-12) var(--s-6);
  text-align: center;
  color: var(--sns-ink-4);
}

#content .err {
  color: var(--sns-danger);
}

@media (max-width: 600px) {
  #content .grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* --- Guard: an element with the hidden attribute is hidden -------------------
   Last so it wins over any single-class display rule above. */

[hidden] {
  display: none;
}