/* ——— Pagesmith portal — tokens lifted from pagesmith.co ——— */

:root {
  --bg: #050505;
  --surface: #0a0a0a;
  --fg: #F7F5F2;
  --fg-dim: #B8B8B8;
  --fg-faint: #6a6a6a;
  --line: #1a1a1a;
  --accent: #D9FF1F;
  --ok: #54d186;
  --bad: #e5533d;
  --display: 'Inter Tight', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: dark; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

::selection { background: var(--accent); color: #050505; }

a { color: inherit; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ——— Type ——— */

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

h1, .h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.035em;
  line-height: 1.05;
}

h2, .h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.it { font-style: italic; font-weight: 300; color: var(--fg-dim); }

.dim { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ——— Shell ——— */

#app { display: none; }
#app.ready { display: block; }

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 10px;
  margin: 0 -10px;
  text-decoration: none;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--fg-dim);
  border-left: 1px solid transparent;
  transition: color 0.15s ease;
}

.nav a .n {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--fg-faint);
}

.nav a:hover { color: var(--fg); }
.nav a.active { color: var(--fg); }
.nav a.active .n { color: var(--accent); }

.nav .badge-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  align-self: center;
  margin-left: auto;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.sidebar-foot .who { font-size: 13px; color: var(--fg-dim); letter-spacing: -0.01em; }

.linklike {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  text-align: left;
  padding: 0;
  transition: color 0.15s ease;
}
.linklike:hover { color: var(--fg); }

.main {
  flex: 1;
  min-width: 0;
  padding: 48px clamp(20px, 5vw, 72px) 96px;
  max-width: 1040px;
}

.view-head { margin-bottom: 44px; }
.view-head .eyebrow { margin-bottom: 14px; }
.view-head .sub { color: var(--fg-dim); font-size: 14px; margin-top: 12px; max-width: 52ch; }

/* ——— Sections & dividers ——— */

.section { border-top: 1px solid var(--line); padding: 28px 0 40px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

/* ——— Stat blocks ——— */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { background: var(--bg); padding: 24px 20px 26px 0; }
.stat + .stat { padding-left: 24px; }
.stat .num {
  font-family: var(--display);
  font-weight: 500;
  font-size: 40px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 14px 0 8px;
}
.stat .num small { font-size: 18px; color: var(--fg-dim); letter-spacing: 0; }
.stat .note { font-size: 12px; color: var(--fg-faint); }

/* ——— Rows (deploys, rankings, submissions) ——— */

.rows { border-top: 1px solid var(--line); }
.row {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .mono { color: var(--fg-faint); }

/* ——— Status ——— */

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; vertical-align: 1px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px rgba(84, 209, 134, 0.45); }
.dot.bad { background: var(--bad); box-shadow: 0 0 10px rgba(229, 83, 61, 0.45); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
}
.pill.accent { color: #050505; background: var(--accent); border-color: var(--accent); }

.state-ready { color: var(--ok); }
.state-error { color: var(--bad); }
.state-building { color: var(--accent); }

/* ——— Buttons ——— */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--fg);
  background: var(--bg);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { border-color: var(--fg-faint); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:hover { border-color: var(--line); }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #050505; }
.btn.primary:hover { background: #e7ff4a; border-color: #e7ff4a; }

.btn.danger { color: var(--bad); }

/* ——— Forms / inputs ——— */

.field { margin-bottom: 22px; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: 8px;
}

input[type="text"], input[type="email"], input[type="password"], input[type="url"], textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--fg);
  font-family: var(--body);
  font-size: 14px;
  padding: 11px 13px;
  transition: border-color 0.15s ease;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.55; }

input:focus, textarea:focus { outline: none; border-color: var(--fg-faint); }

input::placeholder, textarea::placeholder { color: var(--fg-faint); }

.error-msg { color: var(--bad); font-size: 13px; margin-top: 12px; }
.ok-msg { color: var(--ok); font-size: 13px; margin-top: 12px; }

/* ——— Login ——— */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login {
  width: 100%;
  max-width: 360px;
}
.login .brand { margin-bottom: 56px; }
.login h1 { margin-bottom: 8px; }
.login .sub { color: var(--fg-dim); font-size: 14px; margin-bottom: 36px; }
.login .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 6px; }
.login .alt { margin-top: 24px; }

/* ——— Editor ——— */

.editor-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 36px;
}
.editor-bar .status { flex: 1; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-faint); }
.editor-bar .status.dirty { color: var(--accent); }

.collection-item {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 20px;
  margin-bottom: 14px;
  background: var(--surface);
}
.collection-item .item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 18px;
}
.collection-item .item-head .mono { color: var(--fg-faint); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.collection-item .field:last-child { margin-bottom: 0; }

.img-field { display: flex; gap: 16px; align-items: flex-start; }
.img-field img {
  width: 96px; height: 96px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  flex-shrink: 0;
}
.img-field .img-meta { flex: 1; }
.img-field .path { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--fg-faint); word-break: break-all; margin-top: 8px; }
input[type="file"] { display: none; }

.deploy-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.deploy-progress .spinner {
  width: 10px; height: 10px;
  border: 1px solid var(--fg-faint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ——— Empty states ——— */

.empty {
  border: 1px dashed var(--line);
  border-radius: 2px;
  padding: 48px 24px;
  text-align: center;
}
.empty .h2 { margin-bottom: 8px; }
.empty p { color: var(--fg-dim); font-size: 14px; max-width: 40ch; margin: 0 auto; }

/* ——— Toast ——— */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--fg);
  color: #050505;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: calc(100vw - 48px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--bad); color: var(--fg); }

/* ——— Loading ——— */

.loading {
  padding: 64px 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.loading::after { content: ''; display: inline-block; width: 1ch; animation: dots 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ——— Page load reveal ——— */

.view > * { animation: rise 0.45s ease both; }
.view > *:nth-child(2) { animation-delay: 0.05s; }
.view > *:nth-child(3) { animation-delay: 0.1s; }
.view > *:nth-child(4) { animation-delay: 0.15s; }
.view > *:nth-child(5) { animation-delay: 0.2s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ——— Admin ——— */

.admin-wrap { max-width: 560px; margin: 0 auto; padding: 64px 24px 96px; }
.admin-wrap .brand { margin-bottom: 48px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.admin-grid .span2 { grid-column: span 2; }

/* ——— Responsive ——— */

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; gap: 4px; margin-left: auto; }
  .nav a { padding: 8px 10px; margin: 0; font-size: 13px; white-space: nowrap; }
  .nav a .n { display: none; }
  .sidebar-foot { margin: 0; padding: 0; border: 0; flex-direction: row; align-items: center; }
  .sidebar-foot .who { display: none; }
  .main { padding-top: 32px; }
  .stat .num { font-size: 30px; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-grid .span2 { grid-column: span 1; }
  .editor-bar { flex-wrap: wrap; }
}
