/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --color-bg:         #faf9f7;
  --color-text:       #1a1a1a;
  --color-muted:      #888;
  --color-accent:     #1a1a1a;
  --color-border:     #e2ddd8;
  --color-hover:      #555;
  --color-link:       #2a5db0;
  --color-link-hover: #1a3f80;

  --font-serif:       'EB Garamond', Georgia, serif;
  --font-mono:        'SUSE', 'Futura', sans-serif;

  --sidebar-width:    260px;
  --content-max:      680px;
  --sidebar-pad:      2.5rem;
  --content-pad:      3rem;

  --transition:       0.2s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-serif);
  line-height: 1.7;
  display: flex;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul {
  list-style: none;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  border-right: 1px solid var(--color-border);
  background-color: var(--color-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--sidebar-pad);
}

/* Site title */
.site-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.site-tagline {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 0;
  line-height: 1.4;
}

/* Nav */
.sidebar-nav {
  margin-top: 2.5rem;
  flex: 1;
}

.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted);
  display: block;
  padding: 0.35rem 0;
  transition: color var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text);
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
}

.contact-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  transition: color var(--transition);
}

.contact-link:hover {
  color: var(--color-text);
}

/* Mobile toggle (hidden on desktop) */
.menu-toggle {
  display: none;
}

.cv-download-bar {  
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border);
}

.cv-download-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  transition: color var(--transition);
}

.cv-download-link:hover {
  color: var(--color-text);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  padding: var(--content-pad) calc(var(--content-pad) * 1.5);
  flex: 1;
  min-height: 100vh;
}

.main-content > * {
  max-width: var(--content-max);
}

.main-content a {
  color: var(--color-link);
  transition: color var(--transition), text-decoration-color var(--transition);
}

.main-content a:hover {
  color: var(--color-link-hover);
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: 1.9rem; margin-bottom: 1.2rem; }
h2 { font-size: 1.4rem; margin-bottom: 1rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.75rem; margin-top: 1.5rem; }

p {
  margin-bottom: 1.2rem;
}

strong {
  font-weight: 500;
}

em {
  font-style: italic;
}

blockquote {
  border-left: 2px solid var(--color-border);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  color: var(--color-muted);
  font-style: italic;
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.page-title {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  font-weight: 400;
}

.page-content {
  font-size: 1rem;
}

/* ============================================================
   POST LAYOUT
   ============================================================ */
.post-header {
  margin-bottom: 2.5rem;
}

.post-title {
  font-size: 1.7rem;
  margin-bottom: 0.6rem;
  font-weight: 400;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  text-transform: uppercase;
  display: inline-block;
}

.post-publication {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-left: 1rem;
}

.post-content {
  font-size: 1rem;
}

.post-content p + p {
  margin-top: 1.2rem;
}

/* ============================================================
   HOME / INDEX PAGE
   ============================================================ */
.home-intro {
  margin-bottom: 3rem;
}

.home-intro img {
  margin-bottom: 2rem;
  width: 100%;
  max-width: 480px;
}

.home-intro p {
  font-size: 1.05rem;
}

/* Writing list */
.writing-list {
  list-style: none;
  padding: 0;
}

.writing-list li {
  border-top: 1px solid var(--color-border);
  padding: 1rem 0;
}

.writing-list li:last-child {
  border-bottom: 1px solid var(--color-border);
}

.writing-list .item-title {
  font-size: 1rem;
  font-style: italic;
}

.writing-list .item-meta {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
    --content-pad: 1.5rem;
  }

  body {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .sidebar-inner {
    padding: 1.25rem 1.5rem;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .sidebar-header {
    flex: 1;
  }

  .site-tagline {
    display: none;
  }

  .sidebar-nav {
    display: none;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
  }

  .sidebar-nav.open {
    display: block;
  }

  .sidebar-nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }

  .sidebar-footer {
    display: none;
  }

  /* Hamburger button */
  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
  }

  .menu-toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background-color: var(--color-text);
    transition: transform var(--transition), opacity var(--transition);
  }

  .menu-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .main-content {
    margin-left: 0;
    padding: var(--content-pad);
  }
}

/* ============================================================
   PROJECTS LIST
   ============================================================ */
.project-item {
  border-top: 1px solid var(--color-border);
  padding: 1rem 0;
}

.project-item:last-child {
  border-bottom: 1px solid var(--color-border);
}

.project-title {
  font-size: 1rem;
  font-style: italic;
  display: block;
  margin-bottom: 0.2rem;
}

.project-date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--color-muted);
  text-transform: uppercase;
}

.project-description {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0.4rem;
  margin-bottom: 0;
}

/* ============================================================
   CV PAGE
   ============================================================ */

.cv-section {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 1.5rem;
  padding-left: 3rem;
}

.cv-header {
  border-bottom: 3px solid var(--color-border);
  border-top: 2px solid var(--color-border);
  padding-bottom: 0.75rem;
  padding-top: 2rem;
}

/* ============================================================
   CONTACT PAGE
   ============================================================ */

.contact {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-top: 3px solid var(--color-border);
  padding-top: 1rem;
  border-bottom: 3px solid var(--color-border);
  padding-bottom: 1rem;
  font-size: 20px;
}

/* ============================================================
   BACK TO TOP BUTTON
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background-color: var(--color-accent);
  color: var(--color-bg);
  border: 1px solid var(--color-border);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 90;
  opacity: 0.8;
}

.back-to-top:hover {
  opacity: 1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.back-to-top:active {
  transform: translateY(0);
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.25rem;
  }
}

/* Hide back to top on print */
@media print {
  .back-to-top {
    display: none !important;
  }
  
  .sidebar-nav.print-expand {
    display: block !important;
  }
}
