/* ========================================
   Sapek - my website
   ======================================== */

/* --- Font Faces --- */
@font-face {
  font-family: 'Ouvrieres';
  src: url('/fonts/Ouvrieres-rassasiees.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* --- CSS Variables --- */
:root {
  /* Light theme (default) */
  --color-fg: #382b26;
  --color-bg: #b8c2b9;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;

  /* Typography */
  --font-display: 'Ouvrieres', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;

  --line-height: 1.7;
  --max-width: 42rem;
}

/* --- Theme Toggle --- */
html[data-theme="dark"] {
  --color-fg: #b8c2b9;
  --color-bg: #382b26;
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  color: var(--color-fg);
  background-color: var(--color-bg);
  min-height: 100vh;
}

.page-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  color: var(--color-fg);
  background-color: var(--color-bg);
}

/* --- Links --- */
a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-style: double;
}

/* --- Top Bar --- */
.top-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  font-size: 1.1rem;
  border-bottom: 2px solid var(--color-fg);
}

.nav-main {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
  text-decoration-style: double;
}

.nav-active {
  text-decoration: underline;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.visitor-count {
  font-size: 0.9rem;
  opacity: 0.8;
}

.theme-toggle-btn {
  cursor: pointer;
  text-decoration: none;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  padding: 0;
}

.theme-toggle-btn:hover {
  text-decoration: underline;
  text-decoration-style: double;
}

/* --- Tagline --- */
.tagline {
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
}

.tagline-bookend {
  display: inline-block;
  margin: 0 var(--space-sm);
  font-size: 0.8em;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

/* --- Home Page --- */
.home-content {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 40vh;
}

.home-portrait {
  text-align: center;
}

.portrait-placeholder {
  font-size: 8rem;
  line-height: 1;
  opacity: 0.5;
}

/* --- Article (single) --- */
.article-header {
  margin-bottom: var(--space-xl);
  text-align: center;
}

.article-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: normal;
  margin-bottom: var(--space-sm);
}

.article-meta {
  font-size: 0.9rem;
  opacity: 0.8;
}

.article-meta .separator {
  margin: 0 var(--space-sm);
  opacity: 0.5;
}

.article-content {
  margin-bottom: var(--space-xl);
}

.article-content h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: normal;
  margin: var(--space-xl) 0 var(--space-md);
}

.article-content h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: normal;
  margin: var(--space-lg) 0 var(--space-md);
}

.article-content p {
  margin-bottom: var(--space-md);
}

.article-content ul,
.article-content ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.article-content li {
  margin-bottom: var(--space-xs);
}

.article-content blockquote {
  border-left: 3px solid var(--color-fg);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  font-style: italic;
  opacity: 0.9;
}

.article-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-fg);
  color: var(--color-bg);
  padding: 0.1em 0.3em;
  border-radius: 2px;
}

.article-content pre {
  background: var(--color-fg);
  color: var(--color-bg);
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-lg) 0;
}

.article-content pre code {
  background: none;
  padding: 0;
}

.article-footer {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-fg);
}

.article-categories a {
  margin-right: var(--space-sm);
  text-decoration: none;
}

/* --- Article List --- */
.list-section {
  max-width: var(--max-width);
}

.list-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: normal;
  margin-bottom: var(--space-lg);
}

.list-description {
  margin-bottom: var(--space-xl);
  opacity: 0.9;
}

.article-list {
  list-style: none;
}

.article-list-item {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-fg);
}

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

.article-list-link {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-decoration: none;
  display: block;
  margin-bottom: var(--space-xs);
}

.article-list-link:hover {
  text-decoration: underline;
  text-decoration-style: double;
}

.article-list-date {
  font-size: 0.9rem;
  opacity: 0.7;
  display: block;
  margin-bottom: var(--space-sm);
}

.article-list-desc {
  font-size: 0.95rem;
  opacity: 0.9;
}

.article-list-empty {
  font-style: italic;
  opacity: 0.7;
}

/* --- Bottom Bar (flipped) --- */
.bottom-bar {
  border-top: 2px solid var(--color-fg);
}

.bottom-bar-inner {
  transform: rotate(180deg);
  padding: var(--space-md) var(--space-lg);
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.bottom-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-xs);
}

.bottom-links a {
  text-decoration: none;
}

.bottom-links a:hover {
  text-decoration: underline;
}

.bottom-links .separator {
  opacity: 0.5;
  margin: 0 var(--space-xs);
}

.post-nav {
  display: flex;
  gap: var(--space-xs);
}

.post-nav a {
  text-decoration: none;
}

.post-nav a:hover {
  text-decoration: underline;
}

.nav-disabled {
  opacity: 0.4;
}

.cookie-notice {
  font-size: 0.8rem;
  opacity: 0.6;
  text-align: center;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .top-bar-right {
    width: 100%;
    justify-content: center;
  }

  .nav-main {
    justify-content: center;
  }

  .main-content {
    padding: var(--space-lg) var(--space-md);
  }

  .article-title {
    font-size: 1.6rem;
  }

  .bottom-bar-inner {
    padding: var(--space-sm) var(--space-md);
  }
}
