/* Modernized CSS - Option 3: Full Modern Redesign */
/* Complete redesign with CSS Grid, modern layout, enhanced styling */

:root {
  /* Modern color palette */
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #252525;
  --text-primary: #f0f0f0;
  --text-secondary: #c0c0c0;
  --text-muted: #888888;
  --accent: #8b5cf6;
  --accent-hover: #a78bfa;
  --accent-light: #c4b5fd;
  --link: #60a5fa;
  --link-visited: #a78bfa;
  --link-hover: #f87171;
  --border: #2a2a2a;
  --border-light: #3a3a3a;
  --table-border: #2a2a2a;
  --table-hover: #1f1f1f;
  --good: #86efac;
  --bad: #fca5a5;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100.01%;
  scroll-behavior: smooth;
}

body {
  font-size: 1em;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  background-attachment: fixed;
  line-height: 1.7;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

#container {
  max-width: 900px;
  position: relative;
  width: 95%;
  margin: 0 auto;
  padding: 0.5em 1em;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2em;
}

#main {
  padding: 1em 0;
}

/* Typography */
h1 {
  padding-left: 0.3em;
  color: var(--text-primary);
  letter-spacing: -2px;
  font-family: Georgia, "Times New Roman", Times, serif;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5em;
  margin-bottom: 1em;
  font-size: 2.5em;
  font-weight: 300;
}

h2 {
  color: var(--accent);
  letter-spacing: -1px;
  font-style: italic;
  margin-top: 2em;
  margin-bottom: 1em;
  font-size: 1.8em;
  font-weight: 400;
  border-left: 4px solid var(--accent);
  padding-left: 0.5em;
}

h3 {
  color: var(--text-secondary);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.3em;
  margin-left: 1em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  font-weight: 400;
}

h4 {
  color: var(--text-muted);
  font-style: italic;
  font-size: 1.1em;
  margin-top: 1em;
}

/* Navigation - Modern horizontal bar */
#navbar {
  padding: 0;
  margin: 0 0 1em 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

/* Reduce spacing from navbar paragraph breaks */
#navbar + p {
  margin: 0;
  line-height: 0;
}

#navbar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
}

#navbar li {
  margin: 0;
  flex: 1;
  min-width: 0;
}

#navbar li a {
  font-weight: 500;
  display: block;
  padding: 1em 1.5em;
  color: var(--text-secondary);
  text-align: center;
  text-transform: lowercase;
  transition: all 0.3s ease;
  border-bottom: 3px solid transparent;
  position: relative;
  z-index: 1;
}

#navbar li a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-tertiary);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

#navbar li a:hover {
  color: var(--accent-hover);
  border-bottom-color: var(--accent-light);
}

#navbar li a:hover::before {
  opacity: 0.5;
}

#navbar li a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--bg-tertiary);
  font-weight: 600;
}

#navbar li a span {
  position: relative;
  z-index: 1;
}

/* Links */
a {
  color: var(--link);
  text-decoration: none;
  transition: all 0.2s ease;
  border-bottom: 1px solid transparent;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

/* Paragraphs */
p {
  max-width: 70ch;
  margin: 1.5em 0;
  margin-left: 2em;
  line-height: 1.8;
  color: var(--text-secondary);
}

/* Images */
img {
  margin: 2em 0;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* All charts - match table width */
img.filmsseen,
img.chart-1001,
img:not(.chart-1001) {
  width: 100%;
  max-width: 100%;
  margin: 2em 0;
  display: block;
}





/* Tables - Modern card-like design */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 2em 0;
  font-size: 0.95em;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
  
}

td, th {
  padding: 0.5em 1em;
  line-height: 1.3;
  text-align: right;
  border-bottom: 1px solid var(--table-border);
}

th {
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  position: sticky;
  top: 0;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--accent);
}

tr {
  transition: background-color 0.2s ease;
}

tr:hover {
  background-color: var(--table-hover);
}

tr:last-child td {
  border-bottom: none;
}

td.good {
  color: var(--good);
  font-weight: 600;
}

td.bad {
  color: var(--bad);
  font-weight: 600;
}

td.year {
  color: var(--text-muted);
  font-weight: 400;
}

/* Utility classes */
.date, .note {
  font-size: 0.9em;
  color: var(--text-muted);
  font-style: italic;
}

.tags {
  font-size: 0.9em;
  color: var(--text-muted);
}

.code {
  font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
  margin-left: 2em;
  background: var(--bg-tertiary);
  padding: 0.4em 0.8em;
  border-radius: 4px;
  border-left: 3px solid var(--accent);
  font-size: 0.9em;
}

.parenthetical {
  color: var(--text-muted);
  font-style: italic;
}

.text li {
  margin-bottom: 1.2em;
  padding-left: 0.5em;
}

#list li {
  padding: 0.75em 0;
  border-bottom: 1px solid var(--table-border);
  transition: padding-left 0.2s ease;
}

#list li:hover {
  padding-left: 0.5em;
  background: var(--bg-secondary);
  border-radius: 4px;
}

address {
  margin-top: 3em;
  padding-top: 1.5em;
  border-top: 2px dotted var(--border);
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.9em;
}

/* Index list */
UL.index {
  margin: 3em auto;
  text-align: center;
  max-width: 400px;
  font-size: 1.8em;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1em;
}

UL.index li {
  background: var(--bg-secondary);
  padding: 1em;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px var(--shadow);
}

UL.index li:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-lg);
  background: var(--bg-tertiary);
}

a.archive {
  margin-left: 1em;
}

/* Tag cloud - Modern pill design */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin: 1em 0;
}

.tag-cloud LI {
  display: inline-block;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin: 0;
  padding: 0.4em 1em;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px var(--shadow);
}

.tag-cloud LI:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

.tag-cloud SPAN {
  position: absolute;
  left: -999px;
  width: 990px;
}

.tag-cloud .active {
  color: var(--accent);
  background: var(--bg-tertiary);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--accent-light);
}

.tag-cloud .not-popular { font-size: 0.75em; padding: 0.3em 0.8em; }
.tag-cloud .not-very-popular { font-size: 0.85em; padding: 0.35em 0.85em; }
.tag-cloud .somewhat-popular { font-size: 0.95em; padding: 0.4em 0.9em; }
.tag-cloud .popular { font-size: 1.05em; padding: 0.45em 1em; }
.tag-cloud .very-popular { font-size: 1.15em; padding: 0.5em 1.1em; }
.tag-cloud .ultra-popular { font-size: 1.25em; padding: 0.55em 1.2em; font-weight: 600; }

/* Feed */
.feed {
  border: 0;
  vertical-align: middle;
  margin: 0;
}

/* Responsive design */
@media (max-width: 1024px) {
  #container {
    width: 98%;
    padding: 1.5em 0.5em;
  }
  
  h1 {
    font-size: 2em;
  }
  
  h2 {
    font-size: 1.5em;
  }
}

@media (max-width: 768px) {
  #container {
    width: 100%;
    padding: 1em 0.5em;
    gap: 1em;
  }
  
  #navbar ul {
    flex-direction: column;
  }
  
  #navbar li {
    flex: none;
  }
  
  #navbar li a {
    padding: 0.5em 1em;
  line-height: 1.3;
    border-bottom: 2px solid var(--border);
    border-left: 4px solid transparent;
  }
  
  #navbar li a.active {
    border-left-color: var(--accent);
  }
  
}
  
  table {
    font-size: 0.85em;
    display: block;
    overflow-x: auto;
  }
  /* Enhanced mobile table readability */
  td, th {
    padding: 0.75em 0.5em;
    white-space: nowrap;
    font-size: 0.9em;
  }
  
  /* Card layout for very small screens */
  @media (max-width: 480px) {
    table, thead, tbody, th, td, tr {
      display: block;
    }
    
    thead tr {
      position: absolute;
      top: -9999px;
      left: -9999px;
    }
    
    tr {
      border: 1px solid var(--table-border);
      border-radius: 4px;
      margin-bottom: 1em;
      padding: 0.5em;
      background: var(--bg-secondary);
    }
    
    td {
      border: none;
      position: relative;
      padding-left: 40%;
      padding-top: 0.5em;
      padding-bottom: 0.5em;
      text-align: left;
      white-space: normal;
    }
    
    td:before {
      content: attr(data-label);
      position: absolute;
      left: 0.5em;
      width: 35%;
      font-weight: 600;
      color: var(--text-secondary);
    }
  }
  
  td, th {
    padding: 0.5em 0.75em;
    white-space: nowrap;
  }
  
  UL.index {
    grid-template-columns: 1fr;
    font-size: 1.5em;
  }
  
  h1 {
    font-size: 1.8em;
  }
  
  h2 {
    font-size: 1.3em;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.95em;
  }
  
  table {
    font-size: 0.75em;
  }
  
  #navbar li a {
    padding: 0.6em 0.8em;
    font-size: 0.9em;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  #navbar {
    display: none;
  }
  
}
  
  table {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
