/* ============================================================
   臭屁的小窝 — design system
   "Elegant glass + aurora": frosted surfaces, drifting color
   fields, gradient accents, soft micro-interactions.
   Sections: tokens, base, background, navigation, content,
             typography, forms, buttons, media, propose,
             footer, utilities, responsive, motion, print
   ============================================================ */

:root {
  --primary: #ff6b9d;
  --primary-deep: #e84d84;
  --violet: #a855f7;
  --violet-deep: #7c3aed;
  --teal: #4ecdc4;
  --ink: #2b2440;
  --ink-soft: #5c5470;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --surface-glass-strong: rgba(255, 255, 255, 0.92);
  --surface-border: rgba(255, 255, 255, 0.6);
  --radius: 24px;
  --nav-height: 64px;
  --shadow-soft: 0 4px 16px rgba(43, 28, 84, 0.1);
  --shadow-lift: 0 18px 44px rgba(43, 28, 84, 0.22);
  --grad-brand: linear-gradient(120deg, #ff6b9d 0%, #c05ce8 55%, #a855f7 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Clip horizontal overflow without breaking position:sticky */
html,
body {
  overflow-x: clip;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(160deg, #4c3a8f 0%, #6d4aa8 45%, #8b5fb0 100%);
  min-height: 100vh;
  line-height: 1.6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Fine grain over everything — kills gradient banding (3% opacity) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(255, 107, 157, 0.35);
}

::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.45);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.65);
  background-clip: content-box;
}

/* ---------------- Page background & aurora ---------------- */

#background {
  position: relative;
  min-height: 100vh;
  background:
    linear-gradient(
      160deg,
      rgba(59, 42, 110, 0.55) 0%,
      rgba(109, 74, 168, 0.42) 50%,
      rgba(139, 95, 176, 0.55) 100%
    ),
    url('../img/levenoth.jpeg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
}

/* Drifting color fields (aurora) behind the glass */
#background::before,
#background::after {
  content: "";
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

#background::before {
  top: -12vh;
  left: -15vw;
  width: 60vw;
  height: 60vw;
  min-width: 480px;
  min-height: 480px;
  background: radial-gradient(circle at 40% 40%, rgba(255, 107, 157, 0.5), transparent 65%);
  animation: aurora-a 28s ease-in-out infinite alternate;
}

#background::after {
  bottom: -18vh;
  right: -12vw;
  width: 55vw;
  height: 55vw;
  min-width: 440px;
  min-height: 440px;
  background: radial-gradient(circle at 60% 60%, rgba(78, 205, 196, 0.4), transparent 65%);
  animation: aurora-b 34s ease-in-out infinite alternate;
}

@keyframes aurora-a {
  to { transform: translate3d(14vw, 10vh, 0) scale(1.18); }
}

@keyframes aurora-b {
  to { transform: translate3d(-12vw, -8vh, 0) scale(1.12); }
}

#background_transparent {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  backdrop-filter: blur(3px);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------------- Content card (glass) ---------------- */

#content {
  padding: 48px 28px;
  max-width: 1200px;
  margin: calc(var(--nav-height) + 20px) auto 40px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(26px) saturate(160%);
  backdrop-filter: blur(26px) saturate(160%);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  animation: card-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
}

/* ---------------- Navigation ---------------- */

.navbar.fixed-top {
  position: sticky !important;
  top: 0 !important;
  z-index: 1030 !important;
  width: 100% !important;
  min-height: var(--nav-height);
  background: rgba(20, 14, 40, 0.66) !important;
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-brand {
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* Desktop: centered pill menu */
@media (min-width: 992px) {
  .navbar-nav {
    margin: 0 auto;
    justify-content: center;
    gap: 4px;
  }

  .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: 999px;
    transition: background 0.25s ease, color 0.25s ease,
      transform 0.25s ease, box-shadow 0.25s ease;
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
    color: var(--text-light, #fff) !important;
  }

  .navbar-nav .nav-link.active {
    background: var(--grad-brand);
    box-shadow: 0 4px 16px rgba(255, 107, 157, 0.45);
    font-weight: 600;
    color: #fff !important;
  }
}

/* Desktop (wide): bigger, more spread-out header */
@media (min-width: 1200px) {
  :root {
    --nav-height: 76px;
  }

  .navbar .container-fluid {
    padding: 0 2.5rem;
  }

  .navbar-brand {
    font-size: 1.5rem;
    letter-spacing: 0.05em;
  }

  .navbar-nav {
    gap: 8px;
  }

  .navbar-nav .nav-link {
    padding: 9px 20px !important;
    font-size: 1.02rem;
  }
}

@media (min-width: 1400px) {
  :root {
    --nav-height: 84px;
  }

  .navbar-brand {
    font-size: 1.75rem;
  }

  .navbar-nav {
    gap: 12px;
  }

  .navbar-nav .nav-link {
    padding: 11px 26px !important;
    font-size: 1.1rem;
  }
}

/* Mobile: vertical menu inside the Bootstrap collapse */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background: rgba(20, 14, 40, 0.92);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 20px 20px;
    padding: 0.5rem 1rem 1rem;
    margin-top: 0.5rem;
    box-shadow: var(--shadow-lift);
  }

  .navbar-nav {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .navbar-nav .nav-link {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 1.05rem;
    font-weight: 500;
    padding: 12px 16px;
    margin: 2px 0;
    border-radius: 14px;
    transition: background 0.2s ease;
  }

  .navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff !important;
  }

  .navbar-nav .nav-link.active {
    background: var(--grad-brand);
    box-shadow: 0 4px 14px rgba(255, 107, 157, 0.4);
    color: #fff !important;
    font-weight: 600;
  }
}

/* ---------------- Typography ---------------- */

h1, h2, h3, h4, h5, h6 {
  color: var(--ink);
  margin-bottom: 1rem;
  font-weight: 600;
}

h1 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Short gradient divider under the page title */
h1::after {
  content: "";
  display: block;
  width: 76px;
  height: 4px;
  border-radius: 999px;
  margin: 14px auto 0;
  background: var(--grad-brand);
}

/* Subtitle pill (exam pages: "2024 全国统一卷" etc.) */
h4 {
  width: fit-content;
  max-width: 100%;
  margin: 0.5rem auto 2.5rem;
  padding: 7px 20px;
  text-align: center;
  border-radius: 999px;
  background: rgba(255, 107, 157, 0.09);
  border: 1px solid rgba(255, 107, 157, 0.3);
  color: var(--primary-deep);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 1;
}

p.letter {
  font-family: "Georgia", "Times New Roman", "Songti SC", "SimSun", serif;
  font-size: 1.08rem;
  line-height: 2;
  margin: 1.5rem 0;
  padding: 0 12px;
  color: var(--ink);
}

/* ---------------- Forms ---------------- */

.form-group {
  margin-bottom: 1.3rem;
}

.form-section {
  margin: 2rem 0;
  padding: 1.5rem;
  background: rgba(248, 249, 250, 0.8);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.form-section h3 {
  color: var(--primary-deep);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.question-text {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.form-label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--ink);
  font-size: 0.98rem;
}

/* Form controls: 16px font prevents iOS auto-zoom, 48px touch target */
.form-control,
.form-select {
  border: 1.5px solid #e4dff2;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 1rem;
  min-height: 48px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
    background 0.2s ease;
}

textarea.form-control {
  min-height: unset;
}

.form-control:hover,
.form-select:hover {
  border-color: #cfc6e8;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.16);
  background: #fff;
  outline: none;
}

/* Inline inputs followed by a unit, e.g. "____ cm" */
.unit-input {
  display: inline-block;
  width: 200px;
  max-width: 60vw;
  vertical-align: middle;
}

/* Centered 考生姓名 / 主考官 row on the exam pages */
.exam-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.exam-meta .form-control {
  width: 220px;
  max-width: 70vw;
}

/* Exam paper container */
.exam-form {
  max-width: 860px;
  margin: 0 auto;
}

/* Section headers on the exam pages (一、选择题 …) */
.exam-section {
  display: block;
  color: var(--primary-deep);
  font-weight: 700;
  font-size: 1.08rem;
  margin: 2.5rem 0 1.2rem;
  padding-bottom: 10px;
  background: linear-gradient(
      90deg,
      rgba(255, 107, 157, 0.55),
      rgba(168, 85, 247, 0.15) 60%,
      transparent
    )
    bottom left / 100% 2px no-repeat;
}

/* ---------------- Buttons ---------------- */

.btn-submit,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning {
  border: none;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  box-shadow: var(--shadow-soft);
}

.btn-submit,
.btn-primary {
  background: var(--grad-brand);
}

.btn-success {
  background: linear-gradient(120deg, #34d399, #0d9488);
}

.btn-info {
  background: linear-gradient(120deg, #60a5fa, #6366f1);
}

.btn-warning {
  background: linear-gradient(120deg, #fbbf24, #f97316);
  color: #4a2c00;
}

.btn-submit:hover,
.btn-primary:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.35);
  filter: brightness(1.05);
}

.btn-submit:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active {
  transform: translateY(0) scale(0.97);
}

/* Raw <input type="submit"> in the templates */
.btn-submit {
  display: inline-block;
}

/* ---------------- Response message ---------------- */

#question-form-response {
  color: var(--primary-deep);
  font-weight: 700;
  text-align: center;
  margin: 1.25rem 0;
  padding: 1.1rem 1.25rem;
  border-radius: 16px;
  background: linear-gradient(
    120deg,
    rgba(255, 107, 157, 0.12),
    rgba(168, 85, 247, 0.12)
  );
  border: 1px solid rgba(255, 107, 157, 0.3);
}

/* ---------------- Images & media ---------------- */

.img-center,
.img-frame,
.video-center {
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-lift);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.img-center {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.video-center {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

.img-center:hover,
.video-center:hover {
  transform: translateY(-4px);
}

.img-max-60 {
  max-width: 60%;
}

.img-80 {
  max-width: 80%;
}

/* Responsive image grid */
.img-row {
  display: grid;
  gap: 15px;
  margin: 2rem 0;
}

.img-col {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.img-col img,
.img-col video {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.4s ease;
}

.img-col:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.img-col:hover img {
  transform: scale(1.05);
}

.img-row-2 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.img-row-3 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* PDF embed (七夕 calendar) */
embed {
  display: block;
  border-radius: 18px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-lift);
  background: #fff;
}

/* ---------------- Propose page ---------------- */

.propose-wrap {
  padding: 2em 0;
  width: 100%;
  text-align: center;
}

.propose-title {
  font-size: clamp(4rem, 25vw, 6.25rem);
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.propose-text {
  font-size: clamp(1.25rem, 4vw, 2.5rem);
  font-weight: 700;
  text-align: left;
  line-height: 1.9;
  color: var(--ink);
}

.propose-wrap audio {
  display: block;
  width: min(430px, 100%);
  margin: 10px auto;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

/* ---------------- Error page ---------------- */

.error-emoji {
  font-size: 4.5rem;
  line-height: 1;
  margin-bottom: 1.5rem;
}

/* ---------------- Footer ---------------- */

.site-footer {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.92rem;
  letter-spacing: 0.1em;
  padding: 30px 16px 42px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

/* ---------------- Utilities ---------------- */

.center {
  text-align: center;
}

.clickable {
  cursor: pointer;
}

.page-pad {
  padding: 2.5em 0;
}

/* ---------------- Responsive ---------------- */

@media (max-width: 768px) {
  /* background-attachment: fixed is broken on iOS Safari */
  #background {
    background-attachment: scroll;
  }

  #content {
    margin: calc(var(--nav-height) + 12px) 10px 20px;
    padding: 30px 18px;
    background: var(--surface-glass-strong);
    border-radius: 20px;
  }

  .form-section {
    padding: 1rem;
    margin: 1rem 0;
  }

  p.letter {
    font-size: 1rem;
    padding: 0 4px;
  }

  .img-row-2,
  .img-row-3 {
    grid-template-columns: 1fr;
  }

  .btn-primary,
  .btn-success,
  .btn-info,
  .btn-warning,
  .btn-submit {
    width: 100%;
    padding: 14px;
  }

  /* Propose page: fixed-width images become full-width on small screens */
  .propose-wrap img,
  .propose-wrap video {
    width: 90%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  #content {
    margin: calc(var(--nav-height) + 10px) 6px 14px;
    padding: 24px 14px;
    border-radius: 16px;
  }

  .navbar-nav .nav-link {
    padding: 11px 12px;
    font-size: 1rem;
  }
}

/* ---------------- Motion & accessibility ---------------- */

a:focus-visible,
button:focus-visible,
.nav-link:focus-visible {
  outline: 3px solid #ffe66d;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------- Print ---------------- */

@media print {
  #background,
  #background_transparent {
    background: white !important;
  }

  #background::before,
  #background::after,
  body::after,
  .site-footer {
    display: none !important;
  }

  .navbar {
    display: none !important;
  }

  #content {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 20px !important;
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
