/* ==========================================================================
   Design tokens — One UI–style: cool neutrals, squircle radii, a rotating
   set of vivid accent hues used to color-code each work like app icons.
   ========================================================================== */
:root {
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface-2: #e4e9f3;
  --text: #10151f;
  --muted: #667085;
  --border: rgba(16, 21, 31, 0.08);
  --shadow: rgba(16, 21, 31, 0.16);

  --accent: #3868f6;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--surface));

  --c1: #3868f6;
  --c2: #7c5cff;
  --c3: #12b76a;
  --c4: #f79009;
  --c5: #ee46bc;
  --c6: #06aed4;

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --nav-h: 64px;
  --page-pad: clamp(1rem, 5vw, 2.5rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d13;
    --surface: #141922;
    --surface-2: #1b212c;
    --text: #eef1f7;
    --muted: #8b93a3;
    --border: rgba(238, 241, 247, 0.09);
    --shadow: rgba(0, 0, 0, 0.55);
    --accent: #5c8bff;
    --accent-soft: color-mix(in srgb, var(--accent) 20%, var(--surface));
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0d13;
  --surface: #141922;
  --surface-2: #1b212c;
  --text: #eef1f7;
  --muted: #8b93a3;
  --border: rgba(238, 241, 247, 0.09);
  --shadow: rgba(0, 0, 0, 0.55);
  --accent: #5c8bff;
  --accent-soft: color-mix(in srgb, var(--accent) 20%, var(--surface));
  color-scheme: dark;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

img {
  max-width: 100%;
  display: block;
}

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

ul {
  list-style: none;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-md);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Ambient background blobs (soft, wallpaper-like — replaces flat texture)
   ========================================================================== */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient::before,
.ambient::after {
  content: '';
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.16;
}

.ambient::before {
  top: -18vmax;
  right: -14vmax;
  background: var(--c1);
}

.ambient::after {
  bottom: -20vmax;
  left: -16vmax;
  background: var(--c2);
}

/* ==========================================================================
   Floating pill navbar
   ========================================================================== */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 0.75rem var(--page-pad) 0;
}

.nav-container {
  position: relative;
  width: 100%;
  max-width: 1100px;
  height: var(--nav-h);
  padding: 0 0.5rem 0 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* The frosted-glass chrome lives on a pseudo-element rather than on
   .nav-container itself: backdrop-filter/transform/etc on a real element
   creates a new containing block for its position:fixed descendants,
   which would break the mobile bottom sheet nested inside. */
.nav-container::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 30px var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark span {
  width: 19px;
  height: 19px;
  background: #fff;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.logo-name {
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Theme switch */
.theme-switch {
  width: 52px;
  height: 30px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-switch .thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-switch .thumb svg {
  width: 14px;
  height: 14px;
}

.theme-switch .icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-switch .thumb {
  transform: translateX(22px);
}

:root[data-theme="dark"] .theme-switch .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-switch .icon-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-switch .thumb {
    transform: translateX(22px);
  }

  :root:not([data-theme="light"]) .theme-switch .icon-sun {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-switch .icon-moon {
    display: block;
  }
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 42px;
  height: 42px;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
}

.hamburger span {
  display: block;
  height: 2.5px;
  width: 20px;
  background: var(--text);
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.3s, opacity 0.3s;
}

.hamburger.active span:first-child {
  transform: translateY(6.5px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.active span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* Desktop inline nav list */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.nav-link:hover,
.nav-link.active-link {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-link--dl {
  background: var(--accent);
  color: var(--accent-ink) !important;
}

.nav-link--dl:hover {
  background: var(--accent);
  filter: brightness(1.08);
}

.nav-socials {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.3rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
}

.icon-link {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.2s, color 0.2s;
}

.icon-link:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Mobile bottom sheet */
.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(8, 10, 15, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nav-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 767px) {
  .nav-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    flex-direction: column;
    align-items: stretch;
    gap: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 28px 28px 0 0;
    padding: 0.75rem 1rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -12px 40px var(--shadow);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .nav-menu::before {
    content: '';
    width: 36px;
    height: 4px;
    border-radius: 99px;
    background: var(--surface-2);
    margin: 0.25rem auto 0.75rem;
  }

  .nav-menu.active {
    transform: translateY(0);
  }

  .nav-link {
    font-size: 1.05rem;
    padding: 0.85rem 1rem;
    justify-content: flex-start;
  }

  .nav-link--dl {
    justify-content: center;
    margin-top: 0.25rem;
  }

  .nav-socials {
    margin: 0.5rem 0 0;
    padding: 0.75rem 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    justify-content: center;
    gap: 0.6rem;
  }
}

@media (min-width: 768px) {
  .hamburger {
    display: none;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */
main {
  padding-top: calc(var(--nav-h) + 1.5rem);
}

.hero {
  max-width: 1100px;
  margin: 0.75rem auto 0;
  padding: clamp(2.5rem, 7vw, 4.5rem) clamp(1.5rem, 6vw, 3.5rem);
  background: linear-gradient(150deg, var(--accent-soft), var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: Outfit, sans-serif;
  font-size: clamp(2.2rem, 7vw, 3.75rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-title em {
  color: var(--accent);
  font-style: normal;
}

.hero-sub {
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  max-width: 1100px;
  margin: auto;
  padding: clamp(2.5rem, 6vw, 4rem) var(--page-pad);
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.section-tag {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.section-title {
  font-family: Outfit, sans-serif;
  font-size: clamp(1.6rem, 4.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-title strong {
  color: var(--accent);
}

/* ==========================================================================
   Cards grid
   ========================================================================== */
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 2.25rem;
}

.semester-block {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sem-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
  gap: 0.85rem;
}

@media (max-width: 360px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Rotating accent per card, cycling through the 6 hues */
.cards-grid .card:nth-child(6n+1) { --tint: var(--c1); }
.cards-grid .card:nth-child(6n+2) { --tint: var(--c2); }
.cards-grid .card:nth-child(6n+3) { --tint: var(--c3); }
.cards-grid .card:nth-child(6n+4) { --tint: var(--c4); }
.cards-grid .card:nth-child(6n+5) { --tint: var(--c5); }
.cards-grid .card:nth-child(6n+6) { --tint: var(--c6); }

.card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s, border-color 0.3s;
}

.card:hover {
  transform: translateY(-5px) scale(1.02);
  border-color: transparent;
  box-shadow: 0 14px 30px var(--shadow);
}

.card--wip {
  --tint: var(--muted);
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.card--wip:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border);
}

.card-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--tint) 16%, var(--surface));
}

.card-icon {
  width: 26px;
  height: 26px;
  background-color: var(--tint);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-num {
  font-family: Outfit, sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--tint);
}

.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wip-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  vertical-align: middle;
  margin-left: 0.3rem;
}

/* ==========================================================================
   Card reveal animation (driven by script.js)
   ========================================================================== */
.card {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Footer
   ========================================================================== */
footer {
  text-align: center;
  padding: 2.5rem var(--page-pad) 3rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}
