:root {
  /* Hack Club design system tokens (https://design.hackclub.com). They switch for light and dark by themselves. */
  --bg: var(--hc-background);
  --card: var(--hc-surface);
  --text: var(--hc-foreground);
  --muted: var(--hc-muted);
  --line: var(--hc-border);
  --accent: var(--hc-red);
  --accent-soft: color-mix(in srgb, var(--hc-red) 14%, transparent);
  --radius: var(--hc-radius-card);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--hc-font-sans);
  line-height: 1.5;
}
a { color: inherit; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.loading { text-align: center; color: var(--muted); padding: 80px 20px; }

/* hero */
.hero { padding: 56px 0 28px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.1; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero h1 span { color: var(--accent); }
.hero p { margin: 0 0 20px; color: var(--muted); font-size: 1.1rem; max-width: 620px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  text-decoration: none; border: 1.5px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); }
.count { color: var(--muted); font-size: .95rem; margin-left: 6px; }

.hero-logo { width: 140px; height: auto; border-radius: 18px; display: block; margin-bottom: 18px; }

/* sticky bar */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.bar .wrap { display: flex; gap: 14px; align-items: center; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.search {
  flex: 1 1 200px; min-width: 160px; padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit;
}
.search:focus, .chip:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 7px 13px;
  border-radius: 999px; font: inherit; font-size: .9rem; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.jump { display: flex; gap: 14px; flex-wrap: wrap; width: 100%; font-size: .9rem; }
.jump a { color: var(--muted); text-decoration: none; }
.jump a:hover { color: var(--accent); }

/* sections */
.section { padding: 40px 0 8px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.section h2 { margin: 0; font-size: 1.7rem; letter-spacing: -0.01em; }
.section .desc { margin: 0 0 18px; color: var(--muted); }
.mode {
  font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-weight: 600;
}
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0, 0, 0, .1); }
.thumb { aspect-ratio: 2 / 1; width: 100%; object-fit: cover; background: var(--line); display: block; }
.thumb.placeholder { object-fit: contain; background: #f2f1ee; padding: 6px 0; }
.empty-logo { width: 110px; height: auto; border-radius: 14px; display: block; margin: 0 auto 12px; opacity: .9; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 1.1rem; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { color: var(--accent); }
.card p { margin: 0; color: var(--muted); font-size: .92rem; flex: 1; }
.author { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); text-decoration: none; }
.author img { width: 22px; height: 22px; border-radius: 50%; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: .8rem; color: var(--muted); }
.badge { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); }
.links { display: flex; gap: 14px; font-size: .9rem; font-weight: 600; padding-top: 4px; }
.links a { color: var(--accent); text-decoration: none; }
.links a:hover { text-decoration: underline; }
.empty {
  border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted);
}
code, .topic {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--accent-soft); color: var(--accent);
  padding: 1px 7px; border-radius: 6px; font-size: .88em;
}

/* meeting info */
.meet { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 8px 0 24px; }
.meet h2 { margin: 0 0 2px; font-size: 1.2rem; }
.meet p { margin: 0; color: var(--muted); }
.meet-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* how to submit */
.howto { padding: 48px 0 20px; }
.howto h2 { margin: 0 0 6px; font-size: 1.7rem; }
.steps { color: var(--muted); padding-left: 20px; margin: 10px 0 20px; max-width: 640px; }
.steps li { margin-bottom: 6px; }
.topics { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.topic-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.topic-card strong { display: block; margin-bottom: 4px; }
.topic-card small { display: block; color: var(--muted); margin-top: 8px; }
footer { color: var(--muted); font-size: .85rem; padding: 40px 0 50px; text-align: center; }
@media (prefers-reduced-motion: reduce) { .card, html { transition: none; scroll-behavior: auto; } }

/* 3D model viewer cards */
.viewer { position: relative; aspect-ratio: 2 / 1; width: 100%; background: radial-gradient(circle at 50% 40%, var(--card), var(--line)); cursor: grab; touch-action: pan-y; }
.viewer:active { cursor: grabbing; }
.viewer canvas { width: 100%; height: 100%; display: block; }
.viewer-hint, .viewer-tip { position: absolute; font-size: .75rem; color: var(--muted); }
.viewer-hint { inset: 0; display: grid; place-items: center; }
.viewer.ready .viewer-hint { display: none; }
.viewer-tip { right: 10px; bottom: 8px; opacity: .8; pointer-events: none; }
.badge.wip { background: transparent; border: 1px solid var(--accent); }
.author:not(a) { color: var(--muted); font-size: .85rem; }

/* InnoBits */
.innobits { padding: 8px 0 28px; }
.badge.bit { background: #ffd23f; color: #5a4300; }
.bits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.bits li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.bits a, .bits-who { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; flex: 1; min-width: 0; }
.bits img { width: 36px; height: 36px; border-radius: 50%; }
.bits li:first-child { border-color: #ffd23f; }
.bits-rank { color: var(--muted); font-weight: 700; width: 1.6em; text-align: center; }
.bits li:first-child .bits-rank { color: #b58500; }
.bits-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bits-count { font-weight: 700; color: #b58500; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .badge.bit { background: #4a3a00; color: #ffd23f; } .bits-count { color: #ffd23f; } }
.badge.pend { background: var(--line); color: var(--muted); }
.bits-count.none { color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 6px; margin: 18px 0 4px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 18px; font-weight: 600; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.jump a.on { color: var(--accent); font-weight: 600; }
.bits-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.bits-pending { font-size: .75rem; padding: 2px 9px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: #1f9d63; color: #fff; }

/* Design system touches */
h1, h2, h3 { letter-spacing: var(--hc-tracking-display); line-height: 1.1; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); }
.btn, .chip, .search { border-radius: var(--hc-radius-pill); }
.btn { transition: transform var(--hc-duration-fast) var(--hc-ease-playful), box-shadow var(--hc-duration-fast); }
.btn:hover { transform: translateY(-2px) rotate(-1deg); box-shadow: var(--hc-shadow-card); }
.card { box-shadow: var(--hc-shadow-card); border-color: var(--line); }
.card:hover { transform: translateY(-4px) rotate(-.4deg); transition-timing-function: var(--hc-ease-playful); }
.section-head h2, .innobits h2 { font-weight: 700; }
.hero { background: var(--hc-gradient-red-wash, transparent); }
a:focus-visible, .btn:focus-visible, .chip:focus-visible { box-shadow: var(--hc-shadow-focus); outline: none; }
.card h3, .howto h3, .meet h2 { font-family: var(--hc-font-sans); font-weight: 700; }
