/* ============================================
   THE ORANGE DIARY — Design System
   The entire site designed as an actual diary
   ============================================ */

:root {
  /* Paper & Cover */
  --cover-orange: #D4600A;
  --cover-dark: #A84E08;
  --cover-deep: #8B3E06;
  --paper: #FDF6E3;
  --paper-aged: #F5E6C8;
  --paper-shadow: #E8D5B0;
  --paper-line: #C8B898;

  /* Inks */
  --ink-black: #2C2416;
  --ink-blue: #1B3A5C;
  --ink-brown: #5C3D1E;
  --ink-red: #8B2500;
  --ink-pencil: #8B8878;

  /* Accent */
  --orange-bright: #E8700A;
  --orange-glow: #FF8C1A;
  --ribbon: #C0392B;

  /* Fonts */
  --f-handwritten: 'Caveat', cursive;
  --f-editorial: 'Cormorant Garamond', serif;
  --f-typewriter: 'Special Elite', monospace;
  --f-body: 'Libre Baskerville', serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: #3D2B1F;
  background-image:
    radial-gradient(ellipse at 30% 50%, #4A3628 0%, transparent 70%),
    radial-gradient(ellipse at 70% 30%, #52392A 0%, transparent 60%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  font-family: var(--f-body);
  color: var(--ink-black);
}

/* ============================================
   THE DIARY (outer cover)
   ============================================ */

.diary {
  width: 100%;
  max-width: 900px;
  position: relative;
}

.diary-cover {
  background: linear-gradient(145deg, var(--cover-orange) 0%, var(--cover-dark) 60%, var(--cover-deep) 100%);
  border-radius: 4px 16px 16px 4px;
  padding: 3px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.3),
    0 8px 24px rgba(0,0,0,0.4),
    0 20px 60px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  position: relative;
}

/* Spine */
.diary-cover::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, var(--cover-deep) 0%, var(--cover-dark) 40%, var(--cover-orange) 100%);
  border-radius: 4px 0 0 4px;
  box-shadow: inset -2px 0 4px rgba(0,0,0,0.2);
}

/* Leather texture */
.diary-cover::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px 16px 16px 4px;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' type='fractalNoise'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Elastic band */
.diary-band {
  position: absolute;
  right: 60px;
  top: -6px;
  bottom: -6px;
  width: 14px;
  background: var(--ribbon);
  border-radius: 2px;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  opacity: 0.9;
}

/* Bookmark ribbon */
.bookmark-ribbon {
  position: absolute;
  top: 0;
  right: 100px;
  width: 24px;
  height: 70px;
  background: var(--ribbon);
  z-index: 15;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.2);
}
.bookmark-ribbon::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  border-left: 12px solid var(--ribbon);
  border-right: 12px solid var(--ribbon);
  border-bottom: 10px solid transparent;
}

/* ============================================
   DIARY TABS
   ============================================ */

.diary-tabs {
  position: absolute;
  right: -32px;
  top: 40px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 20;
}

.diary-tab {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: var(--f-handwritten);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 12px 6px;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.15);
  text-decoration: none;
  letter-spacing: 0.5px;
}
.diary-tab:hover { transform: translateX(4px); }
.diary-tab.active { transform: translateX(8px); box-shadow: 2px 2px 8px rgba(0,0,0,0.25); }

.diary-tab.tab-novels { background: var(--cover-orange); color: white; }
.diary-tab.tab-cities { background: #2E7D32; color: white; }
.diary-tab.tab-characters { background: var(--ink-blue); color: white; }
.diary-tab.tab-detection { background: var(--ink-brown); color: #F5E6C8; }
.diary-tab.tab-author { background: #6B3FA0; color: white; }

/* ============================================
   COVER PAGE
   ============================================ */

.cover-page {
  text-align: center;
  padding: 4rem 3rem;
  background: var(--paper);
  border-radius: 2px 14px 14px 2px;
  margin-left: 37px;
  position: relative;
  overflow: hidden;
}
.cover-page::after {
  content: '';
  position: absolute;
  top: -20%; right: -10%;
  width: 60%; height: 60%;
  background: radial-gradient(ellipse, rgba(200,170,120,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.diary-title {
  font-family: var(--f-handwritten);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--cover-orange);
  line-height: 1.1;
  margin-bottom: 0.5rem;
  position: relative;
}
.diary-title::after {
  content: '';
  display: block;
  width: 200px; height: 3px;
  background: var(--cover-orange);
  margin: 0.5rem auto;
  border-radius: 2px;
  transform: rotate(-1deg);
}

.diary-subtitle {
  font-family: var(--f-typewriter);
  font-size: 0.9rem;
  color: var(--ink-pencil);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 1rem;
}

.diary-owner {
  font-family: var(--f-handwritten);
  font-size: 1.6rem;
  color: var(--ink-brown);
  margin-top: 2.5rem;
}

.diary-owner-note {
  font-family: var(--f-editorial);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-pencil);
  margin-top: 0.3rem;
}

.diary-description {
  font-family: var(--f-handwritten);
  font-size: 1.1rem;
  color: var(--ink-pencil);
  margin-top: 2rem;
  line-height: 1.6;
}

.diary-warning {
  font-family: var(--f-typewriter);
  font-size: 0.75rem;
  color: var(--ink-red);
  margin-top: 3rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ============================================
   DIARY PAGES (inner content)
   ============================================ */

.diary-pages {
  background: var(--paper);
  border-radius: 2px 14px 14px 2px;
  margin-left: 37px;
  min-height: 400px;
  position: relative;
  box-shadow:
    inset 2px 0 8px rgba(0,0,0,0.05),
    inset 0 2px 4px rgba(0,0,0,0.03);
}

/* Paper edge */
.diary-pages::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 8px; bottom: 8px;
  width: 6px;
  background: repeating-linear-gradient(180deg, var(--paper) 0px, var(--paper) 1px, var(--paper-shadow) 1px, var(--paper-shadow) 2px);
  border-radius: 0 2px 2px 0;
}

/* Ruled lines */
.page-content {
  background-image: repeating-linear-gradient(transparent, transparent 31px, var(--paper-line) 31px, var(--paper-line) 32px);
  background-position: 0 20px;
  padding: 2.5rem 3rem 3rem 4rem;
  position: relative;
}

/* Red margin line */
.page-content::before {
  content: '';
  position: absolute;
  left: 72px;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(200, 60, 60, 0.2);
}

/* ============================================
   NAV (inside front cover)
   ============================================ */

.diary-nav {
  background: var(--paper-aged);
  margin-left: 37px;
  padding: 1.5rem 2.5rem 1.5rem 4rem;
  border-bottom: 1px dashed var(--paper-line);
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.diary-nav a {
  font-family: var(--f-handwritten);
  font-size: 1.15rem;
  color: var(--ink-blue);
  text-decoration: none;
  position: relative;
  transition: color 0.2s;
}
.diary-nav a:hover { color: var(--cover-orange); }
.diary-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--cover-orange);
  transition: width 0.3s;
}
.diary-nav a:hover::after { width: 100%; }

.nav-separator { color: var(--paper-line); font-size: 0.8rem; }

/* ============================================
   ENTRY HEADINGS & TEXT
   ============================================ */

.entry-date {
  font-family: var(--f-typewriter);
  font-size: 0.8rem;
  color: var(--ink-pencil);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 0.3rem;
}

.entry-heading {
  font-family: var(--f-handwritten);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--ink-blue);
  line-height: 1.2;
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}
.entry-heading::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0; right: -10px;
  height: 2px;
  background: linear-gradient(90deg, var(--ink-blue), transparent);
  transform: rotate(-0.5deg);
}
.entry-heading.orange { color: var(--cover-orange); }
.entry-heading.orange::after { background: linear-gradient(90deg, var(--cover-orange), transparent); }
.entry-heading.brown { color: var(--ink-brown); }
.entry-heading.brown::after { background: linear-gradient(90deg, var(--ink-brown), transparent); }
.entry-heading.red { color: var(--ink-red); }
.entry-heading.red::after { background: linear-gradient(90deg, var(--ink-red), transparent); }

.entry-body {
  font-family: var(--f-body);
  font-size: 0.95rem;
  line-height: 2;
  color: var(--ink-black);
  max-width: 620px;
}
.entry-body p { margin-bottom: 1rem; text-indent: 1.5rem; }
.entry-body p:first-child { text-indent: 0; }

.handwritten {
  font-family: var(--f-handwritten);
  font-size: 1.2rem;
  line-height: 2;
  color: var(--ink-brown);
}

.typewritten {
  font-family: var(--f-typewriter);
  font-size: 0.85rem;
  line-height: 2;
  color: var(--ink-black);
  letter-spacing: 0.5px;
}

/* ============================================
   ENTRY CARDS (blog posts as diary entries)
   ============================================ */

.entry-card {
  display: block;
  padding: 1.2rem 1.5rem;
  margin: 0.8rem 0;
  background: rgba(255,255,255,0.3);
  border-left: 3px solid var(--paper-line);
  text-decoration: none;
  color: var(--ink-black);
  transition: all 0.2s;
  position: relative;
}
.entry-card:hover {
  background: rgba(255,255,255,0.6);
  border-left-color: var(--cover-orange);
  transform: translateX(4px);
}

.entry-card-date {
  font-family: var(--f-typewriter);
  font-size: 0.7rem;
  color: var(--ink-pencil);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.entry-card-title {
  font-family: var(--f-handwritten);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink-blue);
  margin: 0.2rem 0;
}
.entry-card:hover .entry-card-title { color: var(--cover-orange); }

.entry-card-excerpt {
  font-family: var(--f-body);
  font-size: 0.85rem;
  color: var(--ink-pencil);
  line-height: 1.5;
}

.entry-card.cities { border-left-color: #2E7D32; }
.entry-card.cities .entry-card-date::before { content: '\U0001F3D9 '; }
.entry-card.characters { border-left-color: var(--ink-blue); }
.entry-card.characters .entry-card-date::before { content: '\U0001F464 '; }
.entry-card.detection { border-left-color: var(--ink-brown); }
.entry-card.detection .entry-card-date::before { content: '\U0001F50D '; }

/* ============================================
   NOVEL CARDS (case files)
   ============================================ */

.novel-card {
  background: var(--paper-aged);
  padding: 2rem 2.5rem;
  margin: 1.5rem 0;
  border-radius: 2px;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.novel-card-number {
  font-family: var(--f-typewriter);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--ink-pencil);
}

.novel-card-title {
  font-family: var(--f-editorial);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink-black);
  margin: 0.3rem 0;
}

.novel-card-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}
.novel-card-title a:hover { color: var(--cover-orange); }

.novel-card-tagline {
  font-family: var(--f-handwritten);
  font-size: 1.1rem;
  color: var(--cover-orange);
  font-style: italic;
}

.novel-card-body {
  font-family: var(--f-body);
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--ink-black);
  margin-top: 0.8rem;
  max-width: 580px;
}

.novel-card-status {
  display: inline-block;
  font-family: var(--f-typewriter);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  margin-top: 0.8rem;
  border-radius: 2px;
}
.novel-card-status.available { background: #E8F5E9; color: #2E7D32; }
.novel-card-status.coming { background: #FFF3E0; color: var(--cover-dark); }

/* ============================================
   STICKY NOTES
   ============================================ */

.sticky-note {
  background: #FFFACD;
  padding: 1.2rem 1rem;
  font-family: var(--f-handwritten);
  font-size: 1.05rem;
  color: var(--ink-brown);
  line-height: 1.5;
  transform: rotate(-1.5deg);
  box-shadow: 2px 3px 8px rgba(0,0,0,0.12);
  margin: 1.5rem 0;
  max-width: 340px;
  position: relative;
}
.sticky-note.orange { background: #FFE0B2; }
.sticky-note.blue { background: #E3F2FD; }
.sticky-note.pink { background: #FCE4EC; }

/* Tape */
.sticky-note::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px; height: 16px;
  background: rgba(200,200,180,0.5);
  border-radius: 1px;
}

/* ============================================
   MARGIN NOTES
   ============================================ */

.margin-note {
  font-family: var(--f-handwritten);
  font-size: 0.95rem;
  color: var(--ink-red);
  line-height: 1.4;
  display: inline-block;
}
.margin-note::before { content: '\u2192 '; }
.margin-note.sanjana { color: var(--cover-orange); }
.margin-note.pencil { color: var(--ink-pencil); font-family: var(--f-typewriter); font-size: 0.7rem; }

/* ============================================
   DECORATIONS
   ============================================ */

.coffee-stain {
  position: absolute;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(ellipse, transparent 30%, rgba(160,120,60,0.06) 40%, rgba(160,120,60,0.1) 50%, rgba(160,120,60,0.06) 60%, transparent 70%);
  pointer-events: none;
}

/* Larger tea stain variant */
.tea-stain {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.7;
}
.tea-stain.sm {
  width: 50px; height: 45px;
  background: radial-gradient(ellipse, transparent 35%, rgba(180,140,70,0.08) 45%, rgba(180,140,70,0.12) 55%, rgba(180,140,70,0.06) 65%, transparent 75%);
}
.tea-stain.md {
  width: 90px; height: 85px;
  background: radial-gradient(ellipse, transparent 32%, rgba(150,110,50,0.05) 42%, rgba(150,110,50,0.09) 52%, rgba(150,110,50,0.04) 62%, transparent 72%);
}
.tea-stain.lg {
  width: 120px; height: 110px;
  background: radial-gradient(ellipse, transparent 30%, rgba(140,100,40,0.04) 40%, rgba(140,100,40,0.07) 50%, rgba(140,100,40,0.03) 60%, transparent 70%);
}

/* Ink blot */
.ink-blot {
  position: absolute;
  pointer-events: none;
}
.ink-blot::before {
  content: '';
  display: block;
  border-radius: 50%;
  background: rgba(44, 36, 22, 0.06);
  filter: blur(1px);
}
.ink-blot.sm::before { width: 8px; height: 6px; }
.ink-blot.md::before { width: 14px; height: 10px; }

/* Pen test scribble — where someone tested if the pen works */
.pen-test {
  position: absolute;
  pointer-events: none;
  font-family: var(--f-handwritten);
  color: rgba(44, 36, 22, 0.08);
  font-size: 0.8rem;
  transform: rotate(-8deg);
  user-select: none;
}

.paper-clip {
  position: absolute;
  width: 20px; height: 50px;
  border: 2px solid #B0B0B0;
  border-radius: 10px 10px 0 0;
  border-bottom: none;
  top: -15px; right: 30px;
  transform: rotate(5deg);
  opacity: 0.5;
}
.paper-clip::after {
  content: '';
  position: absolute;
  bottom: 0; left: 3px;
  width: 14px; height: 30px;
  border: 2px solid #B0B0B0;
  border-radius: 0 0 7px 7px;
  border-top: none;
}

.entry-divider {
  border: none;
  border-top: 1px dashed var(--paper-line);
  margin: 2rem 0;
}

/* ============================================
   EDGE SCRIBBLES (lat/long, page numbers, notes)
   ============================================ */

.edge-scribble {
  position: absolute;
  font-family: var(--f-handwritten);
  pointer-events: none;
  user-select: none;
  opacity: 0.35;
  font-size: 0.75rem;
  color: var(--ink-pencil);
}

.edge-scribble.coords {
  font-family: var(--f-typewriter);
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  opacity: 0.2;
  color: var(--ink-blue);
}

.edge-scribble.page-num {
  font-family: var(--f-typewriter);
  font-size: 0.65rem;
  opacity: 0.25;
  color: var(--ink-pencil);
}

.edge-scribble.doodle {
  font-size: 1.2rem;
  opacity: 0.12;
}

/* Right-edge scribbles */
.edge-right {
  right: 12px;
}

/* Left-edge scribbles (in the margin area) */
.edge-left {
  left: 14px;
}

/* Bottom-edge */
.edge-bottom {
  bottom: 8px;
}

/* Top-edge */
.edge-top {
  top: 8px;
}

/* Corner fold effect */
.corner-fold {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 30px 30px;
  border-color: transparent transparent var(--paper-shadow) transparent;
  pointer-events: none;
  opacity: 0.5;
}

/* Water damage on edge */
.water-mark {
  position: absolute;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(160,140,100,0.04) 30%,
    rgba(160,140,100,0.07) 50%,
    rgba(160,140,100,0.04) 70%,
    transparent 100%
  );
  border-radius: 50% 50% 0 0;
}

/* ============================================
   NEWSLETTER INSERT
   ============================================ */

.newsletter-insert {
  background: #FFFDE7;
  padding: 2rem;
  margin: 2rem 0;
  transform: rotate(0.5deg);
  box-shadow: 2px 3px 12px rgba(0,0,0,0.1);
  border: 1px dashed var(--paper-line);
  text-align: center;
  position: relative;
}
.newsletter-insert h3 {
  font-family: var(--f-handwritten);
  font-size: 1.6rem;
  color: var(--cover-orange);
  margin-bottom: 0.5rem;
}
.newsletter-insert p {
  font-family: var(--f-body);
  font-size: 0.9rem;
  color: var(--ink-brown);
  margin-bottom: 1rem;
}
.newsletter-insert .newsletter-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.newsletter-insert .newsletter-form input {
  font-family: var(--f-typewriter);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--paper-line);
  background: white;
  width: 240px;
  outline: none;
}
.newsletter-insert .newsletter-form input:focus { border-color: var(--cover-orange); }
.newsletter-insert .newsletter-form button {
  font-family: var(--f-handwritten);
  font-size: 1.1rem;
  padding: 0.5rem 1.5rem;
  background: var(--cover-orange);
  color: white;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}
.newsletter-insert .newsletter-form button:hover { background: var(--cover-dark); }

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

.diary-footer {
  background: var(--paper-aged);
  margin-left: 37px;
  padding: 1.5rem 2.5rem 1.5rem 4rem;
  border-top: 1px dashed var(--paper-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-radius: 0 0 14px 0;
}
.diary-footer-text {
  font-family: var(--f-typewriter);
  font-size: 0.7rem;
  color: var(--ink-pencil);
  letter-spacing: 1px;
}
.diary-footer-links {
  display: flex;
  gap: 1.5rem;
}
.diary-footer-links a {
  font-family: var(--f-handwritten);
  font-size: 1rem;
  color: var(--ink-blue);
  text-decoration: none;
}
.diary-footer-links a:hover { color: var(--cover-orange); }

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.entry-card, .novel-card, .sticky-note { animation: fadeInUp 0.4s ease both; }
.entry-card:nth-child(2) { animation-delay: 0.05s; }
.entry-card:nth-child(3) { animation-delay: 0.1s; }
.entry-card:nth-child(4) { animation-delay: 0.15s; }

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

@media (max-width: 700px) {
  body { padding: 0.5rem; }
  .diary-cover::before { width: 20px; }
  .diary-pages, .cover-page, .diary-nav, .diary-footer { margin-left: 17px; }
  .page-content { padding: 1.5rem 1.2rem 2rem 2rem; }
  .page-content::before { left: 32px; }
  .diary-title { font-size: 2.5rem; }
  .entry-heading { font-size: 1.7rem; }
  .diary-tabs { right: -24px; }
  .diary-tab { font-size: 0.7rem; padding: 8px 4px; }
  .diary-band { right: 40px; }
  .novel-card { padding: 1.5rem; }
}
