/* ============================================
   Blog CSS Stylesheet
   ============================================ */

/* Base & Typography */
:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f7f7f7;
  --color-text: #1d1d1d;
  --color-text-secondary: #58585b;
  --color-accent: #3B5998;
  --color-accent-hover: #2D4373;
  --color-border: #d4d4d4;
  --color-code-bg: #f4f4f4;
  --color-shadow: rgba(0, 0, 0, 0.06);
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "CiscoSans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-weight: 400;
}

/* Container */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header & Navigation */
header {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px var(--color-shadow);
}

header nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  align-items: center;
}

nav a {
  color: var(--color-text);
  text-decoration: none;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
  border-bottom: 3px solid transparent;
}

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

nav a.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}


/* Typography */
h1 {
  font-size: 2.75rem;
  line-height: 1.15;
  margin: 0 0 1.5rem 0;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

h2 {
  font-size: 2rem;
  line-height: 1.25;
  margin: 3rem 0 1.5rem 0;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--color-text);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-accent);
}

h2:first-of-type {
  margin-top: 2rem;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.4;
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  color: var(--color-text);
}

p {
  margin: 0 0 1.25rem 0;
  line-height: 1.7;
}

/* Links */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
}

/* Date & Meta */
.date {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  margin-bottom: 2rem;
  display: block;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Lists */
ul, ol {
  margin: 0 0 1.5rem 0;
  padding-left: 2rem;
  line-height: 1.7;
}

li {
  margin-bottom: 0.75rem;
}

/* Code */
code {
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.875em;
  background: var(--color-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: #c7254e;
  border: 1px solid #e1e1e1;
}

pre {
  position: relative;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
  font-size: 0.875rem;
  border: none;
}

/* Copy Button */
.copy-button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: white;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-button:hover {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem 0;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
}

thead {
  background: var(--color-bg-alt);
  border-bottom: 2px solid var(--color-border);
}

th, td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:hover {
  background: var(--color-bg-alt);
}

/* Image styling */
article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--color-shadow);
  border: 1px solid var(--color-border);
}

/* Prevent images from being too large on wide screens */
article img {
  max-width: 900px;
}

/* Gallery grid layout */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
  margin: 2rem 0;
  grid-auto-rows: 220px;
}

.gallery > p {
  display: contents;
}

article .gallery img {
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 4px;
  box-shadow: 0 2px 8px var(--color-shadow);
  border: 1px solid var(--color-border);
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
  object-fit: cover;
  object-position: center;
}

article .gallery img:hover {
  opacity: 0.9;
}

@media (max-width: 1024px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    grid-auto-rows: 200px;
  }
}

@media (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 180px;
  }
}

@media (max-width: 480px) {
  .gallery {
    grid-template-columns: 1fr;
    grid-auto-rows: 250px;
  }
}



/* Lightbox modal */
.lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  cursor: pointer;
  animation: fadeIn 0.3s;
}

.lightbox.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox img {
  max-width: 95%;
  max-height: 95%;
  object-fit: contain;
  border: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 40px;
  color: white;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10000;
}

.lightbox-close:hover {
  color: #ccc;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}


/* Task Lists */
ul.task-list {
  list-style-type: none;
  padding-left: 0;
}

ul.task-list li {
  position: relative;
  padding-left: 2rem;
}

ul.task-list input[type="checkbox"] {
  position: absolute;
  left: 0;
  top: 0.25rem;
  margin: 0;
  width: 1.125rem;
  height: 1.125rem;
  cursor: default;
}

/* Recipe Scaler Styling */
.recipe-scaler {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: 4px;
  padding: 1.5rem;
  margin: 2rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.recipe-scaler label {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 220px;
  font-size: 0.9375rem;
}

.recipe-scaler select {
  min-width: 160px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: 0.9375rem;
  background: white;
  cursor: pointer;
  font-family: inherit;
}

.recipe-scaler input[type="number"] {
  width: 90px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-accent);
  text-align: center;
  background: white;
  font-family: inherit;
}

.recipe-scaler #ingredient-unit {
  font-weight: 600;
  color: var(--color-accent);
}

.recipe-scaler button {
  padding: 0.625rem 1.5rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 3px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.recipe-scaler button:hover {
  background: var(--color-accent-hover);
}

.recipe-scaler button#reset-recipe {
  background: var(--color-text-secondary);
}

.recipe-scaler button#reset-recipe:hover {
  background: var(--color-text);
}

/* List Page Styling (Index & Category Pages) */
.list-page {
  display: block;
}

.list-page h1 {
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

/* Post Item - Cisco blog-style cards */
.post-item {
  background: white;
  padding: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1.5rem;
  transition: all 0.2s ease;
}

.post-item:hover {
  border-bottom-color: var(--color-accent);
}

.post-item h3 {
  margin: 0 0 0.75rem 0;
  font-size: 1.375rem;
  font-weight: 400;
  line-height: 1.3;
}

.post-item h3 a {
  color: var(--color-text);
  font-weight: 400;
  text-decoration: none;
}

.post-item h3 a:hover {
  color: var(--color-accent);
  text-decoration: none;
}

.post-item p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* View More button */
.view-more {
  margin: 2rem 0 3rem 0;
}

.view-more a {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: 3px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Multi-column grid for larger screens */
@media (min-width: 900px) {
  .list-page h2 ~ .post-item:nth-of-type(2n+1) {
    clear: left;
  }
  
  .list-page h2 + .post-item,
  .list-page .post-item + .post-item {
    width: calc(50% - 1rem);
    float: left;
    margin-right: 2rem;
  }
  
  .list-page .post-item:nth-child(even) {
    margin-right: 0;
  }
  
  .list-page .view-more,
  .list-page h2 {
    clear: both;
    width: 100%;
  }
  
  .list-page::after {
    content: "";
    display: table;
    clear: both;
  }
}


.view-more a:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px var(--color-shadow);
}

/* Hide horizontal rules */
.list-page hr {
  display: none;
}

/* Article Spacing */
article {
  margin-bottom: 3rem;
}

article:not(.list-page) {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Footer */
footer {
  margin-top: 5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-alt);
}

footer p {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  main {
    padding: 1.5rem 1rem;
  }
  
  header nav {
    padding: 0 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
  }
  
  h3 {
    font-size: 1.125rem;
  }
  
  .post-item h3 {
    font-size: 1.25rem;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }
  
  nav a {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.375rem;
  }
  
  pre {
    padding: 1rem;
  }
  
  table {
    font-size: 0.875rem;
  }
  
  th, td {
    padding: 0.625rem 0.75rem;
  }
  
  .recipe-scaler {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem;
  }
  
  .recipe-scaler label {
    min-width: 100%;
  }
  
  .recipe-scaler select,
  .recipe-scaler button {
    width: 100%;
  }
  
  .post-item {
    padding-bottom: 1.25rem;
    margin-bottom: 1.5rem;
  }
  
  footer {
    margin-top: 3rem;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1d1d1d;
    --color-bg-alt: #2a2a2a;
    --color-text: #e8e8e8;
    --color-text-secondary: #b8b8b8;
    --color-accent: #049fd9;
    --color-accent-hover: #36b5e5;
    --color-border: #404040;
    --color-code-bg: #2a2a2a;
    --color-shadow: rgba(0, 0, 0, 0.3);
  }
  
  header {
    background: var(--color-bg);
  }
  
  code {
    color: #f92672;
    border-color: var(--color-border);
  }
  
  .copy-button {
    background: var(--color-bg-alt);
    color: var(--color-text-secondary);
  }
  
  .copy-button:hover {
    background: var(--color-accent);
    color: white;
  }
  
  .recipe-scaler select,
  .recipe-scaler input[type="number"] {
    background: var(--color-bg);
    color: var(--color-text);
  }
  
  .post-item {
    background: var(--color-bg);
  }
  
  table {
    background: var(--color-bg);
  }
}

/* Print Styles */
@media print {
  body {
    font-size: 11pt;
    color: black;
    background: white;
  }
  
  header {
    position: static;
    box-shadow: none;
  }
  
  .copy-button,
  .recipe-scaler,
  nav,
  footer {
    display: none;
  }
  
  a {
    color: black;
    text-decoration: underline;
  }
  
  pre {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  
  .post-item {
    page-break-inside: avoid;
  }
  
  h2 {
    page-break-after: avoid;
  }
}

