/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */

:root {
  /* Colors */
  --desk-bg: hsl(215, 25%, 12%); /* Deep dark slate desk */
  --paper-bg: hsl(48, 60%, 98%); /* Warm ivory paper */
  --ink-primary: hsl(215, 30%, 18%); /* Vintage fountain pen black */
  --ink-blue: hsl(225, 60%, 40%); /* Fountain pen blue for links */
  --ink-blue-hover: hsl(225, 75%, 30%);
  --pencil-gray: hsl(215, 12%, 42%); /* Soft pencil gray */
  --margin-line: hsl(350, 75%, 78%); /* Soft pink-red ruled margin */
  --rule-line: hsl(214, 50%, 93%); /* Very light blue-gray horizontal lines */
  --shadow-color: rgba(0, 0, 0, 0.25);
  
  /* Fonts */
  --font-serif: Georgia, "Times New Roman", Times, serif;
  --font-mono: "Courier New", Courier, monospace;
  --font-handwritten: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
  --font-typewriter: "American Typewriter", "Courier New", Courier, monospace;
  
  /* Spacing */
  --rule-height: 2rem;
}

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

body {
  font-family: var(--font-serif);
  color: var(--ink-primary);
  background-color: var(--desk-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Focus outline for accessibility */
a:focus-visible, 
button:focus-visible {
  outline: 3px solid var(--ink-blue);
  outline-offset: 4px;
}

/* ==========================================================================
   LAYOUTS
   ========================================================================== */

.desk {
  min-height: 100vh;
  padding: 2rem 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.notebook-container {
  position: relative;
  width: 100%;
  max-width: 860px;
  margin: 1rem auto;
}

/* Notebook Page Sheet */
.notebook-page {
  background-color: var(--paper-bg);
  min-height: 80vh;
  border-radius: 4px;
  box-shadow: 
    0 1px 1px var(--shadow-color),
    0 8px 16px -4px var(--shadow-color),
    0 20px 30px -10px var(--shadow-color);
  padding: 3rem 2.5rem 3rem 4.5rem; /* Large left padding for holes and margin line */
  position: relative;
  overflow: hidden;
  
  /* Lined paper background pattern */
  background-image: 
    /* Red vertical margin line */
    linear-gradient(to right, transparent 3.5rem, var(--margin-line) 3.5rem, var(--margin-line) 3.6rem, transparent 3.6rem),
    /* Light blue-ruled horizontal lines */
    linear-gradient(to bottom, var(--rule-line) 1px, transparent 1px);
  background-size: 100% 100%, 100% var(--rule-height);
  background-position: 0 0, 0 1.2rem;
}

/* Binder Hole Punch effect on the left of the page */
.notebook-page::before {
  content: "";
  position: absolute;
  left: 1.2rem;
  top: 0;
  bottom: 0;
  width: 1.5rem;
  /* Radial gradients create circles colored like the desk to look like holes */
  background-image: radial-gradient(circle, var(--desk-bg) 6px, transparent 7px);
  background-size: 100% 4.5rem;
  background-position: center 2rem;
  opacity: 0.95;
  pointer-events: none;
}

/* Binder Spiral Rings (desktop only decoration) */
.notebook-binding {
  position: absolute;
  left: -8px;
  top: 3.5rem;
  bottom: 3.5rem;
  width: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 20;
  pointer-events: none;
}

.ring-loop {
  width: 32px;
  height: 14px;
  background: linear-gradient(to bottom, #d2d6dc 0%, #718096 40%, #2d3748 100%);
  border-radius: 6px;
  box-shadow: 
    0 3px 5px rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
  transform: rotate(-5deg);
}

/* Mobile responsive layout */
@media (max-width: 768px) {
  .desk {
    padding: 0.5rem;
  }
  
  .notebook-container {
    margin: 0;
  }
  
  .notebook-binding {
    display: none;
  }
  
  .notebook-page {
    padding: 2.5rem 1.2rem 2.5rem 2.5rem;
    background-image: 
      linear-gradient(to right, transparent 1.8rem, var(--margin-line) 1.8rem, var(--margin-line) 1.85rem, transparent 1.85rem),
      linear-gradient(to bottom, var(--rule-line) 1px, transparent 1px);
    background-position: 0 0, 0 1.2rem;
  }
  
  .notebook-page::before {
    left: 0.4rem;
    background-image: radial-gradient(circle, var(--desk-bg) 4px, transparent 5px);
    background-size: 100% 4.5rem;
  }
}

/* ==========================================================================
   HEADER & NAVIGATION
   ========================================================================== */

.notebook-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid var(--ink-primary);
  padding-bottom: 0.8rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.site-branding {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.pencil-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.branding-text {
  display: flex;
  flex-direction: column;
}

.site-title {
  font-family: var(--font-typewriter);
  font-size: 1.8rem;
  font-weight: normal;
  text-decoration: none;
  color: var(--ink-primary);
  line-height: 1.1;
}

.site-tagline {
  font-family: var(--font-handwritten);
  font-size: 1.3rem;
  color: var(--pencil-gray);
  margin-top: -0.2rem;
}

.notebook-nav {
  display: flex;
  gap: 0.3rem;
}

.nav-tab {
  display: block;
  text-decoration: none;
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--ink-primary);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  background-color: rgba(0, 0, 0, 0.03);
  position: relative;
  transition: background-color 0.2s, transform 0.1s;
}

/* Slightly shift active tabs down to overlap the header border */
.nav-tab.active {
  background-color: var(--paper-bg);
  font-weight: bold;
  transform: translateY(2px);
  z-index: 5;
  box-shadow: 0 2px 0 var(--paper-bg);
}

.nav-tab:hover:not(.active) {
  background-color: rgba(0, 0, 0, 0.08);
}

/* Tab specific colors for visual identity */
.nav-tab:nth-child(1) { border-top: 3px solid #f28090; } /* Pink/red */
.nav-tab:nth-child(2) { border-top: 3px solid #60a5fa; } /* Blue */
.nav-tab:nth-child(3) { border-top: 3px solid #34d399; } /* Green */

@media (max-width: 580px) {
  .notebook-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .notebook-nav {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   TYPOGRAPHY & CONTENT
   ========================================================================== */

.notebook-body {
  min-height: 40vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-typewriter);
  color: var(--ink-primary);
  font-weight: normal;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.article-title {
  font-size: 2.2rem;
  border-bottom: 1px dotted var(--pencil-gray);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.article-meta {
  font-size: 1.15rem;
  color: var(--pencil-gray);
  margin-bottom: 0.5rem;
}

.handwritten {
  font-family: var(--font-handwritten);
  font-weight: bold;
}

/* Prose formatting */
p {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  text-align: justify;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--ink-blue);
  text-underline-offset: 3px;
  transition: color 0.15s;
}

a:hover {
  color: var(--ink-blue-hover);
}

/* Clean heading spacing in articles */
.article-content h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px dashed var(--pencil-gray);
  padding-bottom: 0.2rem;
}

.article-content h3 {
  font-size: 1.25rem;
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
}

/* Lists */
ul, ol {
  margin-bottom: 1.5rem;
  margin-left: 2rem;
}

li {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* Notebook styling for blockquotes */
blockquote {
  margin: 1.8rem 0;
  padding: 1rem 1.5rem;
  border-left: 3px solid var(--ink-primary);
  background-color: rgba(0, 0, 0, 0.02);
  font-style: italic;
}

blockquote p {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin-bottom: 0;
}

/* Inline scribbles */
.scribble-highlight {
  background-color: hsla(54, 100%, 82%, 0.8);
  padding: 0.1rem 0.3rem;
  border-radius: 2px;
}

/* ==========================================================================
   HOMEPAGE LAYOUT & CUSTOM SECTIONS
   ========================================================================== */

.homepage-layout {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.hero-article {
  border-bottom: 2px dashed var(--ink-primary);
  padding-bottom: 2.5rem;
}

.notebook-index-section h2.section-title {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.notebook-entries-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.entry-bullet {
  font-size: 1.8rem;
  line-height: 1;
  color: var(--margin-line);
}

.entry-headline {
  font-size: 1.25rem;
  margin-bottom: 0.3rem;
}

.entry-headline a {
  text-decoration: none;
  font-family: var(--font-typewriter);
}

.entry-headline a:hover {
  text-decoration: underline;
}

.entry-description {
  font-size: 1rem;
  color: var(--pencil-gray);
  margin-bottom: 0;
}

/* ==========================================================================
   LIST PAGE LAYOUT
   ========================================================================== */

.section-layout {
  display: flex;
  flex-direction: column;
}

.section-main-title {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
}

.section-intro-content {
  border-bottom: 2px dashed var(--ink-primary);
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
}

.notebook-list-entries {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.list-entry-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1.5rem;
}

.entry-meta-date {
  font-size: 1.25rem;
  color: var(--pencil-gray);
  padding-top: 0.1rem;
}

.entry-list-title {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.entry-list-title a {
  text-decoration: none;
}

.entry-list-title a:hover {
  text-decoration: underline;
}

.entry-list-desc {
  font-size: 1.05rem;
  color: var(--pencil-gray);
  margin-bottom: 0;
}

@media (max-width: 580px) {
  .list-entry-item {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .entry-meta-date {
    font-size: 1.05rem;
  }
}

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

.notebook-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px dotted var(--pencil-gray);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.footer-note {
  font-size: 1.4rem;
  color: var(--pencil-gray);
}

.handwritten-scribble {
  font-family: var(--font-handwritten);
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--pencil-gray);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-meta .divider {
  color: var(--margin-line);
}
