:root {
  color-scheme: light dark;
  --bg: #fdfaea;
  --fg: #000000;
  --muted: #828282;
  --link: #c70039;
  --border: #ffa366;
  --soft: rgba(199, 0, 57, 0.05);
  --strong: #6a0a3a;
}

:root[data-theme="dark"] {
  --bg: #111418;
  --fg: #e6edf3;
  --muted: #a1aab8;
  --link: #2698ba;
  --border: #424246;
  --soft: #2c3237;
  --strong: #f0b2c4;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418;
    --fg: #e6edf3;
    --muted: #a1aab8;
    --link: #2698ba;
    --border: #424246;
    --soft: #2c3237;
    --strong: #f0b2c4;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 930px;
  padding: 28px 24px;
  background: var(--bg);
  color: var(--fg);
  font: 20px/1.55 "Cormorant Garamond", "cormorant-garamond", Georgia, serif;
  font-variant-ligatures: common-ligatures;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
}

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

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-weight: 400;
  line-height: 1.25;
}

h1 {
  margin: 0 0 18px;
  font-size: 2.25rem;
}

h2 {
  margin-top: 34px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 4px;
}

p {
  margin: 0 0 16px;
}

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

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: baseline;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.site-title {
  color: var(--fg);
  font-size: 1.15rem;
  font-weight: 400;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

nav a {
  color: var(--muted);
  font-size: 1.05rem;
}

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

.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 8px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
}

.theme-toggle:hover {
  color: var(--link);
  border-color: var(--link);
}

.profile {
  display: grid;
  grid-template-columns: minmax(170px, 220px) 1fr;
  gap: 32px;
  align-items: start;
  margin-bottom: 28px;
}

.profile img {
  border-radius: 4px;
}

.profile h1 {
  margin-bottom: 10px;
}

.muted,
.post-date,
.description {
  color: var(--muted);
}

.contact {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.post-list,
.news-list {
  list-style: none;
  padding: 0;
}

.post-list li,
.news-list li {
  margin: 0 0 18px;
}

.post-list a {
  font-weight: 500;
}

blockquote,
pre {
  background: var(--soft);
  border-left: 3px solid var(--border);
  margin: 24px 0;
  padding: 12px 16px;
  overflow-x: auto;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

strong {
  color: var(--strong);
}

footer {
  margin-top: 58px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-links a {
  color: var(--muted);
  font-size: 0.9rem;
}

.social-links a:hover {
  color: var(--link);
}

/* Gallery Styles */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin: 28px 0;
}

.gallery-item {
  overflow: hidden;
  border-radius: 4px;
  background: var(--soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-item img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.gallery-caption {
  padding: 16px;
}

.gallery-caption h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.gallery-caption p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 700px) {
  body {
    padding: 20px;
  }

  .site-header,
  .profile {
    display: block;
  }

  nav {
    margin-top: 12px;
  }

  .profile img {
    width: 150px;
    margin-bottom: 18px;
  }
}

/* CV page styles */
.cv {
  max-width: 780px;
  margin: 12px 0 36px;
}

.cv .download-link {
  display: inline-block;
  margin-bottom: 18px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
}

.cv h2, .cv h3 {
  font-weight: 400;
}

.cv ul {
  margin: 8px 0 18px 1.1rem;
}

@media print {
  body { color: #000; background: #fff }
  .site-header, .theme-toggle, nav { display: none }
  .cv { max-width: 100%; margin: 0 }
}
