/* ==========================================================================
   NWHS SMP — site styles
   Colors live in the variables below: one set for light mode, one for dark.
   Dark/light follows the device setting until someone clicks the toggle
   (js/theme.js saves their choice).
   ========================================================================== */

:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef1f0;
  --text: #121614;
  --muted: #5d6763;
  --border: #dde3e0;
  --accent: #0e9f6e;          /* emerald */
  --accent-hover: #0b8a5f;
  --accent-soft: #e3f5ed;
  --accent-text: #ffffff;
  --danger: #d14343;
  --danger-soft: #fdecec;
  --warning: #b7791f;
  --warning-soft: #fdf3e1;
  --success: #0e9f6e;
  --success-soft: #e3f5ed;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 8px 24px rgba(16, 24, 20, .06);
  --radius: 14px;
  --radius-sm: 9px;
  color-scheme: light;
}

/* Dark colors: used when the device prefers dark (and nobody picked light), or when dark is picked. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1110;
    --surface: #151b19;
    --surface-2: #1c2421;
    --text: #e7ecea;
    --muted: #97a39e;
    --border: #28322e;
    --accent: #34c48d;
    --accent-hover: #4fd5a1;
    --accent-soft: #143328;
    --accent-text: #06140e;
    --danger: #f06b6b;
    --danger-soft: #3a1a1a;
    --warning: #e0a84a;
    --warning-soft: #372a14;
    --success: #34c48d;
    --success-soft: #143328;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1110;
  --surface: #151b19;
  --surface-2: #1c2421;
  --text: #e7ecea;
  --muted: #97a39e;
  --border: #28322e;
  --accent: #34c48d;
  --accent-hover: #4fd5a1;
  --accent-soft: #143328;
  --accent-text: #06140e;
  --danger: #f06b6b;
  --danger-soft: #3a1a1a;
  --warning: #e0a84a;
  --warning-soft: #372a14;
  --success: #34c48d;
  --success-soft: #143328;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
@font-face {
  font-family: 'Minecraft';
  src: url('../font/Minecraft.otf') format('opentype');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'Minecraft';
  src: url('../font/Minecraft-Bold.otf') format('opentype');
  font-display: swap;
  font-weight: bold;
  font-style: normal;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Minecraft', sans-serif;
  font-size: 16px; /* Base 16px matches nicely with font raster scaling */
  line-height: 1.55;
  image-rendering: pixelated; /* Forces structural fonts to load crisply */
  transition: background-color .2s ease, color .2s ease;
}
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); }
.hidden, [hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 720px; }
main { flex: 1; padding: 32px 0 48px; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
@media (min-width: 720px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .container { display: flex; align-items: center; gap: 12px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.1rem; margin-right: auto; }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav button.link {
  color: var(--muted); font-weight: 600; font-size: .95rem; padding: 8px 12px; border-radius: 999px;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button.link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  display: inline-grid; place-items: center; transition: background-color .2s, transform .15s;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle:active { transform: scale(.94); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: none; }
}

.site-footer { border-top: 1px solid var(--border); padding: 20px 0; color: var(--muted); font-size: .875rem; }
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.icon-bubble {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 12px;
}
.icon-bubble svg { width: 22px; height: 22px; }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
textarea { resize: vertical; min-height: 120px; }
.field + .field { margin-top: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .95rem; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, transform .1s, opacity .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- Messages / badges ---------- */
.alert { border-radius: var(--radius-sm); padding: 12px 14px; font-weight: 600; font-size: .95rem; border: 1px solid transparent; }
.alert:empty { display: none; }
.alert.info { background: var(--surface-2); color: var(--muted); }
.alert.success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert.error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert.warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge.neutral { background: var(--surface-2); color: var(--muted); }
.badge.good { background: var(--success-soft); color: var(--success); }

/* ---------- Home page ---------- */
.hero { text-align: center; padding: 40px 0 24px; }
/* Logo size + margins that shrink with it (at full size: -100px top, -60px bottom, same as before) */
.hero-logo { --logo: min(60vw, 500px); width: var(--logo); height: auto; margin-top: calc(var(--logo) * -0.2); margin-bottom: calc(var(--logo) * -0.12); }
.hero h1 { margin-top: 12px; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin: 0 auto 24px; }
.hero .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
/* Picture row at the bottom of the home page. The two Steves stand on the footer line
   (the -48px cancels the page's bottom padding); the jaguar in the middle is a link. */
.mascots {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  max-width: 1200px; margin: 40px auto -48px; padding: 0 16px;
}
.mascot { display: block; height: auto; }
.mascot-left  { width: min(24vw, 260px); }
.mascot-right { width: min(30vw, 340px); }
.school-link { align-self: center; display: block; border-radius: 16px; }
.school-link img { display: block; width: min(18vw, 190px); height: auto; transition: transform .2s ease; }
.school-link:hover img { transform: scale(1.06) rotate(-2deg); }
/* The black jaguar is hard to see on the dark background, so give it a soft light glow there. */
:root[data-theme="dark"] .school-link img { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 10px rgba(255,255,255,.25)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .school-link img { filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 10px rgba(255,255,255,.25)); }
}
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; min-height: 32px; }
.steps li + li { margin-top: 14px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font-weight: 800; display: grid; place-items: center; font-size: .9rem;
}

/* ---------- Login ---------- */
.auth-wrap { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo { width: 200px; height: 200px; display: block; margin: 0 auto 8px; }
.auth-card h1 { font-size: 1.6rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 20px; }

/* ---------- Dashboard ---------- */
.welcome h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); margin-bottom: 4px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mc-current { margin-top: 12px; }

/* ---------- FAQ ---------- */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 18px; box-shadow: var(--shadow); }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 0; font-weight: 700; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 0 16px; color: var(--muted); }

/* ---------- Appeals page ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 0; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.panel {
  margin-top: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.panel h3 { margin-top: 0; }
.ban-id { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .8rem; color: var(--muted); word-break: break-all; }
.badge.s-banned   { background: var(--danger-soft);  color: var(--danger); }
.badge.s-pending  { background: var(--warning-soft); color: var(--warning); }
.badge.s-denied   { background: var(--surface-2);    color: var(--muted); }
.badge.s-accepted { background: var(--success-soft); color: var(--success); }
.history { list-style: none; padding: 0; margin: 12px 0; }
.history li { border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); }
.history li + li { margin-top: 10px; }
.history li.accepted { border-left-color: var(--success); }
.history li.denied { border-left-color: var(--muted); }
.history li.pending { border-left-color: var(--warning); }
.history .text { white-space: pre-wrap; margin: 6px 0; }
.history .reply { margin-top: 8px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); white-space: pre-wrap; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.thumbs img { width: 110px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.thumb { position: relative; }
.thumb .remove {
  position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--danger); color: #fff; cursor: pointer; line-height: 18px; padding: 0; font-size: 15px;
}
form.appeal { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
form.appeal button[type="submit"] {
  align-self: flex-start; font: inherit; font-weight: 700; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 0; background: var(--accent); color: var(--accent-text); cursor: pointer;
}
form.appeal button[type="submit"]:hover:not(:disabled) { background: var(--accent-hover); }
form.appeal button[type="submit"]:disabled { opacity: .55; cursor: default; }
form.appeal input[type="file"] { font-size: .9rem; color: var(--muted); }
.msg { min-height: 1.2em; margin: 0; }
.msg.error { color: var(--danger); font-weight: 600; }
.msg.ok { color: var(--success); font-weight: 600; }

/* ---------- 404 ---------- */
.center-page { text-align: center; padding: 48px 0; }
.center-page .big { font-size: clamp(4rem, 14vw, 7rem); font-weight: 900; color: var(--accent); line-height: 1; margin-bottom: 8px; }

/* Phones: logo + theme switch on the first row, links on a second row you can swipe */
@media (max-width: 700px) {
  .site-header .container { gap: 6px 10px; }
  .theme-toggle { order: 2; }
  .nav { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 560px) {
  main { padding-top: 20px; }
  .card, .panel { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Ban indicator ---------- */
.nav-count {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800; line-height: 1;
  vertical-align: 1px; box-shadow: 0 0 0 2px var(--surface);
}
.ban-alert {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 16px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger);
  text-decoration: none; transition: transform .15s, box-shadow .15s;
}
.ban-alert:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 6px 18px rgba(209, 67, 67, .18); }
.ban-count {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 1.15rem;
}
.ban-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ban-text strong { font-size: 1.02rem; }
.ban-text span { color: var(--text); opacity: .8; font-size: .9rem; }
.ban-go { flex: none; font-weight: 700; white-space: nowrap; }

/* ---------- Discord card (dashboard) ---------- */
.discord-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.discord-logo { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #5865f2; color: #fff; }
.discord-text { flex: 1; min-width: 200px; }
.discord-text h2 { margin: 0 0 2px; }
.discord-text p { margin: 0; }
.discord-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Server address (dashboard, after saving a Minecraft account) ---------- */
.server-address { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--border); }
.server-label { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 0 0 4px; }
.server-label + .server-row { margin-bottom: 8px; }
.server-row:last-child { margin-bottom: 0; }
.server-row { display: flex; align-items: center; gap: 8px; }
.server-row code { flex: 1; font-size: 1.05rem; font-weight: 700; color: var(--text); background: none; padding: 0; user-select: all; }
.btn-sm { padding: 5px 12px; font-size: .85rem; }
.server-steps { margin: 0 0 8px; color: var(--text); font-size: .95rem; }

/* Education Edition join steps (dashboard) */
.edu-steps { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 14px; }
.edu-steps li { color: var(--text); font-size: .95rem; }
.edu-steps li::marker { font-weight: 800; color: var(--accent); }
.edu-steps img { display: block; width: 100%; max-width: 360px; height: auto; margin-top: 6px; border-radius: 10px; border: 1px solid var(--border); image-rendering: pixelated; }
.server-row code { overflow-wrap: anywhere; word-break: break-all; }

/* Login page: verify without logging in */
.verify-alt { margin-top: 18px; padding: 12px 14px; border-radius: var(--radius-sm, 10px); background: var(--surface-2); border: 1px solid var(--border);
              display: flex; flex-direction: column; gap: 4px; font-size: .9rem; text-align: center; }
.verify-alt span { color: var(--muted); }

/* Account login / register */
.auth-switch { text-align: center; margin: 16px 0 0; font-size: .95rem; }
.hint-warn { margin: 6px 0 0; font-size: .85rem; color: var(--danger); }
.proof-preview { display: block; max-width: 100%; max-height: 220px; margin-top: 10px; border-radius: 10px; border: 1px solid var(--border); }
#form-msg { white-space: pre-line; }
#form-msg.alert.info { white-space: pre-line; }
