/* BerryCraft portal – design system.
   Class names used by index.js / admin.js / common.js stay stable:
   dot on/off, stat good/warn/bad, history i up/part/down, tabs .active, hidden, toast err, list .empty/.name … */

/* ── Fonts (self-hosted, SIL Open Font License) ───────────────────────── */
@font-face { font-family: "Bricolage Grotesque"; src: url("/static/fonts/bricolage-grotesque.woff2") format("woff2");
             font-weight: 400 800; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 400 600; font-display: swap; }

/* ── Tokens ───────────────────────────────────────────────────────────── */
:root {
  --bg: #0d0911;
  --bg-2: #130d19;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-solid: #1a1222;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f5eff8;
  --text-2: #b9abc6;
  --text-3: #7f7090;
  --berry: #f0306b;
  --berry-2: #ff7a9c;
  --berry-deep: #b3164a;
  --pcb: #3ddc6a;
  --amber: #ffc94d;
  --red: #ff5a6a;

  --font-display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-full: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --gutter: clamp(16px, 4vw, 32px);

  --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 20px 50px -24px rgba(0, 0, 0, .7);
  --glow-berry: 0 10px 30px -10px rgba(240, 48, 107, .55);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-snap: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  font: 15px/1.6 var(--font-body);
  font-feature-settings: "cv11", "ss01";
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
/* atmosphere: two soft glows + a faint pixel grid, fixed behind everything */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(60vmax 45vmax at 92% -8%, rgba(240, 48, 107, .22), transparent 60%),
    radial-gradient(55vmax 40vmax at -10% 105%, rgba(61, 220, 106, .12), transparent 60%),
    linear-gradient(var(--bg), var(--bg-2));
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 70%);
}
a { color: var(--berry-2); text-underline-offset: 3px; }
::selection { background: rgba(240, 48, 107, .4); }
img.pixel { image-rendering: pixelated; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -.02em; line-height: 1.1; text-wrap: balance; }
h2 { font: 600 12px/1.2 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
code, .mono { font-family: var(--mono); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.hidden { display: none !important; }
.mt { margin-top: var(--s5); }
.mt-s { margin-top: var(--s3); }
:focus-visible { outline: 2px solid var(--berry); outline-offset: 3px; border-radius: 6px; }

/* ── Navigation (frosted, sticky) ─────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s3);
  margin: 0 calc(-1 * var(--gutter)); padding: var(--s3) var(--gutter);
  background: rgba(13, 9, 17, .62);
  backdrop-filter: blur(16px) saturate(160%); -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.top .logo { width: 40px; height: 40px; flex: none; }
.brand { font: 800 21px/1 var(--font-display); letter-spacing: -.03em; white-space: nowrap; }
.brand span { color: var(--berry); }
.brand .faint { color: var(--text-3); font-weight: 600; }
.top .spacer { flex: 1; }
.top .actions { display: flex; gap: var(--s2); align-items: center; }

/* ── Hero (public page) ───────────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: 1.25fr .9fr; gap: var(--s7); align-items: center;
  padding: clamp(40px, 8vw, 96px) 0 clamp(36px, 6vw, 72px);
}
.eyebrow { display: inline-flex; align-items: center; gap: var(--s2); font: 600 12px/1 var(--font-body);
           letter-spacing: .14em; text-transform: uppercase; color: var(--pcb); margin-bottom: var(--s4); }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
.hero h1 { font-size: clamp(40px, 7vw, 76px); font-weight: 800; letter-spacing: -.045em; line-height: 1.0; }
.hero h1 span { color: var(--berry); background: linear-gradient(120deg, var(--berry), var(--berry-2));
                -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { font-size: clamp(16px, 1.6vw, 18px); color: var(--text-2); max-width: 34em; margin: var(--s5) 0 0; }
.hero .art { width: 100%; max-width: 360px; justify-self: center;
             filter: drop-shadow(0 30px 50px rgba(240, 48, 107, .28)); animation: float 6s var(--ease-in-out, ease-in-out) infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }

.address { display: flex; align-items: stretch; gap: var(--s2); margin-top: var(--s6); flex-wrap: wrap; }
.address code {
  display: flex; align-items: center; font-size: 17px; padding: 12px 18px; border-radius: var(--r-full);
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line-2); letter-spacing: -.01em;
}

/* ── Layout grid + cards ──────────────────────────────────────────────── */
.grid { display: grid; gap: var(--s4); grid-template-columns: repeat(12, minmax(0, 1fr)); padding-bottom: var(--s7); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.card {
  position: relative; min-width: 0;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow);
  transition: border-color .3s var(--ease-out), transform .4s var(--ease-out);
}
.card:hover { border-color: var(--line-2); }
.card > header { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.card > header .spacer { flex: 1; }

/* ── Pills + status dots ──────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: var(--s2); padding: 6px 12px; border-radius: var(--r-full);
        background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.on { background: var(--pcb); box-shadow: 0 0 0 0 rgba(61, 220, 106, .6); animation: ping 2.4s var(--ease-out) infinite; }
.dot.off { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 90, 106, .18); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(61, 220, 106, .55); } 80%, 100% { box-shadow: 0 0 0 8px rgba(61, 220, 106, 0); } }
.services { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ── Stats ────────────────────────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: var(--s3); }
.stat { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; min-width: 0; }
.stat .label { font: 600 11px/1.3 var(--font-body); color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; }
.stat .value { font: 700 30px/1.15 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums;
               margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat .value small { font: 600 14px var(--font-body); color: var(--text-3); letter-spacing: 0; }
.stat .value.sm { font-size: 20px; }
.stat.good .value { color: var(--pcb); } .stat.warn .value { color: var(--amber); } .stat.bad .value { color: var(--red); }

/* ── Availability bar ─────────────────────────────────────────────────── */
.history { display: flex; gap: 3px; height: 38px; margin-top: var(--s3); }
.history i { flex: 1; min-width: 2px; border-radius: 4px; background: rgba(255, 255, 255, .07);
             transition: transform .25s var(--ease-snap), filter .25s; transform-origin: bottom; }
.history i:hover { transform: scaleY(1.12); filter: brightness(1.25); }
.history i.up { background: linear-gradient(180deg, #5ef58b, var(--pcb)); }
.history i.part { background: var(--amber); } .history i.down { background: var(--red); }
.history-legend { display: flex; justify-content: space-between; gap: var(--s2); font-size: 12px; color: var(--text-3); margin-top: var(--s2); }

/* ── Buttons + inputs ─────────────────────────────────────────────────── */
button, .btn {
  font: 600 14px/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 18px; border-radius: var(--r-full);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  transition: transform .2s var(--ease-snap), border-color .2s, background .2s, box-shadow .2s;
}
button:hover, .btn:hover { border-color: rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .09); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0) scale(.97); }
button.primary { background: linear-gradient(180deg, var(--berry), var(--berry-deep)); border-color: transparent; color: #fff; box-shadow: var(--glow-berry); }
button.primary:hover { background: linear-gradient(180deg, #ff4b80, var(--berry)); box-shadow: 0 14px 34px -10px rgba(240, 48, 107, .7); }
button.danger:hover { border-color: var(--red); color: var(--red); background: rgba(255, 90, 106, .08); }
button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; transform: none; }
input[type=text], input[type=password] {
  font: 15px var(--font-body); color: var(--text); min-width: 0; min-height: 44px;
  background: rgba(0, 0, 0, .35); border: 1px solid var(--line-2); border-radius: var(--r-full); padding: 0 18px;
  transition: border-color .2s, box-shadow .2s;
}
input::placeholder { color: var(--text-3); }
input:focus { outline: none; border-color: var(--berry); box-shadow: 0 0 0 4px rgba(240, 48, 107, .18); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.row input { flex: 1 1 160px; }

/* ── Tabs (segmented) ─────────────────────────────────────────────────── */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-full);
        background: rgba(0, 0, 0, .35); border: 1px solid var(--line); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { min-height: 30px; padding: 0 12px; border: 0; background: transparent; color: var(--text-3); font-size: 13px; }
.tabs button:hover { transform: none; background: rgba(255, 255, 255, .05); color: var(--text); }
.tabs button.active { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 4px 12px rgba(0, 0, 0, .35); }

/* the admins & bans card is narrow on every screen: name on its own line, both buttons below */
#op-form input { flex-basis: 100%; }
#op-form button { flex: 1; }

/* ── Lists ────────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list li { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 6px 8px 6px 10px;
           border-radius: var(--r-md); background: rgba(0, 0, 0, .2); border: 1px solid transparent; transition: border-color .2s, background .2s; }
.list li:hover { border-color: var(--line); background: rgba(255, 255, 255, .03); }
.list li .name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li img { width: 28px; height: 28px; border-radius: 7px; image-rendering: pixelated; background: rgba(255, 255, 255, .06); flex: none; }
.list .empty { color: var(--text-3); background: transparent; border: 1px dashed var(--line); justify-content: center; }
.scroll { max-height: 300px; overflow: auto; }

/* ── Chart ────────────────────────────────────────────────────────────── */
.chart { width: 100%; height: 220px; display: block; }
.chart .grid-line { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font: 11px var(--mono); }
.chart .area { opacity: .16; }
.chart .line { fill: none; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }

/* ── Console + logs ───────────────────────────────────────────────────── */
.log { font: 12.5px/1.55 var(--mono); background: rgba(0, 0, 0, .45); border: 1px solid var(--line);
       border-radius: var(--r-md); padding: 12px 14px; max-height: 260px; min-height: 64px; overflow: auto; white-space: pre-wrap;
       word-break: break-word; margin: 0; color: var(--text-2); }
.log .cmd { color: var(--berry-2); } .log .err { color: var(--red); }

/* ── Steps (public) ───────────────────────────────────────────────────── */
.steps { counter-reset: s; display: grid; gap: var(--s4); }
.steps div { display: flex; gap: var(--s3); align-items: flex-start; color: var(--text-2); }
.steps div b { color: var(--text); font-weight: 600; }
.steps div::before { counter-increment: s; content: counter(s); flex: none; width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center; font: 700 14px var(--font-display);
  background: linear-gradient(180deg, var(--berry), var(--berry-deep)); color: #fff; box-shadow: var(--glow-berry); }
.steps code { font-size: 13px; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, .35); color: var(--text); }

/* ── Login ────────────────────────────────────────────────────────────── */
.login { max-width: 400px; margin: clamp(48px, 14vh, 140px) auto; text-align: center; padding: var(--s6); }
.login .logo { width: 96px; height: 96px; filter: drop-shadow(0 18px 30px rgba(240, 48, 107, .3)); }
.login h1.brand { font-size: 26px; margin-top: var(--s3); }
.login form { display: grid; gap: var(--s3); margin-top: var(--s5); }
.login button { min-height: 46px; }
.error { color: var(--red); min-height: 1.4em; font-size: 14px; }

/* ── Toast ────────────────────────────────────────────────────────────── */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(440px, calc(100vw - 32px));
         padding: 14px 18px; border-radius: var(--r-md); background: rgba(26, 18, 34, .92);
         backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
         border: 1px solid var(--line-2); box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
         white-space: pre-wrap; font-size: 14px; animation: toast-in .35s var(--ease-out); }
.toast.err { border-color: rgba(255, 90, 106, .6); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

footer.foot { display: flex; gap: var(--s4); flex-wrap: wrap; align-items: center;
              padding: var(--s5) 0 var(--s7); color: var(--text-3); font-size: 13px; border-top: 1px solid var(--line); }
footer.foot .spacer { flex: 1; }

/* ── Motion: entry + scroll reveal ────────────────────────────────────── */
.enter { animation: enter-up .9s var(--ease-out) both; }
.d1 { animation-delay: 80ms; } .d2 { animation-delay: 160ms; } .d3 { animation-delay: 240ms; } .d4 { animation-delay: 320ms; }
@keyframes enter-up { from { opacity: 0; transform: translateY(18px); } }
.reveal-ready [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); }
.reveal-ready [data-reveal].is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal-ready [data-reveal] { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .grid > * { grid-column: span 12 !important; }
}
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; gap: var(--s4); padding: var(--s5) 0 var(--s6); }
  .hero .art { order: -1; max-width: 132px; justify-self: start; margin-bottom: calc(-1 * var(--s2)); }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .top { gap: var(--s2); padding-top: 10px; padding-bottom: 10px; }
  .top .logo { width: 34px; height: 34px; }
  .brand { font-size: 18px; }
  .brand .faint { display: none; }
  .top .actions .btn { display: none; }          /* "Public page" link lives in the footer on phones */
  .top button { min-height: 34px; padding: 0 12px; font-size: 13px; }
  .pill { padding: 5px 10px; font-size: 12px; }
  .card { padding: var(--s4); border-radius: var(--r-md); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 24px; }
  .address { flex-direction: column; }
  .address code, .address button { width: 100%; justify-content: center; }
  .card > header .tabs { width: 100%; }
  .card > header .tabs button { flex: 1; }
  .chart { height: 180px; }
  .history { height: 30px; gap: 2px; }
  .toast { left: 16px; right: 16px; bottom: 16px; }
}

/* long status text in the sticky bar must never push the buttons off a phone screen */
.top .actions { min-width: 0; }
.top .pill { min-width: 0; max-width: 46vw; }
.top .pill span:last-child { overflow: hidden; text-overflow: ellipsis; }
