/*
Theme Name: Sergiu Bejenari
Theme URI: https://sergiubejenari.md
Author: Sergiu Bejenari
Description: Temă editorială minimalistă pentru blog personal. Tipografie Fraunces + IBM Plex Sans, paletă crem cu accent oliv.
Version: 1.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sergiu-bejenari
*/

/* ==============================================
   Sergiu Bejenari — Tema WordPress
   ============================================== */

:root {
  --bg: #F6F1E8;
  --bg-alt: #EDE7DB;
  --text: #1A1815;
  --text-mid: #56524A;
  --text-soft: #8A8578;
  --accent: #3F4A2C;
  --accent-hover: #566640;
  --accent-soft: rgba(63, 74, 44, 0.08);
  --rule: #D4CDBE;
  --rule-light: #E5DFD2;

  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  --content-width: 640px;
  --wide-width: 760px;
}

/* ==============================================
   Reset și baze
   ============================================== */

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

html {
  font-size: 18px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-weight: 350;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 0 0.05 0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: -1;
}

/* ==============================================
   Bara de progres la lectură
   ============================================== */

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s linear;
}

/* ==============================================
   Antet (Header)
   ============================================== */

.site-header {
  padding: 4rem 2rem 2.5rem;
  text-align: center;
  animation: fadeDown 0.7s ease-out;
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.site-name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-variation-settings: 'opsz' 144, 'SOFT' 30;
  letter-spacing: -0.015em;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}

.site-name-ornament {
  display: block;
  margin: 1.2rem auto 0.9rem;
  width: 48px;
  height: 10px;
  color: var(--accent);
}

.site-name-ornament svg {
  width: 100%;
  height: 100%;
  display: block;
}

.site-tagline {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* ==============================================
   Navigație
   ============================================== */

.site-nav {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 1.2rem 2rem;
  border-top: 1px solid var(--rule-light);
  border-bottom: 1px solid var(--rule-light);
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 3rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
  text-decoration: none;
  padding: 0.15rem 0;
  position: relative;
  transition: color 0.25s ease;
}

.site-nav a:hover,
.site-nav .current-menu-item a,
.site-nav a.active {
  color: var(--text);
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
  transform: translateX(-50%);
}

.site-nav a:hover::after,
.site-nav .current-menu-item a::after,
.site-nav a.active::after {
  width: 100%;
}

/* ==============================================
   Layout cu sidebar
   ============================================== */

main {
  flex: 1;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 4rem;
  align-items: start;
}

.main-col {
  min-width: 0;
}

.content {
  max-width: var(--content-width);
  margin: 0;
  padding: 0;
}

.sidebar {
  padding-top: 3rem;
  font-family: var(--sans);
}

/* ==============================================
   Lista eseurilor
   ============================================== */

.essays {
  padding: 1rem 0 2rem;
}

.essay-item {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--rule-light);
  animation: fadeUp 0.5s ease-out both;
}

.essay-item:nth-child(1) { animation-delay: 0.05s; }
.essay-item:nth-child(2) { animation-delay: 0.12s; }
.essay-item:nth-child(3) { animation-delay: 0.19s; }
.essay-item:nth-child(4) { animation-delay: 0.26s; }
.essay-item:nth-child(5) { animation-delay: 0.33s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.essay-number {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.essay-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin-bottom: 0.7rem;
}

.essay-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.25s ease;
}

.essay-title a:hover {
  color: var(--accent);
}

.essay-excerpt {
  font-size: 0.95rem;
  font-weight: 350;
  line-height: 1.75;
  color: var(--text-mid);
  margin-bottom: 0.9rem;
}

.essay-meta {
  font-family: var(--sans);
  font-size: 0.74rem;
  font-weight: 400;
  color: var(--text-soft);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.essay-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rule);
}

.essay-item.first .essay-title {
  font-size: 2rem;
  line-height: 1.22;
}

.essay-item.first .essay-excerpt {
  font-size: 1rem;
}

/* Paginare */
.pagination {
  padding: 2rem 0 1rem;
  font-family: var(--sans);
  font-size: 0.82rem;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 0.4rem 0.8rem;
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.25s ease;
  border: 1px solid transparent;
}

.pagination a:hover {
  color: var(--accent);
  border-color: var(--rule);
}

.pagination .current {
  color: var(--text);
  border-color: var(--rule);
}

/* ==============================================
   Articol
   ============================================== */

.article {
  padding: 3rem 0 5rem;
  animation: fadeUp 0.5s ease-out;
}

.article-header {
  margin-bottom: 3rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--rule-light);
}

.article-number {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.8rem;
}

.article-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 1rem;
}

.article-subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--text-mid);
  margin-bottom: 1.2rem;
}

.article-meta {
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.article-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--rule);
}

.article-body {
  font-size: 1.02rem;
  font-weight: 350;
  line-height: 1.85;
  color: var(--text);
}

.article-body p {
  margin-bottom: 1.5rem;
}

/* Drop cap la primul paragraf */
.article-body > p:first-of-type::first-letter {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 4rem;
  line-height: 0.9;
  float: left;
  margin: 0.5rem 0.6rem 0 0;
  color: var(--accent);
  font-variation-settings: 'opsz' 144;
}

.article-body h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 3rem 0 1rem;
  color: var(--text);
}

.article-body h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: 1.15rem;
  margin: 2rem 0 0.8rem;
  color: var(--text);
}

.article-body blockquote {
  margin: 2.5rem 0;
  padding: 1.5rem 1.8rem;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--text-mid);
}

.article-body blockquote cite {
  display: block;
  margin-top: 0.8rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}

.article-body em { font-style: italic; }
.article-body strong { font-weight: 600; }

.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.25s ease;
}

.article-body a:hover {
  color: var(--accent-hover);
}

/* Imagini în articole */
.article-body img,
.article-body .wp-block-image img {
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
  border-radius: 2px;
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figcaption,
.wp-block-image figcaption {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-soft);
  text-align: center;
  margin-top: 0.6rem;
  font-style: italic;
}

/* Video embeds (YouTube, Vimeo etc.) */
.article-body .wp-block-embed,
.article-body iframe {
  margin: 2rem 0;
  max-width: 100%;
}

.article-body .wp-block-embed__wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}

.article-body .wp-block-embed__wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}

/* Liste */
.article-body ul,
.article-body ol {
  margin: 0 0 1.5rem 1.5rem;
  padding: 0;
}

.article-body li {
  margin-bottom: 0.4rem;
}

/* Cod */
.article-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-alt);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.article-body pre {
  font-family: var(--mono);
  background: var(--bg-alt);
  padding: 1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: 3px;
}

/* Separator § */
.section-break,
.wp-block-separator {
  display: block;
  text-align: center;
  margin: 3rem auto;
  font-family: var(--serif);
  font-size: 1.3rem;
  color: var(--accent);
  letter-spacing: 1em;
  border: none;
  background: transparent;
}

.wp-block-separator:before {
  content: '§';
}

/* Footer articol */
.article-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-light);
  text-align: center;
}

.article-footer .back-link {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.article-footer .back-link:hover {
  color: var(--accent);
}

/* Navigare între articole */
.post-navigation {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-light);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  font-family: var(--sans);
  font-size: 0.82rem;
}

.post-navigation a {
  color: var(--text-mid);
  text-decoration: none;
  transition: color 0.25s ease;
}

.post-navigation a:hover {
  color: var(--accent);
}

.post-navigation .nav-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 0.3rem;
  display: block;
}

.post-navigation .nav-next {
  text-align: right;
}

/* ==============================================
   Pagina Despre (page template)
   ============================================== */

.about {
  padding: 4rem 0 5rem;
  animation: fadeUp 0.5s ease-out;
}

.about-intro {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 1.6rem;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 1.2rem;
  letter-spacing: -0.01em;
}

.about-text {
  font-size: 1rem;
  font-weight: 350;
  line-height: 1.8;
  color: var(--text-mid);
  margin-bottom: 1rem;
}

.about-links {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule-light);
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.about-links a {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s ease;
}

.about-links a:hover {
  color: var(--accent-hover);
}

/* ==============================================
   Sidebar & Widget Compatibility
   ============================================== */

.sidebar-block,
.sidebar .widget {
  margin-bottom: 2.5rem;
}

.sidebar-title,
.sidebar .widget-title,
.sidebar .widget h2 {
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 0.9rem;
}

.sidebar-text,
.sidebar .widget p,
.sidebar .textwidget p {
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 350;
  line-height: 1.65;
  color: var(--text-mid);
  margin-bottom: 0.6rem;
}

.sidebar a,
.sidebar-text a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.2s ease;
}

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

/* Widget liste */
.sidebar ul,
.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li,
.sidebar-links li {
  margin-bottom: 0.5rem;
}

.sidebar li a,
.sidebar-links a {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.sidebar li a:hover,
.sidebar-links a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Formular newsletter (dacă e adăugat manual) */
.newsletter-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.newsletter-form input[type="email"] {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 350;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

.newsletter-form input[type="email"]:focus {
  border-color: var(--accent);
}

.newsletter-form button {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.7rem 0.8rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.newsletter-form button:hover {
  background: var(--accent-hover);
}

/* Câmp de căutare */
.search-form {
  display: flex;
  gap: 0.5rem;
}

.search-form input[type="search"] {
  font-family: var(--sans);
  font-size: 0.88rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--text);
  outline: none;
  flex: 1;
}

.search-form input[type="search"]:focus {
  border-color: var(--accent);
}

.search-form button {
  font-family: var(--sans);
  font-size: 0.75rem;
  padding: 0.5rem 0.8rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  cursor: pointer;
}

/* ==============================================
   Subsol
   ============================================== */

.site-footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--rule-light);
  margin-top: 2rem;
}

.site-footer p {
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ==============================================
   Buton comutare temă (dark mode)
   ============================================== */

.theme-toggle {
  position: fixed;
  bottom: 1.8rem;
  right: 1.8rem;
  width: 38px;
  height: 38px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-mid);
  transition: all 0.3s ease;
  z-index: 100;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}

/* ==============================================
   Mod întunecat
   ============================================== */

body.dark {
  --bg: #14120F;
  --bg-alt: #1C1A16;
  --text: #EDE7DB;
  --text-mid: #A8A298;
  --text-soft: #6E6860;
  --accent: #9BB370;
  --accent-hover: #B0C987;
  --accent-soft: rgba(155, 179, 112, 0.08);
  --rule: #2A2824;
  --rule-light: #221F1B;
}

body.dark::before {
  opacity: 0.25;
}

/* ==============================================
   Admin bar WordPress
   ============================================== */

body.admin-bar .theme-toggle {
  bottom: calc(1.8rem + 32px);
}

/* ==============================================
   Responsiv
   ============================================== */

@media (max-width: 860px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 2rem 3rem;
  }

  .sidebar {
    padding-top: 2.5rem;
    margin-top: 2.5rem;
    border-top: 1px solid var(--rule-light);
  }

  .post-navigation {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .post-navigation .nav-next {
    text-align: left;
  }
}

@media (max-width: 680px) {
  html { font-size: 17px; }

  .site-header {
    padding: 2.5rem 1.3rem 1.8rem;
  }

  .site-nav {
    gap: 1.8rem;
    padding: 1rem 1.3rem;
  }

  .site-nav ul {
    gap: 1.8rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .content,
  .wrap {
    padding: 0 1.3rem 3rem;
  }

  .essay-item.first .essay-title {
    font-size: 1.6rem;
  }

  .essay-title {
    font-size: 1.35rem;
  }

  .article-body > p:first-of-type::first-letter {
    font-size: 3.2rem;
  }

  .article-body blockquote {
    padding: 1.2rem 1.3rem;
    font-size: 1rem;
  }

  .about-intro {
    font-size: 1.3rem;
  }

  .theme-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 34px;
    height: 34px;
  }
}

/* ==============================================
   Print
   ============================================== */

@media print {
  body { background: white; color: black; }
  body::before { display: none; }
  .site-nav, .theme-toggle, .progress-bar, .site-footer, .sidebar { display: none; }
  .wrap { grid-template-columns: 1fr; }
  .article-body { font-size: 11pt; }
}

/* ==============================================
   Utilitare WordPress
   ============================================== */

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

.alignleft { float: left; margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { display: block; margin: 1rem auto; }

.sticky {}
.gallery-caption {}
.bypostauthor {}
