@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Lora:ital,wght@0,400;0,500;0,600;1,400&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&display=swap');

:root {
  /* Light Mode Variables (Natural Paper) */
  --bg-color: #fcfbf8;
  --text-color: #1a1a1a;
  --text-muted: #555555;
  --border-color: #e5e3de;
  --link-color: #1a1a1a;
  --link-hover: #666666;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: 'Lora', Georgia, Cambria, "Times New Roman", Times, serif;
  
  /* Vertical Rhythm */
  --base-line-height: 1.7;
  --spacing-unit: 1.7rem;
  --spacing-sm: calc(var(--spacing-unit) / 2);
  --spacing-md: var(--spacing-unit);
  --spacing-lg: calc(var(--spacing-unit) * 2);
  --spacing-xl: calc(var(--spacing-unit) * 4);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Mode Variables */
    --bg-color: #111111;
    --text-color: #f5f5f5;
    --text-muted: #a0a0a0;
    --border-color: #333333;
    --link-color: #f5f5f5;
    --link-hover: #aaaaaa;
  }
}

/* Explicit Theme Overrides (if JS toggling is added) */
[data-theme="dark"] {
  --bg-color: #111111;
  --text-color: #f5f5f5;
  --text-muted: #a0a0a0;
  --border-color: #333333;
  --link-color: #f5f5f5;
  --link-hover: #aaaaaa;
}

[data-theme="light"] {
  --bg-color: #fcfbf8;
  --text-color: #1a1a1a;
  --text-muted: #555555;
  --border-color: #e5e3de;
  --link-color: #1a1a1a;
  --link-hover: #666666;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-sans);
  line-height: var(--base-line-height);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--spacing-lg) var(--spacing-md);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 500;
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-sm);
  color: var(--text-color);
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.8rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
}

h3 {
  font-size: 1.4rem;
}

p {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  color: var(--text-color);
}

.text-muted {
  color: var(--text-muted);
}

/* Links */
a {
  color: var(--link-color);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

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

/* Navigation */
header {
  margin-bottom: var(--spacing-xl);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-md);
}

.site-title {
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-left: auto;
}

nav {
  /* No special flex needed here, just want it to flow */
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

nav li {
  margin-bottom: -0.4rem;
}

@media (max-width: 600px) {
  nav {
    order: 3;
    width: 100%;
  }
}

nav a {
  text-decoration: none;
  font-weight: 500;
}

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

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

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

/* Images & Media */
img, video {
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: var(--spacing-md);
  border-radius: 4px;
}

/* Lists */
ul, ol {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

li {
  margin-bottom: var(--spacing-sm);
}

/* Footer */
footer {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Utility */
.material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24
}

/* Projects */
.project-detail h1 {
  margin-top: 0;
  margin-bottom: var(--spacing-lg);
}

.project-body iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 8px;
  margin-bottom: var(--spacing-lg);
}

.button {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--text-color);
  color: var(--bg-color);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  margin-top: var(--spacing-md);
  transition: opacity 0.2s ease;
}

.button:hover {
  opacity: 0.8;
  color: var(--bg-color);
  text-decoration: none;
}

.back-link {
  text-decoration: none;
  font-weight: 500;
  color: var(--text-muted);
}

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

/* Language Toggle (Segmented Control) */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 600;
  height: 32px; /* aligns nicely with navigation */
}

.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  height: 100%;
  text-decoration: none;
  color: var(--text-muted);
  background-color: transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.lang-toggle-btn:hover:not(.active) {
  text-decoration: none;
  background-color: rgba(150, 150, 150, 0.1);
  color: var(--text-color);
}

.lang-toggle-btn.active {
  color: var(--bg-color);
  background-color: var(--text-color);
  cursor: default;
}

/* Add a border between the buttons */
.lang-toggle > *:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

/* Project Icon Sprite */
.project-icon {
  display: block;
  width: 160px;
  height: 160px;
  background-size: 200% 100%;
  background-repeat: no-repeat;
  border-radius: 20px;
  transition: background-position 0.3s ease;
  margin-bottom: var(--spacing-md);
}

.project-list-icon {
  width: 112px;
  height: 112px;
  border-radius: 16px;
  flex-shrink: 0;
  margin-bottom: 0;
}

.project-list-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.project-list-item a {
  text-decoration: none;
}

.project-list-item a:hover h2 {
  text-decoration: underline;
}

.project-list-item h2 {
  margin: 0;
  border: none;
  font-size: 1.4rem;
}

[data-theme="light"] .project-icon,
html:not([data-theme="dark"]) .project-icon {
  background-position: left center;
}

[data-theme="dark"] .project-icon {
  background-position: right center;
}

/* Enable Cross-Document View Transitions */
@view-transition {
  navigation: auto;
}
