/* ==========================================
   王一一 · 个人主页 — Design System
   Picture-book modernism for a creative kid
   ========================================== */

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

:root {
  /* ── Palette (OKLCH) ── */
  --ink:        oklch(0.14 0.012 258);        /* near-black, whisper of blue */
  --muted:      oklch(0.50 0.010 258);        /* secondary text */
  --faint:      oklch(0.72 0.006 258);        /* borders, dividers */
  --bg:         oklch(1 0 0);                 /* pure white */
  --surface:    oklch(0.965 0.008 252);       /* barely-tinted panel bg */

  --primary:    oklch(0.52 0.175 252);        /* deep cobalt — the brand anchor */
  --primary-l:  oklch(0.70 0.125 252);        /* light cobalt for hover states */
  --primary-p:  oklch(0.92 0.030 252);        /* pale cobalt for subtle fills */

  --accent:     oklch(0.60 0.185 24);         /* warm coral — buttons, links */
  --accent-l:   oklch(0.72 0.135 24);         /* light coral hover */

  --crayon-green:  oklch(0.63 0.175 148);
  --crayon-yellow: oklch(0.85 0.135 92);
  --crayon-pink:   oklch(0.66 0.155 4);
  --crayon-lilac:  oklch(0.68 0.120 300);

  /* ── Typography ── */
  --font-display:  'Fredoka', 'ZCOOL KuaiLe', 'Noto Sans SC', sans-serif;
  --font-body:     'Nunito', 'Noto Sans SC', sans-serif;

  /* ── Spacing & Rhythm ── */
  --max-width:    68rem;                       /* ~1090px */
  --space-xs:     0.5rem;
  --space-sm:     0.75rem;
  --space-md:     1.25rem;
  --space-lg:     2.5rem;
  --space-xl:     4.5rem;
  --space-2xl:    7rem;

  /* ── Radius ── */
  --radius-sm:    0.5rem;
  --radius-md:    0.75rem;
  --radius-lg:    1.25rem;
  --radius-full:  9999px;

  /* ── Shadows ── */
  --shadow-card:  0 1px 3px oklch(0 0 0 / 0.06), 0 1px 2px oklch(0 0 0 / 0.04);
  --shadow-raise: 0 4px 14px oklch(0 0 0 / 0.08), 0 2px 6px oklch(0 0 0 / 0.04);
  --shadow-glow:  0 0 0 4px oklch(0.52 0.175 252 / 0.15);

  /* ── Transitions ── */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.65, 0, 0.35, 1);
  --duration:     0.35s;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── Selection ── */
::selection {
  background: var(--primary-p);
  color: var(--primary);
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  text-wrap: balance;
  letter-spacing: -0.015em;
}

p, li { text-wrap: pretty; }

/* ==========================================
   LAYOUT UTILITIES
   ========================================== */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ==========================================
   NAVIGATION
   ========================================== */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 4.25rem;
  display: flex;
  align-items: center;
  transition: background var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
}

.navbar.scrolled {
  background: var(--bg);
  box-shadow: 0 1px 0 var(--faint);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color var(--duration) var(--ease-out);
}

.navbar.scrolled .nav-logo {
  color: var(--primary);
}

.nav-logo:hover { opacity: 0.75; }

.nav-menu {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.nav-link {
  display: block;
  padding: 0.5rem 1rem;
  color: oklch(1 0 0 / 0.75);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-full);
  transition: color var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out);
}

.navbar.scrolled .nav-link {
  color: var(--muted);
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: oklch(1 0 0 / 0.12);
}

.navbar.scrolled .nav-link:hover,
.navbar.scrolled .nav-link.active {
  color: var(--primary);
  background: var(--primary-p);
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 101;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--duration) var(--ease-out),
              opacity var(--duration) var(--ease-out),
              background var(--duration) var(--ease-out);
}

.navbar.scrolled .nav-toggle span {
  background: var(--ink);
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==========================================
   HERO — the thesis
   ========================================== */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--primary);
  color: #fff;
  padding: 6rem 0 4rem;
}

/* Atmospheric depth */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, oklch(0.58 0.16 270 / 0.35), transparent),
    radial-gradient(ellipse 60% 80% at 85% 15%, oklch(0.48 0.18 240 / 0.3), transparent);
  pointer-events: none;
}

/* Floating crayon dots */
.hero-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-dot {
  position: absolute;
  border-radius: 50%;
  opacity: 0.45;
}

.hero-dot:nth-child(1) {
  width: 180px; height: 180px;
  top: 12%; left: 8%;
  background: var(--crayon-pink);
}
.hero-dot:nth-child(2) {
  width: 100px; height: 100px;
  top: 25%; right: 12%;
  background: var(--crayon-yellow);
}
.hero-dot:nth-child(3) {
  width: 60px; height: 60px;
  bottom: 20%; left: 22%;
  background: var(--crayon-green);
}
.hero-dot:nth-child(4) {
  width: 130px; height: 130px;
  bottom: 30%; right: 25%;
  background: var(--crayon-lilac);
  opacity: 0.3;
}

.hero .container {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Greeting line */
.hero-greeting {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 500;
  opacity: 0.8;
  margin-bottom: 0.5rem;
  animation: hero-rise 0.7s var(--ease-out) both;
}

/* The big name */
.hero-name-wrapper {
  position: relative;
  display: inline-block;
  animation: hero-rise 0.7s 0.1s var(--ease-out) both;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 9vw, 6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: #fff;
}

/* Squiggly underline — the signature */
.hero-squiggle {
  position: absolute;
  bottom: -0.15em;
  left: 50%;
  transform: translateX(-50%);
  width: 105%;
  height: auto;
  overflow: visible;
}

.hero-squiggle path {
  fill: none;
  stroke: var(--crayon-yellow);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 600;
  stroke-dashoffset: 600;
  animation: draw-squiggle 1s 0.6s var(--ease-out) forwards;
}

@keyframes draw-squiggle {
  to { stroke-dashoffset: 0; }
}

/* Subtitle */
.hero-subtitle {
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.15rem;
  animation: hero-rise 0.7s 0.2s var(--ease-out) both;
}

.hero-subtitle .sep {
  opacity: 0.45;
  margin: 0 0.15rem;
}

/* Description */
.hero-description {
  font-family: var(--font-body);
  font-size: 1.05rem;
  max-width: 34rem;
  margin: 1.5rem auto 0;
  opacity: 0.75;
  line-height: 1.8;
  animation: hero-rise 0.7s 0.3s var(--ease-out) both;
}

/* CTAs */
.hero-cta {
  display: flex;
  gap: 0.85rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
  justify-content: center;
  animation: hero-rise 0.7s 0.4s var(--ease-out) both;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: oklch(1 0 0 / 0.55);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-body);
  z-index: 2;
  animation: float 2.4s ease-in-out infinite;
}

.scroll-line {
  width: 1px;
  height: 2.25rem;
  background: oklch(1 0 0 / 0.35);
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: oklch(1 0 0 / 0.8);
  animation: scroll-gleam 2.4s ease-in-out infinite;
}

@keyframes scroll-gleam {
  0%, 15% { top: -100%; }
  50%, 65% { top: 100%; }
  100% { top: 100%; }
}

@keyframes hero-rise {
  from { opacity: 0; transform: translateY(1.5rem); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-6px); }
}

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: transform 0.2s var(--ease-out),
              box-shadow 0.2s var(--ease-out),
              background var(--duration) var(--ease-out);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-l);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px oklch(0.60 0.185 24 / 0.35);
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 0 0 2px oklch(1 0 0 / 0.3);
}

.btn-outline:hover {
  background: oklch(1 0 0 / 0.12);
  box-shadow: inset 0 0 0 2px oklch(1 0 0 / 0.55);
  transform: translateY(-1px);
}

/* ==========================================
   SECTION HEADERS
   ========================================== */

.section-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-title {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.65rem;
  letter-spacing: -0.025em;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 24rem;
  margin: 0 auto;
}

/* ==========================================
   SECTIONS — rhythm
   ========================================== */

.section {
  padding: var(--space-2xl) 0;
}

.section-alt {
  background: var(--surface);
}

/* ==========================================
   ABOUT
   ========================================== */

.about-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
  max-width: 52rem;
  margin: 0 auto;
}

/* Big age number */
.about-badge {
  font-family: var(--font-display);
  font-size: clamp(6rem, 12vw, 9rem);
  font-weight: 700;
  line-height: 0.85;
  color: var(--primary);
  letter-spacing: -0.04em;
  user-select: none;
}

.about-badge small {
  display: block;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
  margin-top: 0.25rem;
}

.about-text p {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.85;
}

.about-text p:last-child { margin-bottom: 0; }

.about-text strong {
  color: var(--primary);
  font-weight: 700;
}

/* Hobby chips */
.about-hobbies {
  margin-top: 1.75rem;
}

.about-hobbies-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.85rem;
}

.hobby-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.hobby-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--faint);
  background: var(--bg);
  color: var(--muted);
  transition: border-color var(--duration) var(--ease-out),
              color var(--duration) var(--ease-out),
              transform 0.2s var(--ease-out);
}

.hobby-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.hobby-chip .chip-emoji { font-size: 1.05rem; }

/* ==========================================
   WORKS
   ========================================== */

.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
}

/* Each card has its own personality */
.work-card {
  --card-color: var(--primary);
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--faint);
  transition: transform 0.3s var(--ease-out),
              box-shadow 0.3s var(--ease-out);
  display: flex;
  flex-direction: column;
}

.work-card:hover {
  transform: translateY(-4px) rotate(-0.3deg);
  box-shadow: var(--shadow-raise);
}

/* Card image area — each gets its own gradient */
.work-visual {
  height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.work-visual .work-emoji {
  font-size: 3.5rem;
  position: relative;
  z-index: 1;
  transition: transform 0.35s var(--ease-out);
}

.work-card:hover .work-emoji {
  transform: scale(1.18) rotate(-5deg);
}

/* Card content */
.work-body {
  padding: 1.35rem 1.4rem 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}

.work-tags span {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  background: var(--primary-p);
  color: var(--primary);
}

.work-card:nth-child(2) .work-tags span { background: oklch(0.92 0.035 24 / 0.25); color: var(--accent); }
.work-card:nth-child(3) .work-tags span { background: oklch(0.93 0.045 148 / 0.20); color: var(--crayon-green); }
.work-card:nth-child(4) .work-tags span { background: oklch(0.90 0.035 4 / 0.22);  color: var(--crayon-pink); }
.work-card:nth-child(5) .work-tags span { background: oklch(0.92 0.040 300 / 0.18); color: var(--crayon-lilac); }
.work-card:nth-child(6) .work-tags span { background: oklch(0.93 0.045 92 / 0.22);  color: oklch(0.55 0.09 85); }

.work-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.45rem;
}

.work-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 1rem;
}

.work-links {
  display: flex;
  gap: 1rem;
}

.work-link {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.work-link:hover { color: var(--accent); }

/* ==========================================
   CONTACT
   ========================================== */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
  max-width: 56rem;
  margin: 0 auto;
}

/* Info side */
.contact-info-list {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact-icon-box {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--primary-p);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.contact-item h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.15rem;
}

.contact-item a,
.contact-item span {
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-body);
  transition: color 0.2s var(--ease-out);
}

.contact-item a:hover { color: var(--primary); }

/* Social links */
.contact-social {
  display: flex;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.social-link {
  width: 2.65rem;
  height: 2.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: var(--bg);
  border: 1.5px solid var(--faint);
  border-radius: var(--radius-sm);
  transition: all 0.25s var(--ease-out);
}

.social-link:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px oklch(0.52 0.175 252 / 0.12);
}

/* Form */
.contact-form {
  position: relative;
  background: var(--bg);
  padding: 2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--faint);
}

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

.form-group label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--faint);
  border-radius: var(--radius-md);
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--faint);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--bg);
}

.form-group textarea {
  resize: vertical;
  min-height: 7.5rem;
}

.btn-submit {
  width: 100%;
  justify-content: center;
  padding: 0.9rem 1.75rem;
  font-size: 1rem;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
  background: var(--primary);
  color: oklch(1 0 0 / 0.7);
  text-align: center;
  padding: 2.5rem 0;
  font-size: 0.9rem;
  font-family: var(--font-body);
}

.footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.footer-tagline {
  font-size: 0.85rem;
  opacity: 0.6;
}

/* ==========================================
   SCROLL REVEAL — removed
   Content is always visible. The hero entrance
   animation carries the page-load motion.
   ========================================== */


/* ==========================================
   TOAST
   ========================================== */

.toast {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  background: var(--ink);
  color: #fff;
  padding: 0.9rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.925rem;
  font-weight: 600;
  box-shadow: var(--shadow-raise);
  z-index: 600;
  animation: toast-in 0.4s var(--ease-out),
             toast-out 0.4s 2.6s var(--ease-out) forwards;
}

.toast.success { background: var(--crayon-green); }
.toast.error   { background: oklch(0.52 0.18 20); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(2.5rem); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(2.5rem); }
}

/* ==========================================
   DIARY LIST
   ========================================== */

.diary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.diary-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--bg);
  border: 1px solid var(--faint);
  transition: transform 0.3s var(--ease-out),
              box-shadow 0.3s var(--ease-out);
  overflow: hidden;
}

.diary-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-raise);
}

.diary-card-link {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
}

/* Date block */
.diary-card-date {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-width: 3.5rem;
  padding-top: 0.2rem;
}

.diary-card-day {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.02em;
}

.diary-card-ym {
  font-size: 0.8rem;
  color: var(--faint);
  margin-top: 0.25rem;
  font-weight: 600;
}

/* Card body */
.diary-card-body {
  flex: 1;
  min-width: 0;
}

.diary-card-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.diary-card-mood {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--primary-p);
  color: var(--primary);
  margin-bottom: 0.55rem;
}

.diary-card:nth-child(5n+2) .diary-card-mood { background: oklch(0.92 0.035 24 / 0.25); color: var(--accent); }
.diary-card:nth-child(5n+3) .diary-card-mood { background: oklch(0.93 0.045 148 / 0.20); color: var(--crayon-green); }
.diary-card:nth-child(5n+4) .diary-card-mood { background: oklch(0.90 0.035 4 / 0.22);  color: var(--crayon-pink); }
.diary-card:nth-child(5n+5) .diary-card-mood { background: oklch(0.92 0.040 300 / 0.18); color: var(--crayon-lilac); }

.diary-card-excerpt {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Empty state */
.diary-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.diary-empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.7;
}

.diary-empty h3 {
  font-size: 1.3rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.diary-empty p {
  font-size: 0.95rem;
  line-height: 1.7;
}

.diary-empty a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

/* Pagination */
.diary-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: var(--space-xl);
}

.diary-page-btn {
  padding: 0.55rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--primary-p);
  transition: all 0.2s var(--ease-out);
}

.diary-page-btn:hover {
  background: var(--primary-p);
  border-color: var(--primary);
}

.diary-page-btn.disabled {
  color: var(--faint);
  border-color: var(--faint);
  cursor: default;
  pointer-events: none;
}

.diary-page-info {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

/* ==========================================
   DIARY DETAIL
   ========================================== */

.diary-detail {
  padding-top: 7rem;
}

.diary-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.diary-back {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s var(--ease-out);
}

.diary-back:hover {
  color: var(--primary);
}

.diary-admin-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.diary-detail-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--faint);
  padding: 2.5rem 2.5rem 3rem;
  max-width: 48rem;
  margin: 0 auto;
}

.diary-detail-top {
  margin-bottom: 2rem;
}

.diary-detail-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: 0.85rem;
}

.diary-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--faint);
}

.diary-detail-meta time {
  font-weight: 500;
}

.diary-detail-mood {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--primary-p);
  color: var(--primary);
}

.diary-detail-edited {
  font-size: 0.82rem;
  color: var(--faint);
  font-style: italic;
}

.diary-detail-content {
  font-size: 1.08rem;
  line-height: 2;
  color: var(--ink);
}

.diary-detail-content p {
  margin-bottom: 1.25rem;
}

/* Prev / Next navigation */
.diary-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  max-width: 48rem;
  margin: 2.5rem auto 0;
}

.diary-nav-item {
  flex: 1;
  min-width: 0;
}

.diary-nav-next {
  text-align: right;
}

.diary-nav-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--faint);
  margin-bottom: 0.35rem;
  letter-spacing: 0.03em;
}

.diary-nav-label.diary-nav-none {
  color: var(--faint);
  font-weight: 400;
  font-style: italic;
}

.diary-nav-item a {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s var(--ease-out);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.diary-nav-item a:hover {
  color: var(--accent);
}

/* ==========================================
   LOGIN PAGE
   ========================================== */

.login-section {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 1.5rem 3rem;
}

.login-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--faint);
  padding: 2.5rem 2.5rem 2rem;
  max-width: 26rem;
  width: 100%;
  text-align: center;
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.login-card h2 {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.login-desc {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.login-form {
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-form .btn-submit {
  width: 100%;
}

.login-error {
  background: oklch(0.93 0.04 20 / 0.25);
  color: oklch(0.50 0.18 20);
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.login-back {
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.login-back a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s var(--ease-out);
}

.login-back a:hover {
  color: var(--primary);
}

/* ==========================================
   WRITE PAGE
   ========================================== */

.write-section {
  padding-top: 7rem;
}

.write-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: var(--space-xl);
}

.write-header .section-title {
  margin-bottom: 0;
}

.write-header-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9rem;
}

.write-header-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s var(--ease-out);
}

.write-header-links a:hover {
  color: var(--primary);
}

.write-error {
  background: oklch(0.93 0.04 20 / 0.25);
  color: oklch(0.50 0.18 20);
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.write-form {
  max-width: 48rem;
  margin: 0 auto;
}

.write-form .form-group {
  margin-bottom: 1.4rem;
}

.write-form .form-group label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.write-form .form-group input[type="text"],
.write-form .form-group input[type="password"],
.write-form .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--faint);
  border-radius: var(--radius-md);
  transition: border-color var(--duration) var(--ease-out),
              box-shadow var(--duration) var(--ease-out);
  outline: none;
}

.write-form .form-group input:focus,
.write-form .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--bg);
}

.write-form .form-group textarea {
  resize: vertical;
  min-height: 18rem;
}

.required {
  color: var(--accent);
}

.write-buttons {
  display: flex;
  gap: 0.85rem;
  margin-top: 1.5rem;
}

/* Mood picker */
.mood-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.mood-option {
  position: relative;
  cursor: pointer;
}

.mood-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mood-label {
  display: block;
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--faint);
  background: var(--bg);
  color: var(--muted);
  transition: all 0.2s var(--ease-out);
  user-select: none;
}

.mood-option input:checked + .mood-label {
  border-color: var(--primary);
  background: var(--primary-p);
  color: var(--primary);
}

.mood-label:hover {
  border-color: var(--primary-l);
}

.mood-option.selected .mood-label {
  border-color: var(--primary);
  background: var(--primary-p);
  color: var(--primary);
}

/* ==========================================
   DIARY RESPONSIVE
   ========================================== */

@media (max-width: 860px) {
  .diary-grid {
    grid-template-columns: 1fr;
  }

  .diary-detail-card {
    padding: 1.5rem 1.25rem 2rem;
  }

  .diary-detail-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .diary-detail {
    padding-top: 6rem;
  }

  .write-section {
    padding-top: 6rem;
  }

  .write-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .write-buttons {
    flex-direction: column;
  }

  .write-buttons .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .login-card {
    padding: 2rem 1.5rem 1.5rem;
  }

  .diary-nav {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .diary-nav-next {
    text-align: center;
  }
}

/* ==========================================
   REDUCED MOTION
   ========================================== */

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

  html { scroll-behavior: auto; }
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 860px) {
  :root {
    --space-xl: 3rem;
    --space-2xl: 5rem;
  }

  .nav-toggle { display: flex; }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 16rem;
    height: 100vh;
    height: 100dvh;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    box-shadow: -4px 0 20px oklch(0 0 0 / 0.08);
    transition: right 0.4s var(--ease-in-out);
  }

  .nav-menu.active { right: 0; }

  /* Mobile panel: always use dark-on-white (panel is white bg) */
  .nav-menu .nav-link {
    color: var(--muted);
  }

  .nav-menu .nav-link:hover,
  .nav-menu .nav-link.active {
    color: var(--primary);
    background: var(--primary-p);
  }

  .nav-link {
    font-size: 1.1rem;
    padding: 0.7rem 1.25rem;
  }

  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .about-badge { font-size: clamp(4rem, 15vw, 7rem); }

  .hobby-chips { justify-content: center; }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .hero-title {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }

  .hero-dot:nth-child(1) { width: 100px; height: 100px; }
  .hero-dot:nth-child(2) { width: 60px;  height: 60px; }
  .hero-dot:nth-child(4) { width: 80px;  height: 80px; }
}

@media (max-width: 540px) {
  .container { padding: 0 1.25rem; }

  .hero {
    min-height: 100svh;
    padding: 5rem 0 3rem;
  }

  .hero-title { font-size: clamp(2rem, 12vw, 3rem); }

  .hero-description { font-size: 0.95rem; }

  .hero-cta {
    flex-direction: column;
    width: 100%;
    max-width: 18rem;
  }

  .hero-cta .btn { width: 100%; }

  .works-grid {
    grid-template-columns: 1fr;
  }

  .section-title { font-size: clamp(1.65rem, 7vw, 2rem); }

  .contact-form { padding: 1.35rem; }

  .about-badge { font-size: clamp(3.5rem, 18vw, 6rem); }

  .footer { padding: 2rem 0; }
}
