/* ============================================================================
   landing.css — public landing for the shortener template
   Dark, focused, demo-forward. No login form clutter — admins-only service.
============================================================================ */

:root {
  --bg: #0b1220;
  --bg-elev: #111a2e;
  --surface: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.08);
  --text: #e6edf7;
  --muted: #8a99b3;
  --accent: #22d3ee;
  --accent-2: #818cf8;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse 1200px 600px at 50% -100px, rgba(34, 211, 238, 0.12), transparent 60%),
    radial-gradient(ellipse 800px 500px at 80% 30%, rgba(129, 140, 248, 0.10), transparent 60%),
    var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

/* ---------- Nav ---------- */

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

.landing-brand {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.landing-brand::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.5rem;
  vertical-align: middle;
  box-shadow: 0 0 12px var(--accent);
}

.landing-nav nav {
  display: flex;
  gap: 1.5rem;
}

.landing-nav nav a {
  color: var(--muted);
  font-size: 0.9rem;
}

.landing-nav nav a:hover { color: var(--text); }

/* ---------- Hero ---------- */

.hero {
  max-width: 72rem;
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
    padding: 3rem 1.5rem;
    gap: 2.5rem;
  }
}

.hero-inner h1 {
  font-size: clamp(2.5rem, 5.5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

.accent {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  font-size: 1.125rem;
  color: var(--muted);
  line-height: 1.6;
  max-width: 32rem;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

/* {{login_button}} renders a .landing-login wrapper with its own button.
   We override it to fit the dark theme. */
.hero-cta .landing-login {
  margin-top: 0 !important;
  max-width: none !important;
  width: auto;
}

.hero-cta .landing-login button[type="submit"] {
  background: var(--accent) !important;
  color: var(--bg) !important;
  border: none !important;
  border-radius: var(--radius) !important;
  padding: 0.875rem 1.5rem !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  width: auto !important;
  backdrop-filter: none !important;
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.hero-cta .landing-login button[type="submit"]:hover {
  background: var(--accent) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(34, 211, 238, 0.45);
}

.hero-cta .landing-login button svg,
.hero-cta .landing-login button img {
  filter: none !important;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}

.ghost-btn:hover {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

.hero-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ---------- Demo card ---------- */

.hero-demo { display: flex; justify-content: center; }

.demo-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 24rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.demo-row {
  display: grid;
  grid-template-columns: 5rem 1.5rem 1fr;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.demo-row:last-child { border-bottom: none; }

.demo-key { color: var(--accent); font-weight: 500; }
.demo-arrow { color: var(--muted); text-align: center; }
.demo-target { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.demo-row--new .demo-key,
.demo-row--new .demo-target {
  color: var(--accent-2);
  opacity: 0.7;
}

.demo-row--new {
  position: relative;
}

.demo-row--new::after {
  content: "▍";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-2);
  animation: blink 1.2s infinite;
}

@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

/* ---------- Sections ---------- */

.features, .why, .contact {
  max-width: 72rem;
  margin: 0 auto;
  padding: 4rem 1.5rem;
}

.features h2, .why h2, .contact h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.feature-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.feature-grid h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-grid p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.feature-grid code {
  font-family: var(--mono);
  background: var(--bg-elev);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

.why p, .contact p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
  max-width: 44rem;
}

/* ---------- Footer overrides ---------- */

footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- Mobile ---------- */

@media (max-width: 720px) {
  .landing-nav {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .landing-nav nav { gap: 0.75rem; }
  .landing-nav nav a { font-size: 0.82rem; }

  .hero {
    padding: 2rem 1rem 2.5rem;
    gap: 2rem;
  }

  .hero-inner h1 { font-size: clamp(2rem, 8vw, 2.75rem); }
  .lede { font-size: 1rem; }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-cta .landing-login,
  .hero-cta .landing-login button[type="submit"],
  .ghost-btn {
    width: 100% !important;
    justify-content: center;
  }

  .demo-card {
    padding: 1rem;
    font-size: 0.78rem;
  }

  .demo-row {
    grid-template-columns: 4.5rem 1.25rem 1fr;
    padding: 0.5rem 0;
  }

  .features, .why, .contact {
    padding: 2.5rem 1rem;
  }

  .feature-grid { grid-template-columns: 1fr; }
}

/* iOS safe-area: respect notch on landscape phones */
@media (max-width: 720px) and (orientation: landscape) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* ============================================================================
   Admin console (logged-in home) + role visibility
   Rendered into {{content}} by Rails for signed-in admins on shortener domains.
   The marketing sections are .guest-only; the console is .admin-only.
============================================================================ */

.admin-only { display: none; }
[data-role="admin"] .admin-only { display: block; }
[data-role="admin"] .guest-only { display: none; }

.console {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 5rem;
}

/* ---------- Create form ---------- */

.short-form { display: flex; flex-direction: column; gap: 1.25rem; }
.short-field { display: flex; flex-direction: column; gap: 0.5rem; }

.short-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.short-input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.05rem;
  padding: 1rem 1.1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* The long-link field is the front door — make it prominent. */
.short-field:first-child .short-input {
  font-size: 1.3rem;
  padding: 1.15rem 1.2rem;
}

.short-input::placeholder { color: var(--muted); }

.short-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.short-input-group {
  display: flex;
  align-items: stretch;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.short-input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.short-input-prefix {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
  white-space: nowrap;
}

.short-input--key {
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--mono);
}

.short-input--key:focus { box-shadow: none; }

.short-actions { margin-top: 0.25rem; }

.short-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
}

.short-button--primary {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  color: #08111f;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 20px rgba(34, 211, 238, 0.3);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.short-button--primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 6px 28px rgba(34, 211, 238, 0.45);
}

.short-errors {
  list-style: none;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: #fda4af;
  font-size: 0.9rem;
}

/* ---------- Recent links ---------- */

.short-console-recent { margin-top: 3rem; }

.short-console-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 1rem;
}

.short-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }

.short-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "key actions"
    "target hits";
  align-items: center;
  column-gap: 1rem;
  row-gap: 0.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}

.short-list-key {
  grid-area: key;
  font-family: var(--mono);
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.short-list-host { color: var(--muted); }
.short-list-slug { color: var(--accent); }

.short-list-target {
  grid-area: target;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.short-list-hits {
  grid-area: hits;
  justify-self: end;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.short-list-hits::after {
  content: " clicks";
  color: var(--muted);
  font-weight: 400;
  font-size: 0.78rem;
}

.short-list-actions {
  grid-area: actions;
  justify-self: end;
  display: flex;
  gap: 0.25rem;
}

.short-list-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.short-list-action:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--bg-elev);
}

.short-list-action--danger:hover {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.4);
}

.short-list-action-label { display: none; } /* icon-only */

.short-pill--warn {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fcd34d;
  border: 1px solid rgba(252, 211, 77, 0.35);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  margin-left: 0.5rem;
}

.short-console-all { margin-top: 1.25rem; font-size: 0.9rem; }
.short-empty { color: var(--muted); margin-top: 2rem; }

@media (max-width: 720px) {
  .console { padding: 2.5rem 1rem 3.5rem; }
  .short-field:first-child .short-input { font-size: 1.1rem; }
}
