:root {
  color-scheme: light;
  --page-start: #d4d4d8;
  --page-end: #71717a;
  --surface: #f4f4f5;
  --surface-muted: #e4e4e7;
  --panel: #ffffff;
  --panel-soft: #f3f4f6;
  --text: #18181b;
  --muted: #52525b;
  --border: #d4d4d8;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --success: #22c55e;
  --success-hover: #16a34a;
  --danger: #dc2626;
  --shadow: 0 24px 60px rgba(24, 24, 27, 0.22);
}

.dark {
  color-scheme: dark;
  --page-start: #18181b;
  --page-end: #27272a;
  --surface: #27272a;
  --surface-muted: #3f3f46;
  --panel: #18181b;
  --panel-soft: #3f3f46;
  --text: #fafafa;
  --muted: #d4d4d8;
  --border: #52525b;
  --brand: #60a5fa;
  --brand-hover: #93c5fd;
  --success: #16a34a;
  --success-hover: #22c55e;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, var(--page-start), var(--page-end));
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header,
.site-footer {
  background: var(--panel);
  box-shadow: 0 2px 14px rgba(24, 24, 27, 0.12);
}

.site-footer {
  margin-top: 2.5rem;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
}

.nav-inner {
  max-width: 80rem;
  height: 4rem;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  height: 3rem;
  width: auto;
  display: block;
  transition: transform 160ms ease;
}

.logo:hover {
  transform: scale(1.08);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-link,
.icon-button,
.button {
  border: 0;
  border-radius: 0.5rem;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link {
  padding: 0.55rem 0.75rem;
  color: var(--brand);
}

.nav-link:hover,
.icon-button:hover {
  background: var(--surface-muted);
}

.nav-link.primary,
.button.success {
  background: var(--success);
  color: white;
}

.nav-link.primary:hover,
.button.success:hover {
  background: var(--success-hover);
}

.icon-button {
  min-width: 2.5rem;
  min-height: 2.5rem;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--text);
}

.social-link {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--surface);
}

.social-link img {
  width: 1rem;
  height: 1rem;
}

.dark .social-link.github img {
  filter: brightness(0) invert(1);
}

.menu-button {
  display: none;
}

.mobile-menu {
  display: none;
  padding: 0 1rem 1rem;
}

.mobile-menu .nav-link {
  display: block;
  margin-top: 0.25rem;
}

.mobile-menu.open {
  display: block;
}

.page {
  flex: 1;
  width: min(100% - 2rem, 72rem);
  margin: 0 auto;
  padding: 1.5rem 0;
}

.page.centered {
  display: grid;
  place-items: center;
}

.home-page {
  width: min(100% - 2rem, 78rem);
  padding: 1rem 0;
}

.stack {
  display: grid;
  gap: 1.5rem;
}

.card {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.section {
  padding: 1.25rem;
  margin-top: 1rem;
  background: var(--panel-soft);
  border-radius: 0.5rem;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "hero hero topics"
    "courses events member"
    "labs verify verify";
  gap: 0.55rem;
  align-items: stretch;
}

.bento-tile {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.45rem;
  padding: clamp(0.8rem, 1.4vw, 1rem);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(24, 24, 27, 0.16);
}

.bento-tile > :last-child {
  margin-bottom: 0;
}

.bento-tile h2 {
  margin-bottom: 0.1rem;
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.15;
}

.bento-tile p {
  margin-bottom: 0;
  color: var(--muted);
}

.bento-tile .button-row {
  justify-content: flex-start;
  margin-top: auto;
  padding-top: 0.15rem;
}

.bento-hero {
  grid-area: hero;
  justify-content: center;
  min-height: 14rem;
}

.bento-hero .hero-logo {
  height: 3.6rem;
  margin-left: 0;
}

.bento-hero h1 {
  max-width: 12ch;
  margin-bottom: 0.25rem;
  font-size: clamp(1.9rem, 4vw, 2.65rem);
}

.bento-hero p {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1rem;
}

.bento-hero .button-row {
  justify-content: flex-start;
}

.bento-courses {
  grid-area: courses;
}

.bento-events {
  grid-area: events;
}

.bento-topics {
  grid-area: topics;
}

.bento-labs {
  grid-area: labs;
}

.bento-member {
  grid-area: member;
}

.bento-verify {
  grid-area: verify;
}

.member-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.member-header h2 {
  margin: 0 0 0.1rem;
}

.member-header p {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.member-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--panel);
  font-weight: 850;
}

.member-details {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

.member-details div {
  display: grid;
  gap: 0.15rem;
}

.member-details dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.member-details dd {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.mini-list {
  display: grid;
  gap: 0.45rem;
}

.mini-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
}

.mini-list a:hover {
  background: var(--surface-muted);
}

.mini-list span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.home-page .button-row,
.home-page .tag-list {
  gap: 0.45rem;
}

.home-page .button-row {
  margin-top: 0.65rem;
}

.home-page .button {
  min-height: 2.15rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.92rem;
}

.home-page .tag {
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
}

.hero {
  text-align: center;
}

.hero-logo {
  height: 6rem;
  width: auto;
  margin: 0 auto 1rem;
  display: block;
}

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

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 1rem;
  color: var(--muted);
}

h3 {
  margin-bottom: 1rem;
  color: var(--brand);
  text-align: center;
}

.text-center {
  text-align: center;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.course-card {
  overflow: hidden;
  border-radius: 0.5rem;
  background: var(--panel);
  box-shadow: 0 10px 26px rgba(24, 24, 27, 0.12);
  text-align: center;
}

.course-card-label,
.course-card-title {
  padding: 1rem;
  font-weight: 750;
}

.course-card-label {
  background: var(--surface-muted);
}

.course-card-title {
  min-height: 4.5rem;
  display: grid;
  place-items: center;
  background: #71717a;
  color: white;
}

.course-card-body {
  padding: 1rem;
  color: var(--muted);
}

.course-card .button-row {
  margin-top: 0;
  padding: 0 1rem 1.25rem;
}

.button-row,
.tag-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.tag-list.compact {
  justify-content: flex-start;
  gap: 0.5rem;
}

.button-row {
  margin-top: 1.25rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  color: white;
}

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

.button.brand {
  background: var(--brand);
}

.button.brand:hover {
  background: var(--brand-hover);
}

.button.dark-button {
  background: #374151;
}

.tag {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.95rem;
}

.pill {
  border-radius: 999px;
}

.link-panel {
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--panel-soft);
  border-radius: 0.5rem;
}

.link-panel .button {
  width: 100%;
  margin-top: 0.75rem;
}

.link-panel .button:first-child {
  margin-top: 0;
}

.form-card {
  max-width: 32rem;
}

form .button {
  width: 100%;
  margin-top: 0.25rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--brand);
  font-weight: 700;
}

input {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.help-dialog {
  margin-top: 1.5rem;
  text-align: center;
}

.help-dialog summary {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 800;
}

.help-box {
  position: relative;
  margin: 1rem auto 0;
  max-width: 34rem;
  padding: 1.25rem;
  border-radius: 0.5rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  text-align: left;
}

.help-box h2 {
  color: var(--text);
  font-size: 1.1rem;
}

.result-page.valid {
  background: linear-gradient(to bottom, #dcfce7, #bbf7d0);
  color: #18181b;
}

.result-page.invalid {
  background: linear-gradient(to bottom, #fee2e2, #fecaca);
  color: #18181b;
}

.certificate {
  position: relative;
  max-width: 64rem;
  background: white;
  border: 1px solid #bfdbfe;
  color: #18181b;
}

.certificate-watermark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.certificate-watermark img {
  width: min(20rem, 70%);
  opacity: 0.1;
}

.certificate-content {
  position: relative;
}

.certificate-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.certificate-title {
  margin-top: 2rem;
  text-align: center;
}

.eyebrow {
  color: #60a5fa;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.certificate-name,
.certificate-course {
  margin-top: 0.75rem;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
}

.certificate-course {
  color: #1e40af;
  font-size: clamp(1.5rem, 4vw, 2rem);
}

.certificate-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.detail-label {
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-value {
  margin-top: 0.5rem;
  color: #3f3f46;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.invalid-badge {
  display: inline-flex;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 800;
}

@media (max-width: 980px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "hero hero"
      "courses courses"
      "events labs"
      "member member"
      "topics topics"
      "verify verify";
  }

  .bento-hero,
  .bento-courses,
  .bento-topics {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }

  .menu-button {
    display: inline-grid;
  }

  .grid-3,
  .certificate-details {
    grid-template-columns: 1fr;
  }

  .bento-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "courses"
      "events"
      "member"
      "topics"
      "labs"
      "verify";
  }

  .bento-hero,
  .bento-courses,
  .bento-events,
  .bento-member,
  .bento-topics,
  .bento-labs,
  .bento-verify {
    min-height: auto;
  }

  .certificate-top {
    align-items: flex-start;
  }
}

@media print {
  .site-header,
  .site-footer,
  .print-controls {
    display: none !important;
  }

  body,
  .result-page.valid,
  .result-page.invalid {
    background: white !important;
  }
}
