.subjects-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================
   Subjects page — paper & sticky notes theme
   ============================================ */

body.subjects-page {
  background: var(--paper-bg);
}

/* ---------- navbar — frosted paper ---------- */
body.subjects-page .navbar {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--paper-border);
}

/* logo — plain ink, no gradient */
body.subjects-page .navbar .logo {
  background: none;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: var(--ink);
  background-clip: border-box;
  color: var(--ink);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* sign-in link (anonymous visitors) */
.papers-signin-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--paper-line);
  background: var(--paper-card);
  color: var(--ink-soft);
  font-family: "Outfit", sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.papers-signin-btn:hover {
  border-color: var(--paper-accent);
  color: var(--ink);
}

/* profile button — solid ink circle */
body.subjects-page .profile-btn {
  background: var(--ink);
  /* kill the global button:hover purple glow */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.subjects-page .profile-btn:hover {
  transform: translateY(-2px);
  filter: none;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

.profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-btn span {
  font-family: "Outfit", sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ffffff;
}

.profile-wrapper {
  position: relative;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 100;
}

.profile-wrapper.open .profile-dropdown {
  display: block;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-family: "Outfit", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

.profile-dropdown-item:hover {
  background: var(--bg-light);
}

.profile-dropdown-item i {
  font-size: 1.1rem;
  opacity: 0.7;
}

/* ---------- page heading (handwritten) ---------- */
.subjects-heading {
  margin-top: 195px;
  padding: 0 24px;
  text-align: center;
}

.subjects-title {
  display: inline-block;
  position: relative;
  font-family: "Caveat", cursive;
  font-size: 3rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* marker swipe under the title */
.subjects-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 10px;
  margin-top: 6px;
  background: rgba(58, 47, 26, 0.13);
  border-radius: 6px;
  transform: rotate(-1.5deg);
}

.subjects-sub {
  font-family: "Caveat", cursive;
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--ink-muted);
  margin: 8px 0 0;
}

/* ---------- continue banner (paper strip, below navbar + beta ribbon) ---------- */
body.subjects-page .continue-banner {
  position: fixed;
  top: 129px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 48px;
  background: var(--paper-card);
  border-bottom: 1px solid var(--paper-line);
  z-index: 50;
}

body.subjects-page .continue-subject,
body.subjects-page .continue-topic {
  font-family: "Outfit", sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

body.subjects-page .continue-divider {
  font-family: "Outfit", sans-serif;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--ink-muted);
}

body.subjects-page .continue-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

body.subjects-page .continue-btn {
  padding: 8px 18px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--paper-accent);
  color: var(--ink);
  font-family: "Outfit", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.subjects-page .continue-btn:hover {
  transform: translateY(-2px);
  filter: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

/* ---------- search (paper field) ---------- */
body.subjects-page .search-container {
  margin-top: 32px;
  /* keep the field close to full-width, just skirted by the page margin */
  padding: 0 48px;
}

body.subjects-page .search-input {
  background: #ffffff;
  border: 1px solid var(--paper-border);
  color: var(--ink);
}

body.subjects-page .search-input::placeholder {
  color: #a49a7f;
}

body.subjects-page .search-input:focus {
  outline: none;
  border-color: var(--paper-accent);
}

/* ---------- subject cards — sticky notes on the wall ---------- */
.subjects-container {
  padding: 48px 48px 48px;
}

.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 42px;
}

.subject-card {
  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--paper-line);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  padding: 30px 30px 26px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* each note hangs at its own slight angle */
.subject-card:nth-child(3n + 1) {
  transform: rotate(-0.7deg);
}

.subject-card:nth-child(3n + 2) {
  transform: rotate(0.9deg);
}

.subject-card:nth-child(3n + 3) {
  transform: rotate(-0.4deg);
}

/* piece of tape holding the note up */
.subject-card::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 88px;
  height: 22px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transform: translateX(-50%) rotate(-2.5deg);
}

.subject-card:nth-child(3n + 2)::before {
  transform: translateX(-50%) rotate(1.5deg);
}

/* hover: straighten out + lift */
.subject-card:hover {
  transform: rotate(0deg) translateY(-5px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
}

.subject-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 10px;
}

.subject-name {
  font-family: "Caveat", cursive;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.subject-code {
  font-family: "Outfit", sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--amber-soft);
  background: #f3edd9;
  border: 1px solid var(--paper-line);
  padding: 2px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.paper-types {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.paper-type {
  font-family: "Outfit", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b4a1d;
  background: #f7e8c0;
  border: 1px solid #ebd9a3;
  padding: 5px 10px;
  border-radius: 6px;
}

.card-divider {
  height: 1px;
  background: var(--paper-line);
  margin-bottom: 20px;
}

.card-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat {
  text-align: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--ink-muted);
  display: block;
  margin-bottom: 4px;
}

.stat-value {
  font-family: "Outfit", sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

/* open button — white pill, no gradient */
.open-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 48px;
  background: #ffffff;
  border: 1px solid var(--paper-accent);
  color: var(--ink);
  font-family: "Outfit", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-top: auto;
}

.open-btn:hover {
  transform: translateY(-2px);
  filter: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.no-results {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 48px;
  display: none;
}

.no-results.visible {
  display: block;
}

/* ---------- small screens ---------- */
@media (max-width: 600px) {
  .subjects-heading {
    margin-top: 185px;
  }

  .subjects-title {
    font-size: 2.4rem;
  }

  body.subjects-page .navbar {
    padding: 20px 24px;
  }

  .navbar .logo {
    font-size: 1.15rem;
  }

  body.subjects-page .continue-banner {
    top: 121px;
    padding: 12px 24px;
  }

  body.subjects-page .beta-ribbon {
    top: 81px;
  }

  .continue-info {
    max-width: 100%;
    margin-right: 12px;
  }

  .continue-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .continue-info .continue-subject,
  .continue-info .continue-divider {
    flex-shrink: 0;
  }

  .continue-info .continue-topic {
    flex: 1 1 auto;
    min-width: 0;
  }

  body.subjects-page .search-container {
    margin-top: 24px;
    padding: 20px 24px;
    width: 100%;
  }

  .subjects-container {
    padding: 24px 24px 32px;
  }

  .subjects-grid {
    gap: 36px;
  }

  .subject-card:nth-child(3n + 1) {
    transform: rotate(-0.5deg);
  }

  .subject-card:nth-child(3n + 2) {
    transform: rotate(0.6deg);
  }

  .subject-card:nth-child(3n + 3) {
    transform: rotate(-0.3deg);
  }

  .subject-header {
    flex-direction: column;
    gap: 8px;
  }

  .card-stats {
    gap: 8px;
  }

  .stat-label {
    font-size: 0.7rem;
  }

  .stat-value {
    font-size: 1rem;
  }
}
