/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:     #F6821F;
  --orange-dim: #c86a10;
  --blue:       #2563EB;
  --blue-dim:   #1d4ed8;
  --green:      #16a34a;
  --green-dim:  #15803d;
  --purple:     #7c3aed;
  --purple-dim: #6d28d9;

  --bg:         #0b0d11;
  --bg-card:    #13161d;
  --bg-card-2:  #1a1e28;
  --border:     #252a36;
  --text:       #e2e8f0;
  --text-muted: #64748b;
  --text-dim:   #94a3b8;

  --radius:     12px;
  --radius-sm:  8px;
  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --mono:       'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }
.hidden    { display: none !important; }
.sr-only   { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 17, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--bg-card-2);
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  background: rgba(246, 130, 31, 0.1);
  border: 1px solid rgba(246, 130, 31, 0.25);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.orange { color: var(--orange); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--text-dim);
  max-width: 560px;
  margin: 0 auto 1.75rem;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.pill {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid;
}

.pill-orange { color: var(--orange);  border-color: rgba(246,130,31,0.35);  background: rgba(246,130,31,0.08); }
.pill-blue   { color: #60a5fa;        border-color: rgba(96,165,250,0.35);  background: rgba(96,165,250,0.08); }
.pill-green  { color: #4ade80;        border-color: rgba(74,222,128,0.35);  background: rgba(74,222,128,0.08); }
.pill-purple { color: #c084fc;        border-color: rgba(192,132,252,0.35); background: rgba(192,132,252,0.08); }

/* ── Demo cards ──────────────────────────────────────────────────────────── */
.demos {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-bottom: 3rem;
}

.demo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  scroll-margin-top: 72px;
}

.demo-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.demo-header > div:nth-child(2) { flex: 1; }

.demo-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.demo-sub {
  font-size: 0.875rem;
  color: var(--text-dim);
}

.demo-sub strong { color: var(--text); font-weight: 500; }

.demo-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.demo-icon--orange { background: rgba(246,130,31,0.15); color: var(--orange); }
.demo-icon--blue   { background: rgba(37,99,235,0.15);  color: #60a5fa; }
.demo-icon--green  { background: rgba(22,163,74,0.15);  color: #4ade80; }
.demo-icon--purple { background: rgba(124,58,237,0.15); color: #c084fc; }

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge--orange { color: var(--orange); border-color: rgba(246,130,31,0.4); background: rgba(246,130,31,0.1); }
.badge--blue   { color: #60a5fa;       border-color: rgba(96,165,250,0.4);  background: rgba(96,165,250,0.1); }
.badge--green  { color: #4ade80;       border-color: rgba(74,222,128,0.4);  background: rgba(74,222,128,0.1); }
.badge--purple { color: #c084fc;       border-color: rgba(192,132,252,0.4); background: rgba(192,132,252,0.1); }

.demo-code {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.code-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.demo-code code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bg-card-2);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

/* ── Loading states ──────────────────────────────────────────────────────── */
.loading-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.loading-shimmer {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--bg-card-2) 25%, var(--border) 50%, var(--bg-card-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-inline {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 1rem 0;
}

/* ── Geo grid ────────────────────────────────────────────────────────────── */
.geo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.geo-item {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.geo-item__label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.geo-item__value {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text);
  font-family: var(--mono);
  word-break: break-all;
}

.geo-item--highlight .geo-item__value {
  color: var(--orange);
  font-size: 1.1rem;
}

/* ── Counter ─────────────────────────────────────────────────────────────── */
.counter-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.counter-number {
  font-size: 4rem;
  font-weight: 700;
  font-family: var(--mono);
  color: #4ade80;
  line-height: 1;
  letter-spacing: -0.03em;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.counter-number.bump {
  transform: scale(1.08);
}

.counter-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ── Guestbook ───────────────────────────────────────────────────────────── */
.gb-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.gb-form-row {
  display: flex;
  gap: 0.5rem;
}

input[type="text"],
textarea {
  width: 100%;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.65rem 0.9rem;
  outline: none;
  transition: border-color 0.15s;
  resize: vertical;
}

input[type="text"]:focus,
textarea:focus {
  border-color: var(--blue);
}

textarea { min-height: 80px; }

.btn {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:hover   { opacity: 0.88; }
.btn:active  { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary { background: var(--blue); color: #fff; }

.gb-status {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}

.gb-status--ok  { background: rgba(74,222,128,0.1); color: #4ade80; }
.gb-status--err { background: rgba(239,68,68,0.1);  color: #f87171; }

.gb-messages {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.gb-msg {
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  animation: fadeIn 0.3s ease;
}

.gb-msg__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.gb-msg__name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #60a5fa;
}

.gb-msg__flag { font-size: 1rem; }

.gb-msg__meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}

.gb-msg__text {
  font-size: 0.875rem;
  color: var(--text-dim);
  word-break: break-word;
}

.gb-empty {
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-card-2);
  border-radius: var(--radius-sm);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── R2 Gallery ──────────────────────────────────────────────────────────── */
.r2-dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  margin-bottom: 1rem;
}

.r2-dropzone:hover,
.r2-dropzone.drag-over {
  border-color: #7c3aed;
  background: rgba(124, 58, 237, 0.05);
}

.r2-dropzone svg { color: var(--text-muted); margin-bottom: 0.5rem; }

.r2-dropzone p {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.r2-browse {
  color: #c084fc;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.r2-hint { font-size: 0.8rem; color: var(--text-muted) !important; }

.r2-upload-status {
  font-size: 0.875rem;
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.r2-upload-status--uploading { background: rgba(124,58,237,0.1); color: #c084fc; }
.r2-upload-status--ok        { background: rgba(74,222,128,0.1);  color: #4ade80; }
.r2-upload-status--err       { background: rgba(239,68,68,0.1);   color: #f87171; }

.r2-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}

.r2-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  position: relative;
  animation: fadeIn 0.3s ease;
}

.r2-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.r2-thumb:hover img { transform: scale(1.05); }

.r2-thumb__meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  padding: 0.5rem 0.4rem 0.3rem;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.7);
  opacity: 0;
  transition: opacity 0.2s;
}

.r2-thumb:hover .r2-thumb__meta { opacity: 1; }

.r2-empty {
  grid-column: 1/-1;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 1.5rem;
  background: var(--bg-card-2);
  border-radius: var(--radius-sm);
}

/* ── Free tier limits ────────────────────────────────────────────────────── */
.limits-section {
  border-top: 1px solid var(--border);
  padding: 2.5rem 0;
  scroll-margin-top: 72px;
}

.limits-section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.limits-sub {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.limit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.limit-icon {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
  margin-bottom: 0.75rem;
}

.limit-icon--orange { color: var(--orange); border-color: rgba(246,130,31,0.4); background: rgba(246,130,31,0.1); }
.limit-icon--blue   { color: #60a5fa;       border-color: rgba(96,165,250,0.4);  background: rgba(96,165,250,0.1); }
.limit-icon--green  { color: #4ade80;       border-color: rgba(74,222,128,0.4);  background: rgba(74,222,128,0.1); }
.limit-icon--purple { color: #c084fc;       border-color: rgba(192,132,252,0.4); background: rgba(192,132,252,0.1); }

.limit-card ul {
  list-style: none;
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.limit-card li::before {
  content: '·';
  color: var(--text-muted);
  margin-right: 0.4rem;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-inner a {
  color: var(--text-dim);
  text-decoration: none;
}

.footer-inner a:hover { color: var(--text); }
.footer-domain { font-family: var(--mono); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .demo-header { flex-wrap: wrap; }
  .badge       { align-self: flex-start; }
  .site-nav    { gap: 0; }
  .site-nav a  { padding: 0.35rem 0.5rem; font-size: 0.8rem; }
  .hero        { padding: 2.5rem 0 2rem; }
}
