/**
 * ManpageBlog Core Styles
 * Unix manual page aesthetic for cloud-native blog
 */

:root {
  /* Color variables for theming */
  --main-text-color: #000000;
  --main-bg-color: #ffffff;
  --links-color: #0000ee;
  --visited-color: #551a8b;
  --header-color: #000000;
  --code-bg-color: #f4f4f4;

  /* Spacing */
  --content-max-width: 60em;
  --left-margin: 5%;
  --line-height: 1.25em;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Menlo', 'DejaVu Sans Mono', 'Consolas', 'Liberation Mono', monospace;
  font-size: 14px;
  font-weight: 300;
  line-height: var(--line-height);
  color: var(--main-text-color);
  background-color: var(--main-bg-color);
  margin: 0;
  padding: 2em var(--left-margin);
}

/* Main container */
manpage {
  display: block;
  max-width: var(--content-max-width);
  margin: 0;
}

/* Manpage sections */
name, nav, main, footer {
  display: block;
  margin-bottom: 2em;
}

/* NAME section (site header) */
name {
  font-weight: 600;
  font-size: 1.2em;
  margin-bottom: 0.5em;
}

name h1 {
  font-size: inherit;
  font-weight: inherit;
  display: inline;
}

name .subtitle {
  display: block;
  font-weight: 300;
  font-size: 0.9em;
  margin-top: 0.5em;
  font-style: italic;
}

/* Navigation (OPTIONS section) */
nav {
  margin: 2em 0;
}

nav h2 {
  font-weight: 600;
  font-size: 1em;
  margin-bottom: 0.5em;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

nav li {
  display: inline;
}

nav li:before {
  content: '[';
}

nav li:after {
  content: ']';
}

nav a {
  color: var(--links-color);
  text-decoration: none;
}

nav a:hover,
nav a:active {
  text-decoration: underline;
}

/* Main content area */
main {
  margin: 2em 0;
}

main h2 {
  font-weight: 600;
  font-size: 1em;
  margin: 2em 0 1em 0;
  text-transform: uppercase;
}

/* Content styles */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3em;
}

h1 { font-size: 1.4em; margin: 1.5em 0 0.5em 0; }
h2 { font-size: 1.2em; margin: 1.5em 0 0.5em 0; }
h3 { font-size: 1.1em; margin: 1.2em 0 0.5em 0; }
h4, h5, h6 { font-size: 1em; margin: 1em 0 0.5em 0; }

p {
  margin: 1em 0;
}

/* Links */
a {
  color: var(--links-color);
  text-decoration: none;
}

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

a:hover,
a:active {
  text-decoration: underline;
}

/* Code blocks */
pre, code {
  font-family: 'Menlo', 'DejaVu Sans Mono', 'Consolas', 'Liberation Mono', monospace;
  font-size: 0.95em;
}

pre {
  background-color: var(--code-bg-color);
  padding: 1em;
  overflow-x: auto;
  margin: 1em 0;
  border-left: 3px solid var(--main-text-color);
}

code {
  background-color: var(--code-bg-color);
  padding: 0.2em 0.4em;
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Lists */
ul, ol {
  margin: 1em 0;
  padding-left: 2em;
}

li {
  margin: 0.5em 0;
}

/* Blockquotes */
blockquote {
  margin: 1em 0;
  padding-left: 1em;
  border-left: 3px solid var(--main-text-color);
  font-style: italic;
}

/* Blog post list */
.post-list {
  list-style: none;
  padding: 0;
}

.post-item {
  margin: 2em 0;
  padding-bottom: 1em;
  border-bottom: 1px solid var(--main-text-color);
}

.post-item:last-child {
  border-bottom: none;
}

.post-title {
  font-weight: 600;
  font-size: 1.1em;
  margin-bottom: 0.3em;
}

.post-title a {
  color: var(--main-text-color);
  text-decoration: underline;
}

.post-meta {
  font-style: italic;
  font-size: 0.9em;
  margin-bottom: 0.5em;
  opacity: 0.8;
}

.post-summary {
  margin: 0.5em 0;
}

.read-more {
  display: inline-block;
  margin-top: 0.5em;
}

/* Pagination */
.pagination {
  margin: 2em 0;
  text-align: center;
}

.pagination a {
  margin: 0 0.5em;
}

/* Tags/Keywords */
.tags {
  margin: 1em 0;
}

.tags h2 {
  text-transform: uppercase;
  font-size: 1em;
  margin-bottom: 0.5em;
}

.tag {
  display: inline-block;
  margin-right: 0.5em;
  padding: 0.2em 0.5em;
  background-color: var(--code-bg-color);
}

/* Footer */
footer {
  margin-top: 4em;
  padding-top: 1em;
  border-top: 1px solid var(--main-text-color);
  font-size: 0.9em;
  opacity: 0.7;
}

/* Manpage header (page titles) */
.manpage-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 1em;
}

.manpage-header .left,
.manpage-header .center,
.manpage-header .right {
  flex: 1;
}

.manpage-header .center {
  text-align: center;
}

.manpage-header .right {
  text-align: right;
}

/* Date formatting */
.date {
  font-style: italic;
  font-size: 0.9em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95em;
}

th, td {
  padding: 0.5em 0.75em;
  text-align: left;
  border: 1px solid var(--main-text-color);
}

th {
  font-weight: 600;
  background-color: var(--code-bg-color);
  text-transform: uppercase;
  font-size: 0.9em;
}

tbody tr:nth-child(even) {
  background-color: var(--code-bg-color);
}

/* Make tables scrollable on small screens */
@media (max-width: 768px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em 0;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--main-text-color);
  margin: 2em 0;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    font-size: 13px;
    padding: 1em 3%;
  }

  nav ul {
    flex-direction: column;
    gap: 0.5em;
  }

  .manpage-header {
    flex-direction: column;
    text-align: center;
  }

  .manpage-header .left,
  .manpage-header .center,
  .manpage-header .right {
    text-align: center;
  }
}

/* Print styles */
@media print {
  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  pre {
    page-break-inside: avoid;
  }
}
