@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --bg: #191919;
  --fg: #f0f0f0;
  --accent: #cfff04;
  --line: #3a3a3a;
  --outline: #555;
  --muted: #8a8a8a;
  --red: #ff5c5c;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Space Grotesk", system-ui, sans-serif;
}

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

main { max-width: 980px; margin: auto; padding: 0 5vw 10vh; }

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  padding: 6vh 0 4vh;
}

h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(1.7rem, 6.5vw, 4.5rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.1;
}

header > a { padding-bottom: .5rem; color: var(--muted); white-space: nowrap; transition: color .15s; }
header > a:hover, header > a:focus-visible { color: var(--accent); outline: none; }

/* Buttons */
button {
  padding: .6rem 1.1rem;
  border: 1px solid var(--line);
  background: none;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}

button:hover, button:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
button.primary { border-color: var(--accent); color: var(--accent); }
button.primary:hover, button.primary:focus-visible { background: var(--accent); color: #000; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }

/* Landing cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-bottom: 4vh;
}

.card { display: block; border: 1px solid var(--line); transition: border-color .2s, transform .25s; }
.card img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.card span {
  display: block;
  padding: 1rem 1.2rem;
  border-top: 1px solid var(--line);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
  transition: color .15s;
}

.card:hover, .card:focus-visible { border-color: var(--accent); transform: translateY(-3px); outline: none; }
.card:hover span, .card:focus-visible span { color: var(--accent); }

/* Maintenance */
.block { padding: 3vh 0; border-top: 1px solid var(--line); }
.maintenance-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.maintenance-row b {
  display: block;
  font-size: clamp(1.5rem, 4.5vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.1;
  transition: color .2s;
}

.hint { color: var(--muted); font-size: .95rem; }

.switch { position: relative; flex: none; width: 64px; height: 34px; padding: 0; border-radius: 17px; }

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--outline);
  transition: left .15s, background .15s;
}

#maint.on b { color: var(--accent); }
#maint.on .switch { border-color: var(--accent); }
#maint.on .switch::after { left: 34px; background: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 1.8rem; padding-top: 2vh; margin-bottom: 1.2rem; border-top: 1px solid var(--line); }

.tabs a {
  padding: .2rem 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: clamp(1.3rem, 3.5vw, 2rem);
  letter-spacing: -.02em;
  transition: color .15s;
}

.tabs a:hover, .tabs a:focus-visible { color: var(--accent); outline: none; }
.tabs a.active { border-bottom-color: var(--accent); color: var(--fg); }

/* File browser */
.crumbs { flex: 1; min-width: 100%; font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 600; word-break: break-all; }
.crumbs a { color: var(--accent); cursor: pointer; }
.crumbs a:last-child { color: var(--fg); }
.crumbs i { margin: 0 .35rem; color: var(--muted); font-style: normal; font-weight: 400; }

.row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--line); }

.row .name {
  flex: 1;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 500;
  word-break: break-all;
  cursor: pointer;
  transition: color .15s, transform .25s;
}

.row .name:hover { color: var(--accent); font-style: oblique 14deg; transform: translateX(.1em); }
.row .size { color: var(--muted); font-size: .85rem; white-space: nowrap; }

.row .icon {
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  background: none;
  color: var(--fg);
  font-weight: 600;
  transition: border-color .2s, color .2s;
}

.row a.icon:hover { border-color: var(--accent); color: var(--accent); }
.row button.danger:hover { border-color: var(--red); color: var(--red); }
.empty { padding: 1.2rem 0; color: var(--muted); }
#browser.dragging { outline: 1px dashed var(--accent); outline-offset: 8px; }

/* Editor */
#editor-text {
  width: 100%;
  height: 65vh;
  padding: 1rem;
  border: 1px solid var(--line);
  background: #111;
  color: var(--fg);
  font: 14px/1.55 var(--mono);
  tab-size: 2;
  resize: vertical;
}

#editor-text:focus { border-color: var(--accent); outline: none; }

/* Terminal */
#terminal { display: block; width: 100%; height: 70vh; min-height: 320px; border: 1px solid var(--line); background: var(--bg); }

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  padding: .7rem 1.2rem;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  opacity: 0;
  transform: translate(-50%, 1.5rem);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--red); color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}


/* Shared Mozilla icon system */
.ui-icon {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
  vertical-align: -0.16em;
}

.with-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
}

header > a {
  display: inline-flex;
  align-items: center;
  gap: .45em;
}

.card .card-label {
  display: flex;
  align-items: center;
  gap: .65em;
}

.card .card-label .ui-icon {
  width: 36px;
  height: 36px;
}

.row .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  min-height: 2.6rem;
}

.row .icon .ui-icon {
  width: 24px;
  height: 24px;
}


/* Shared public-site components */
main {
  padding-top: 5rem;
}

.site-back {
  position: absolute;
  top: 2rem;
  left: 2rem;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1.2rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  transition: color .2s, border-color .2s;
}

.site-back:hover,
.site-back:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.site-footer {
  border: 0;
  margin: 0;
  background: none;
  padding: 0 5vw 6vh;
  text-align: center;
  color: var(--muted);
  font-family: inherit;
  font-size: clamp(.85rem, 1.1vw, 1.3rem);
}

.site-footer p {
  max-width: 60em;
  margin: 0 auto;
  text-wrap: pretty;
}

.site-footer .footer-links {
  margin-top: 1.2rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: .7rem;
}

.site-footer a {
  color: inherit;
  transition: color .15s;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
}

@media (max-width: 480px) {
  .site-back {
    top: 1rem;
    left: 1rem;
  }

  main {
    padding-top: 5rem;
  }
}


/* Simple admin navigation buttons */
.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 4vh;
}

.admin-action {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  min-width: 180px;
  padding: 1.1rem 1.4rem;
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 1.25rem;
  font-weight: 600;
  transition: border-color .2s, color .2s;
}

.admin-action .ui-icon {
  width: 30px;
  height: 30px;
}

.admin-action:hover,
.admin-action:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}


/* Dashboard navigation: larger, clearer buttons */
.admin-actions {
  gap: 1.2rem;
  margin: 1rem 0 5vh;
}

.admin-action {
  min-width: 240px;
  min-height: 100px;
  padding: 1.5rem 2rem;
  gap: 1.1rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.admin-action .ui-icon {
  width: 42px;
  height: 42px;
}

/* Admin section tabs */
.tabs {
  gap: .65rem;
  padding: .7rem;
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #111;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem 1.25rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  transition: color .2s, background .2s, border-color .2s;
}

.tabs a:hover,
.tabs a:focus-visible {
  color: var(--accent);
  background: #222;
  border-color: var(--line);
  outline: none;
}

.tabs a.active {
  color: #111;
  background: var(--accent);
  border-color: var(--accent);
}

@media (max-width: 480px) {
  .admin-action {
    flex: 1 1 100%;
    min-width: 0;
  }

  .tabs a {
    flex: 1;
    padding-inline: .7rem;
  }
}
