/* ============================================================
   CLASS OF 2027 — THE YEARBOOK
   A hand-made scrapbook: aged paper, washi tape, polaroids,
   doodled caps, and ink that's just a little crooked.
   ============================================================ */

:root {
  --paper: #f5eddb;
  --paper-mid: #efe5ce;
  --paper-deep: #e6d9bb;
  --card: #fffdf4;
  --ink: #26241f;
  --ink-soft: #7a705e;
  --ink-faint: #a89c84;
  --accent: #35507d;
  --accent-deep: #263e63;
  --gold: #c19a3f;
  --blue: #4a7192;
  --line: rgba(38, 36, 31, 0.18);
  --line-soft: rgba(38, 36, 31, 0.1);
  --shadow: 0 1px 2px rgba(38, 36, 31, 0.08), 0 10px 26px rgba(38, 36, 31, 0.1);
  --shadow-lift: 0 2px 4px rgba(38, 36, 31, 0.08), 0 20px 44px rgba(38, 36, 31, 0.16);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --hand: 'Caveat', 'Comic Sans MS', cursive;
  --sans: 'Work Sans', system-ui, sans-serif;
  --radius: 5px;
  --wrap: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(120% 90% at 50% 0%, #faf5ea 0%, var(--paper) 55%, #ece0c4 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: #fff8ef;
}

a {
  color: inherit;
}

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

button {
  font-family: inherit;
}

.wrap {
  width: min(var(--wrap), 100% - 2.5rem);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 8px 0;
}

.skip:focus {
  left: 0;
}

/* ---------------- top washi tape ---------------- */

.page-tape {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: clamp(1.5rem, 8vw, 6rem);
  pointer-events: none;
  z-index: 1;
}

.page-tape span {
  width: 96px;
  height: 30px;
  background: rgba(250, 242, 214, 0.55);
  box-shadow: 0 1px 3px rgba(38, 36, 31, 0.12);
  clip-path: polygon(2% 10%, 97% 2%, 99% 90%, 3% 97%);
}

.page-tape span:nth-child(1) {
  transform: rotate(-4deg) translateY(-8px);
}

.page-tape span:nth-child(2) {
  transform: rotate(2deg) translateY(-5px);
}

.page-tape span:nth-child(3) {
  transform: rotate(-1deg) translateY(-9px);
}

.page-tape span:nth-child(4) {
  transform: rotate(3deg) translateY(-6px);
}

/* ---------------- header ---------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px dashed var(--line);
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.8rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.brand-mark {
  font-family: var(--serif);
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--paper);
  background: var(--ink);
  border-radius: 3px;
  padding: 0.22rem 0.5rem 0.3rem;
  line-height: 1;
  transform: rotate(-2deg);
}

.brand-text {
  font-family: var(--hand);
  font-size: 1.35rem;
  color: var(--ink-soft);
  transform: rotate(-1deg);
}

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #f2f6fb;
  box-shadow: 0 2px 0 var(--accent-deep), 0 8px 18px rgba(38, 62, 99, 0.25);
}

.btn-primary:hover {
  background: var(--accent-deep);
  transform: rotate(-1deg) translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: rotate(-1deg);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- doodles ---------------- */

.doodle {
  position: absolute;
  color: var(--ink);
  opacity: 0.75;
  pointer-events: none;
}

.hero .doodle {
  color: var(--ink-soft);
}

.cap-left {
  left: clamp(0.5rem, 4vw, 3rem);
  top: 1.5rem;
  width: 74px;
  transform: rotate(-14deg);
  color: var(--blue);
  opacity: 0.6;
}

.cap-right {
  right: clamp(0.5rem, 4vw, 3rem);
  top: 4rem;
  width: 64px;
  transform: rotate(16deg) scaleX(-1);
  color: var(--accent);
  opacity: 0.55;
}

.star-one {
  left: 6%;
  top: 26%;
  width: 30px;
  transform: rotate(-12deg);
}

.heart-one {
  right: 7%;
  top: 24%;
  width: 30px;
  transform: rotate(14deg);
  color: var(--accent);
}

.diploma-one {
  left: 10%;
  bottom: -1.5rem;
  width: 58px;
  transform: rotate(-10deg);
  color: var(--gold);
  opacity: 0.65;
}

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  text-align: center;
  padding: clamp(3.25rem, 10vh, 6rem) 0 3rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  transform: rotate(-1deg);
}

.rule {
  display: inline-block;
  height: 1px;
  width: clamp(2rem, 9vw, 5.5rem);
  background: var(--line);
}

.masthead {
  position: relative;
  display: inline-block;
  font-family: var(--serif);
  font-weight: 340;
  font-size: clamp(2.9rem, 8.5vw, 6.1rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

.masthead em {
  font-weight: 630;
  font-style: italic;
  font-variation-settings: 'opsz' 144;
  color: var(--accent);
}

.underline {
  position: absolute;
  left: -4%;
  bottom: -0.42em;
  width: 108%;
  height: 0.42em;
  color: var(--accent);
  opacity: 0.75;
}

.tagline {
  font-family: var(--hand);
  font-size: clamp(1.45rem, 3.4vw, 1.9rem);
  font-weight: 600;
  color: var(--ink-soft);
  margin: 1.6rem 0 0;
  transform: rotate(-0.5deg);
}

.statline {
  margin-top: 1.3rem;
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--ink-faint);
}

.statline .sep {
  color: var(--accent);
  margin-inline: 0.6rem;
  font-size: 0.9rem;
}

.statline .sign {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
}

/* ---------------- banner ---------------- */

.banner {
  background: color-mix(in srgb, var(--accent) 8%, var(--card));
  border: 2px dashed color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--radius);
  color: var(--accent-deep);
  padding: 0.9rem 1.2rem;
  margin-bottom: 2rem;
  font-size: 0.95rem;
  text-align: center;
}

/* ---------------- gallery ---------------- */

.gallery {
  list-style: none;
  margin: 0 0 4rem;
  padding: 0;
  columns: 4 250px;
  column-gap: 1.4rem;
}

.card {
  break-inside: avoid;
  margin: 0 0 1.5rem;
  animation: rise 500ms ease both;
}

.media {
  position: relative;
  margin: 0;
  background: var(--card);
  border-radius: 3px;
  padding: 10px 10px 12px;
  box-shadow: var(--shadow);
  transition: box-shadow 180ms ease, transform 180ms ease;
}

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

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

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

.card:hover .media {
  transform: rotate(0deg) scale(1.02) translateY(-4px);
  box-shadow: var(--shadow-lift);
  z-index: 2;
}

.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 96px;
  height: 28px;
  background: rgba(250, 242, 214, 0.85);
  box-shadow: 0 1px 3px rgba(38, 36, 31, 0.14);
  clip-path: polygon(2% 12%, 97% 4%, 99% 88%, 3% 96%);
  transform: translateX(-50%) rotate(-2deg);
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.card:nth-child(even) .tape {
  transform: translateX(-42%) rotate(3deg);
}

.thumb {
  position: relative;
  background: var(--paper-deep);
  border-radius: 2px;
  overflow: hidden;
  cursor: zoom-in;
}

.thumb img {
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 400ms ease, transform 600ms ease;
}

.thumb img.is-loaded {
  opacity: 1;
}

.card:hover .thumb img {
  transform: scale(1.02);
}

.card-fig {
  padding: 0.55rem 0.15rem 0;
}

.cap {
  margin: 0;
  font-family: var(--hand);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.cap.is-blank {
  color: var(--ink-faint);
  font-weight: 400;
}

.byline {
  margin: 0.15rem 0 0;
  font-family: var(--hand);
  font-size: 1.15rem;
  color: var(--ink-faint);
  text-align: right;
}

/* skeletons */
.skel {
  break-inside: avoid;
  margin-bottom: 1.5rem;
  border-radius: 3px;
  padding: 10px 10px 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: rise 500ms ease both;
}

.skel-block {
  background: linear-gradient(110deg, var(--paper-deep) 30%, var(--paper-mid) 50%, var(--paper-deep) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skel-img {
  height: 230px;
  width: 100%;
  border-radius: 2px;
}

.skel-line {
  height: 1.1rem;
  width: 60%;
  margin: 0.7rem 0 0;
  border-radius: 2px;
}

.skel-line.short {
  width: 35%;
  margin-left: auto;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

/* ---------------- empty state ---------------- */

.empty {
  text-align: center;
  padding: 2.5rem 1rem 6rem;
}

.empty-cap {
  position: relative;
  display: block;
  margin: 0 auto 1.1rem;
  width: 66px;
  color: var(--accent);
  transform: rotate(-6deg);
}

.empty h2 {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 2.2rem;
  margin: 0 0 0.3rem;
}

.empty p:not(.empty-star) {
  font-family: var(--hand);
  font-size: 1.35rem;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
}

/* ---------------- footer ---------------- */

.site-foot {
  border-top: 1px dashed var(--line);
  padding: 2.2rem 0 3rem;
  text-align: center;
}

.foot-doodles {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  margin-bottom: 1.1rem;
}

.foot-doodles .doodle {
  position: relative;
  width: 30px;
}

.foot-doodles .foot-cap {
  width: 36px;
  color: var(--blue);
  transform: rotate(-8deg);
}

.foot-doodles .foot-star {
  color: var(--gold);
  transform: rotate(6deg);
}

.foot-doodles .foot-heart {
  color: var(--accent);
  transform: rotate(-4deg);
}

.foot-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
}

.foot-title .sep {
  color: var(--accent);
  font-size: 0.8rem;
  margin-inline: 0.45rem;
}

/* ---------------- lightbox ---------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 28, 24, 0.93);
  backdrop-filter: blur(6px);
}

.lightbox[hidden] {
  display: none;
}

.lb-fig {
  margin: 0;
  max-width: min(1080px, 92vw);
  text-align: center;
}

.lb-frame {
  position: relative;
  display: inline-block;
  padding: 12px 12px 14px;
  background: var(--card);
  border-radius: 3px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lb-frame img {
  max-width: min(960px, 100%);
  max-height: 74vh;
  border-radius: 2px;
}

.lb-fig figcaption {
  font-family: var(--hand);
  font-size: 1.5rem;
  color: var(--paper);
  margin-top: 1.1rem;
}

.lb-fig figcaption strong {
  display: block;
  font-size: 1.15rem;
  color: #c3d6ee;
  font-weight: 600;
}

.lb-close,
.lb-nav {
  position: absolute;
  border: 0;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.lb-close {
  top: 1.1rem;
  right: 1.2rem;
  font-size: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
}

.lb-close:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(8deg);
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 50%;
  font-size: 2.2rem;
}

.lb-nav:hover {
  background: rgba(255, 255, 255, 0.12);
}

.lb-prev {
  left: 0.8rem;
}

.lb-next {
  right: 0.8rem;
}

@media (max-width: 640px) {
  .lb-nav {
    top: auto;
    bottom: 1.2rem;
    transform: none;
  }
}

/* ---------------- modal ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(30, 28, 24, 0.55);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      rgba(74, 113, 146, 0.07) 31px,
      rgba(74, 113, 146, 0.07) 32px
    ),
    var(--card);
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(30, 28, 24, 0.4);
  padding: 2rem 1.9rem 1.6rem 2.4rem;
  transform: rotate(-0.4deg);
  animation: rise 300ms ease both;
}

.modal-card::before {
  content: '';
  position: absolute;
  top: 0.9rem;
  bottom: 0.9rem;
  left: 1.1rem;
  width: 2px;
  border-radius: 1px;
  background: rgba(53, 80, 125, 0.5);
}

.modal-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--paper-deep);
  color: var(--ink);
  transform: rotate(8deg);
}

.modal-card h2 {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  margin: 0 0 0.25rem;
}

.modal-sub {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.25;
}

.dropzone {
  border: 2px dashed var(--ink-faint);
  border-radius: 4px;
  padding: 2.1rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  margin-bottom: 1.2rem;
}

.dropzone svg {
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.dropzone p {
  margin: 0.1rem 0;
  font-family: var(--hand);
  font-size: 1.4rem;
  font-weight: 600;
}

.dropzone p span {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 4px;
}

.dropzone .hint {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--ink-faint);
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  color: var(--ink);
  transform: rotate(-0.5deg);
}

.preview {
  position: relative;
  margin-bottom: 1.2rem;
}

.preview img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line-soft);
}

.remove {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(38, 36, 31, 0.82);
  color: #fff;
  font-family: var(--hand);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.25rem 0.8rem;
  cursor: pointer;
}

.remove:hover {
  background: var(--accent);
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.2rem;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  font-family: var(--hand);
  font-size: 1.35rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  padding: 0.15rem 0.1rem 0.3rem;
  transition: border-color 160ms ease;
}

.field textarea {
  resize: vertical;
  min-height: 2.6rem;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

.field select {
  cursor: pointer;
  appearance: none;
  font-family: var(--sans);
  font-size: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237a705e' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.2rem center;
}

.progress {
  height: 8px;
  border-radius: 4px;
  background: var(--paper-deep);
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 120ms ease;
}

.form-err {
  color: var(--accent-deep);
  font-family: var(--hand);
  font-size: 1.2rem;
  margin: 0 0 0.8rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

/* ---------------- toasts ---------------- */

.toasts {
  position: fixed;
  bottom: 1.2rem;
  right: 1.2rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toast {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--hand);
  font-size: 1.3rem;
  border-radius: 8px;
  padding: 0.7rem 1.1rem;
  box-shadow: var(--shadow-lift);
  animation: rise 250ms ease both;
  max-width: min(340px, 80vw);
}

.toast.is-error {
  background: var(--accent-deep);
  color: #fff;
}

.toast.is-ok {
  background: #2f6b3f;
  color: #fff;
}

/* ---------------- responsive ---------------- */

@media (max-width: 900px) {
  .gallery {
    columns: 3 200px;
  }

  .diploma-one {
    display: none;
  }
}

@media (max-width: 620px) {
  .gallery {
    columns: 2 150px;
    column-gap: 1rem;
  }

  .brand-text {
    display: none;
  }

  .modal-card {
    padding: 1.6rem 1.3rem 1.3rem 2rem;
  }

  .cap-left,
  .cap-right,
  .heart-one,
  .star-one {
    width: 44px;
    opacity: 0.45;
  }

  .page-tape span:nth-child(3),
  .page-tape span:nth-child(4) {
    display: none;
  }
}

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

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