/* ============================================================
   SCRIBE JAM
   Dark editorial / technical writing aesthetic
============================================================ */

:root {
  --bg: #09070f;
  --bg-soft: #0d0a15;

  --panel: #110d1b;
  --panel-2: #151021;
  --panel-3: #1a1427;

  --line: rgba(190, 170, 255, 0.13);
  --line-strong: rgba(190, 170, 255, 0.25);

  --text: #f7f3ff;
  --muted: #a39bb4;
  --dim: #70677f;

  --purple: #9b6cff;
  --violet: #c18cff;
  --pink: #e38cff;

  --green: #72f2bd;
  --danger: #ff7b9e;
  --warning: #ffd27a;

  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --sans:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --radius: 20px;
  --max: 1160px;
}


/* ============================================================
   RESET
============================================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;

  background:
    radial-gradient(
      circle at 50% -10%,
      rgba(113, 65, 194, 0.18),
      transparent 34rem
    ),
    var(--bg);

  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
}

body::before {
  content: "";

  position: fixed;
  inset: 0;

  pointer-events: none;
  z-index: -1;

  opacity: 0.28;

  background-image:
    linear-gradient(
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.018) 1px,
      transparent 1px
    );

  background-size: 48px 48px;
}

::selection {
  background: rgba(155, 108, 255, 0.35);
  color: white;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}


/* ============================================================
   AMBIENT LIGHT
============================================================ */

.ambient {
  position: fixed;
  pointer-events: none;

  filter: blur(90px);
  border-radius: 999px;

  opacity: 0.15;
  z-index: -1;
}

.ambient-one {
  width: 280px;
  height: 280px;

  background: #7d42ff;

  top: 25%;
  left: -140px;
}

.ambient-two {
  width: 300px;
  height: 300px;

  background: #b83cff;

  right: -160px;
  top: 60%;
}


/* ============================================================
   LAYOUT
============================================================ */

.section-shell {
  width: min(
    calc(100% - 32px),
    var(--max)
  );

  margin-inline: auto;
}


/* ============================================================
   HEADER
============================================================ */

.site-header {
  width: min(
    calc(100% - 32px),
    var(--max)
  );

  height: 72px;

  margin: 0 auto;

  display: flex;
  align-items: center;
  justify-content: space-between;

  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;

  gap: 10px;

  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-mark {
  display: grid;
  place-items: center;

  width: 29px;
  height: 29px;

  border: 1px solid rgba(193, 140, 255, 0.5);

  color: var(--violet);

  box-shadow:
    0 0 25px rgba(155, 108, 255, 0.2);
}

.brand-dim,
.site-footer strong span {
  color: var(--muted);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav a {
  color: var(--muted);
  font-size: 13px;
}

.nav a:hover {
  color: white;
}

.admin-trigger {
  border: 0;
  background: transparent;

  color: #4a4255;

  font-family: var(--mono);
  font-size: 13px;

  padding: 8px;
}

.admin-trigger:hover {
  color: var(--violet);
}


/* ============================================================
   TYPOGRAPHY
============================================================ */

.eyebrow,
.hero-kicker,
.rule-num {
  color: var(--violet);

  font:
    500 11px/1
    var(--mono);

  letter-spacing: 0.13em;
}

.hero-kicker {
  display: flex;
  align-items: center;

  gap: 9px;

  margin-bottom: 25px;
}

.hero-kicker > span {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--green);

  box-shadow:
    0 0 14px var(--green);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 em,
h2 em {
  color: var(--violet);
  font-style: normal;

  text-shadow:
    0 0 30px rgba(193, 140, 255, 0.18);
}


/* ============================================================
   HERO
============================================================ */

.hero {
  padding: 88px 0 70px;
}

.hero h1 {
  margin-bottom: 25px;

  max-width: 920px;

  font-size: clamp(
    42px,
    10vw,
    78px
  );

  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 680px;

  color: var(--muted);

  font-size: clamp(
    16px,
    2vw,
    19px
  );
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;

  gap: 10px;

  margin-top: 30px;
}


/* ============================================================
   BUTTONS
============================================================ */

.button {
  min-height: 48px;

  padding: 0 18px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  gap: 10px;

  border-radius: 12px;

  font-size: 14px;
  font-weight: 700;

  border: 1px solid transparent;

  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background:
    linear-gradient(
      135deg,
      #7d5cff,
      #a66cff
    );

  color: white;

  box-shadow:
    0 10px 35px rgba(125, 92, 255, 0.2);
}

.button-primary:hover {
  box-shadow:
    0 12px 42px rgba(125, 92, 255, 0.35);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.025);

  border-color: var(--line);

  color: var(--text);
}

.button-ghost:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
}


/* ============================================================
   COUNTDOWN
============================================================ */

.countdown-card {
  margin-top: 55px;

  padding: 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 24px;

  border: 1px solid var(--line);

  border-radius: var(--radius);

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.035),
      rgba(255,255,255,0.012)
    );

  box-shadow:
    inset 0 1px rgba(255,255,255,0.035);
}

.deadline-info {
  min-width: 0;
}

.deadline-info strong {
  display: block;

  margin-top: 8px;

  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;

  color: var(--text);
}

.countdown {
  display: flex;
  align-items: center;

  gap: 10px;

  font-family: var(--mono);
}

.countdown > div {
  text-align: center;
}

.countdown b {
  display: block;

  min-width: 42px;

  color: var(--text);

  font-size: 22px;
  line-height: 1;
}

.countdown span {
  display: block;

  margin-top: 7px;

  color: var(--dim);

  font-size: 8px;
  letter-spacing: 0.08em;
}

.countdown i {
  color: var(--dim);
  font-style: normal;
}


/* ============================================================
   SECTION HEADINGS
============================================================ */

.section-heading {
  display: grid;

  grid-template-columns:
    minmax(0, 1.1fr)
    minmax(260px, 0.9fr);

  gap: 50px;

  align-items: end;

  margin-bottom: 35px;
}

.section-heading.compact {
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 13px 0 0;

  font-size: clamp(
    32px,
    7vw,
    54px
  );

  line-height: 1;
  letter-spacing: -0.045em;
}

.section-heading > p {
  margin: 0;

  color: var(--muted);

  font-size: 15px;
}


/* ============================================================
   RULES
============================================================ */

.rules {
  padding: 70px 0;
}

.rule-grid {
  display: grid;

  grid-template-columns: repeat(3, 1fr);

  gap: 12px;
}

.rule-card {
  padding: 24px;

  min-height: 210px;

  border: 1px solid var(--line);

  border-radius: var(--radius);

  background: rgba(255,255,255,0.018);

  transition:
    border-color 0.2s ease,
    transform 0.2s ease;
}

.rule-card:hover {
  transform: translateY(-2px);

  border-color: var(--line-strong);
}

.rule-num {
  display: block;

  margin-bottom: 35px;
}

.rule-card h3 {
  margin-bottom: 9px;

  font-size: 18px;
}

.rule-card p {
  margin: 0;

  color: var(--muted);

  font-size: 14px;
}


/* ============================================================
   SUBMISSION
============================================================ */

.submit-section {
  padding: 75px 0;
}

.submission-form {
  padding: 24px;

  border: 1px solid var(--line);

  border-radius: var(--radius);

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.035),
      rgba(255,255,255,0.012)
    );
}

.form-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 20px;
}

.form-grid label,
.admin-panel label {
  display: block;
}

.form-grid label.full {
  grid-column: 1 / -1;
}

.form-grid label > span,
.admin-panel label > span {
  display: block;

  margin-bottom: 8px;

  color: var(--muted);

  font:
    500 11px/1
    var(--mono);

  letter-spacing: 0.04em;
}

input,
textarea {
  width: 100%;

  border: 1px solid var(--line);

  border-radius: 11px;

  outline: none;

  background: rgba(0,0,0,0.22);

  color: var(--text);

  padding: 13px 14px;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

input {
  min-height: 48px;
}

textarea {
  resize: vertical;
  min-height: 110px;
}

input::placeholder,
textarea::placeholder {
  color: #5f586b;
}

input:focus,
textarea:focus {
  border-color: rgba(155,108,255,0.7);

  background: rgba(0,0,0,0.3);

  box-shadow:
    0 0 0 3px rgba(155,108,255,0.08);
}

.form-grid small {
  display: block;

  margin-top: 6px;

  color: var(--dim);

  text-align: right;

  font-family: var(--mono);
  font-size: 10px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;

  gap: 20px;

  margin-top: 25px;
}

.form-note {
  max-width: 580px;

  margin: 0;

  color: var(--dim);

  font-size: 12px;
}

.submit-button {
  flex: 0 0 auto;
}

.form-message {
  display: none;

  margin-top: 18px;

  padding: 12px 14px;

  border-radius: 10px;

  font-size: 13px;
}

.form-message.show {
  display: block;
}

.form-message.success {
  background: rgba(114,242,189,0.08);

  border: 1px solid rgba(114,242,189,0.2);

  color: var(--green);
}

.form-message.error {
  background: rgba(255,123,158,0.08);

  border: 1px solid rgba(255,123,158,0.2);

  color: #ffb0c3;
}


/* ============================================================
   LEADERBOARD
============================================================ */

.leaderboard {
  padding: 75px 0 100px;
}

.leaderboard-heading {
  align-items: center;
}

.leaderboard-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;

  gap: 12px;
}

.leaderboard-meta > span {
  color: var(--dim);

  font:
    500 11px/1
    var(--mono);
}

.refresh-button {
  min-height: 38px;

  padding: 0 12px;

  border: 1px solid var(--line);

  border-radius: 9px;

  background: transparent;

  color: var(--muted);

  font:
    500 11px/1
    var(--mono);
}

.refresh-button:hover {
  color: white;
  border-color: var(--line-strong);
}

.leaderboard-list {
  display: grid;
  gap: 12px;
}


/* ============================================================
   SUBMISSION CARD
============================================================ */

.submission-card {
  position: relative;

  padding: 23px;

  border: 1px solid var(--line);

  border-radius: var(--radius);

  background:
    linear-gradient(
      135deg,
      rgba(255,255,255,0.028),
      rgba(255,255,255,0.01)
    );

  overflow: hidden;
}

.submission-card::before {
  content: "";

  position: absolute;

  top: 0;
  left: 0;
  right: 0;

  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(193,140,255,0.5),
      transparent
    );

  opacity: 0;
}

.submission-card.champion {
  border-color: rgba(193,140,255,0.34);

  box-shadow:
    0 0 45px rgba(125,92,255,0.08);
}

.submission-card.champion::before {
  opacity: 1;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;

  gap: 18px;
}

.project-heading {
  min-width: 0;
}

.project-name {
  margin: 0;

  display: flex;
  align-items: center;

  gap: 8px;

  font-size: 21px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.crown {
  filter:
    drop-shadow(
      0 0 8px rgba(255,210,122,0.45)
    );
}

.card-meta {
  margin-top: 7px;

  color: var(--muted);

  font:
    500 11px/1.5
    var(--mono);
}

.card-meta .dot {
  color: var(--dim);

  padding: 0 5px;
}

.card-description {
  max-width: 800px;

  margin: 19px 0 20px;

  color: #c0b9cb;

  font-size: 14px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;

  align-items: center;

  gap: 8px;
}

.card-button {
  min-height: 38px;

  padding: 0 12px;

  border-radius: 9px;

  border: 1px solid var(--line);

  background: rgba(255,255,255,0.025);

  color: var(--muted);

  font-size: 12px;
  font-weight: 600;
}

.card-button:hover {
  color: white;

  border-color: var(--line-strong);

  background: rgba(255,255,255,0.05);
}

.like-button {
  color: #d8d1e2;
}

.like-button.liked {
  border-color: rgba(227,140,255,0.35);

  color: var(--pink);

  background: rgba(227,140,255,0.07);
}

.card-button.github {
  font-family: var(--mono);
}

.card-actions .likes {
  margin-left: auto;

  color: var(--dim);

  font:
    500 11px/1
    var(--mono);
}

.admin-controls {
  display: none;

  margin-top: 15px;
  padding-top: 15px;

  border-top: 1px dashed var(--line);

  align-items: center;
  justify-content: space-between;

  gap: 10px;
}

body.admin-mode .admin-controls {
  display: flex;
}

.crown-button {
  border: 1px solid rgba(193,140,255,0.2);

  border-radius: 9px;

  background: rgba(155,108,255,0.07);

  color: var(--violet);

  padding: 8px 10px;

  font:
    500 11px/1
    var(--mono);
}

.crown-button:hover {
  background: rgba(155,108,255,0.13);

  border-color: rgba(193,140,255,0.45);
}

.crown-button.active {
  color: var(--warning);

  border-color: rgba(255,210,122,0.35);
}


/* ============================================================
   LOADING
============================================================ */

.loading-state {
  min-height: 220px;

  display: flex;
  align-items: center;
  justify-content: center;

  flex-direction: column;

  color: var(--dim);

  text-align: center;
}

.loading-state p {
  margin: 15px 0 0;

  font:
    500 12px/1
    var(--mono);
}

.loader {
  width: 22px;
  height: 22px;

  border: 2px solid rgba(193,140,255,0.18);

  border-top-color: var(--violet);

  border-radius: 50%;

  animation:
    spin 0.8s linear infinite;
}

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


/* ============================================================
   EMPTY
============================================================ */

.empty-state {
  padding: 60px 20px;

  border: 1px dashed var(--line);

  border-radius: var(--radius);

  text-align: center;
}

.empty-glyph {
  margin-bottom: 14px;

  color: var(--violet);

  font-size: 35px;
}

.empty-state h3 {
  margin-bottom: 7px;

  font-size: 20px;
}

.empty-state p {
  margin-bottom: 20px;

  color: var(--muted);

  font-size: 14px;
}


/* ============================================================
   FOOTER
============================================================ */

.site-footer {
  padding: 30px 0 50px;

  display: flex;
  align-items: flex-end;
  justify-content: space-between;

  gap: 30px;

  border-top: 1px solid var(--line);
}

.site-footer strong {
  font-size: 15px;
}

.site-footer p {
  margin: 7px 0 0;

  color: var(--dim);

  font-size: 11px;
}

.mono {
  color: var(--dim);

  font:
    500 10px/1
    var(--mono);

  letter-spacing: 0.04em;
}


/* ============================================================
   TOAST
============================================================ */

.toast {
  position: fixed;

  left: 50%;
  bottom: 20px;

  z-index: 100;

  width: min(
    calc(100% - 32px),
    420px
  );

  padding: 13px 15px;

  border: 1px solid var(--line);

  border-radius: 12px;

  background: #171120;

  color: var(--text);

  box-shadow:
    0 20px 60px rgba(0,0,0,0.45);

  font-size: 13px;

  opacity: 0;
  pointer-events: none;

  transform:
    translate(-50%, 15px);

  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  opacity: 1;

  transform:
    translate(-50%, 0);
}

.toast[data-type="success"] {
  border-color: rgba(114,242,189,0.3);
}

.toast[data-type="error"] {
  border-color: rgba(255,123,158,0.3);
}


/* ============================================================
   ADMIN DIALOG
============================================================ */

.admin-dialog {
  width: min(
    calc(100% - 32px),
    430px
  );

  padding: 0;

  border: 1px solid var(--line);

  border-radius: 20px;

  background: #100c18;

  color: var(--text);

  box-shadow:
    0 30px 100px rgba(0,0,0,0.65);
}

.admin-dialog::backdrop {
  background: rgba(4,2,8,0.78);

  backdrop-filter: blur(8px);
}

.admin-panel {
  position: relative;

  padding: 27px;
}

.admin-panel h2 {
  margin: 12px 0 7px;

  font-size: 25px;

  letter-spacing: -0.03em;
}

.admin-panel > p {
  color: var(--muted);

  font-size: 13px;
}

.admin-panel label {
  margin-top: 17px;
}

.admin-panel .button {
  width: 100%;

  margin-top: 14px;
}

.dialog-close {
  position: absolute;

  top: 16px;
  right: 16px;

  width: 32px;
  height: 32px;

  border: 1px solid var(--line);

  border-radius: 8px;

  background: transparent;

  color: var(--muted);

  font-size: 20px;
  line-height: 1;
}

.dialog-close:hover {
  color: white;
}

.admin-status {
  min-height: 20px;

  margin-top: 15px !important;

  color: var(--violet) !important;

  font-family: var(--mono);
  font-size: 11px !important;
}


/* ============================================================
   RESPONSIVE
============================================================ */

@media (max-width: 760px) {

  .site-header {
    height: 64px;
  }

  .nav {
    gap: 11px;
  }

  .nav a {
    font-size: 11px;
  }

  .hero {
    padding: 62px 0 50px;
  }

  .hero h1 {
    font-size: clamp(40px, 13vw, 64px);
  }

  .hero-copy {
    font-size: 15px;
  }

  .countdown-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .countdown {
    width: 100%;

    justify-content: space-between;
  }

  .section-heading {
    grid-template-columns: 1fr;

    gap: 15px;
  }

  .section-heading h2 {
    font-size: 38px;
  }

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

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

  .form-grid label.full {
    grid-column: auto;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .submit-button {
    width: 100%;
  }

  .leaderboard-meta {
    justify-content: flex-start;
  }

  .card-top {
    flex-direction: column;
  }

  .card-actions .likes {
    margin-left: 0;

    width: 100%;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}


@media (max-width: 430px) {

  .section-shell,
  .site-header {
    width: min(
      calc(100% - 24px),
      var(--max)
    );
  }

  .hero h1 {
    font-size: 40px;
  }

  .countdown-card {
    padding: 17px;
  }

  .countdown {
    gap: 4px;
  }

  .countdown b {
    min-width: 34px;

    font-size: 18px;
  }

  .countdown i {
    font-size: 12px;
  }

  .submission-form {
    padding: 17px;
  }

  .submission-card {
    padding: 18px;
  }

  .project-name {
    font-size: 19px;
  }
}


/* ============================================================
   REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}