/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --background-color: #ffffff;
  --text-color: #333333;
  --header-bg: #f5f5f5;
  --nav-link-color: #333333;
  --nav-link-hover: #666666;
  --content-width: 1200px;
  --link-color: #0066cc;
  --link-visited-color: #551a8b;
}

[data-theme="dark"] {
  --background-color: #1a1a1a;
  --text-color: #edebe1;
  --header-bg: #2d2d2d;
  --nav-link-color: #f0f0f0;
  --nav-link-hover: #ffffff;
  --card-bg: #2d2d2d;
  --card-hover: #3d3d3d;
  --border-color: #444;
  --secondary-text: #e0e0e0;
  --tag-bg: #3d3d3d;
  --tag-color: #ffffff;
  --link-color: #7dd3fc;
  --link-visited-color: #a78bfa;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  margin: 0;
  font-family: "Open Sans", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "wdth" 100;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  max-width: var(--content-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
}

/* View Transitions */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 2;
}

/* Header and Navigation */
header {
  background-color: var(--header-bg);
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
  width: 100%;
}

header .container {
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  gap: 2rem;
  max-width: 800px;
  padding-left: 1rem;
  padding-right: 1rem;
}

h1 {
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0;
}

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

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

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-svg {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 500;
}

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

nav a {
  color: var(--nav-link-color);
  text-decoration: none;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.theme-toggle-wrapper {
  margin-left: auto;
  padding-left: 2rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-color);
}

.toggle-track {
  position: relative;
  width: 40px;
  height: 24px;
  background-color: #2d2d2d;
  border-radius: 12px;
  transition: background-color 0.3s ease;
}

[data-theme="dark"] .toggle-track {
  background-color: #6b7280;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

[data-theme="dark"] .toggle-thumb {
  transform: translateX(16px);
}

.theme-toggle:hover .toggle-track {
  opacity: 0.8;
}

.toggle-text {
  font-size: 0.875rem;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}

[data-theme="light"] .light-text {
  opacity: 1;
}

[data-theme="dark"] .dark-text {
  opacity: 1;
}

/* Grid Layout for Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
}

.project-card img {
  width: 100%;
  height: auto;
  object-fit: cover;
  aspect-ratio: 1;
}

.project-card h2 {
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

.project-card .year {
  color: #666;
  font-size: 0.9rem;
}

main {
  flex: 1;
  padding: 3rem 0;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Blog specific dark mode styles */
[data-theme="dark"] .post-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
}

[data-theme="dark"] .post-card:hover {
  background-color: var(--card-hover);
}

[data-theme="dark"] .post-card h2,
[data-theme="dark"] .post-card h3 {
  color: #ffffff;
}

[data-theme="dark"] .description,
[data-theme="dark"] .post-description {
  color: #e0e0e0;
}

[data-theme="dark"] time,
[data-theme="dark"] .blog-info,
[data-theme="dark"] .post-meta {
  color: #e0e0e0;
}

[data-theme="dark"] .year-section h2 {
  color: #d46060;
}

[data-theme="dark"] .tag {
  background: var(--tag-bg);
  color: #ffffff;
}

[data-theme="dark"] .post-footer {
  border-top-color: var(--border-color);
}

[data-theme="dark"] .author {
  color: #e0e0e0;
}

/* Markdown content styles */
.content p {
  margin: 2.5rem 0;
  line-height: 1.8;
  display: block;
}
.content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: bold;
  line-height: 1.2;
}
.content ul, .content ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
}
.content blockquote {
  border-left: 4px solid #ccc;
  margin: 1.5rem 0;
  padding-left: 1rem;
  color: #666;
  font-style: italic;
  background: #222;
}

/* Anchor link styles */
.content a:link {
  color: var(--link-color);
  text-decoration: underline;
}

.content a:visited {
  color: var(--link-visited-color);
  text-decoration: underline;
}

.content a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Footer – two-tier tech style */
.site-footer {
  background: #000;
  color: #fff;
  margin-top: auto;
}

.footer-top {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 3rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.footer-graphic {
  opacity: 0.9;
}

.footer-graphic svg {
  width: 140px;
  height: 56px;
  display: block;
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem 2rem;
}

.footer-social a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-social a:hover {
  color: rgba(255, 140, 0, 1);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-grid {
  max-width: 480px;
  margin: 0 auto;
  padding: 2.5rem 2rem 3rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 3rem;
}

.footer-column {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding-left: 1.25rem;
}

.footer-grid .footer-column:first-child {
  border-left: none;
  padding-left: 0;
}

.footer-heading {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 1rem;
}

.footer-column ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-column li {
  margin-bottom: 0.5rem;
}

.footer-column a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.95rem;
}

.footer-column a:hover {
  color: #fff;
}

.center {
  align-items: center;
}