@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap");

:root {
  --primary-color: #0f172a;
  --secondary-color: #64748b;
  --accent-color: #000000;
  --text-color: #334155;
  --text-light: #64748b;
  --bg-color: #ffffff;
  --surface-color: #f8fafc;
  --border-color: #e2e8f0;
  --spacing: 1.5rem;
  --main-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --heading-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.02);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.03);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.04);
}

:root[data-theme="dark"] {
  --primary-color: #f1f5f9;
  --secondary-color: #94a3b8;
  --accent-color: #ffffff;
  --text-color: #cbd5e1;
  --text-light: #94a3b8;
  --bg-color: #0f172a;
  --surface-color: #1e293b;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.6);
}

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

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

body {
  font-family: var(--main-font);
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-color);
  min-height: 100dvh;
  view-transition-name: page;
  font-size: 15px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  animation: fadeIn 0.5s ease-out;
}

h1 {
  font-family: var(--heading-font);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h2 {
  font-family: var(--heading-font);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  color: var(--primary-color);
  margin-top: 2rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

h3 {
  font-family: var(--heading-font);
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  font-weight: 600;
  color: var(--primary-color);
  letter-spacing: -0.015em;
  line-height: 1.4;
}

p {
  margin-bottom: 1rem;
  color: var(--text-color);
}

header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background: rgba(248, 250, 252, 0.8);
}

:root[data-theme="dark"] header {
  background: rgba(30, 41, 59, 0.8);
}

header h1 {
  color: var(--accent-color);
  margin: 0;
  font-size: 1.5rem;
}

header nav {
  margin-top: 1rem;
}

header nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

header nav ul li a {
  color: var(--text-color);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
  font-size: 0.9375rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

header nav ul li a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-color);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

header nav ul li a:hover {
  background: var(--border-color);
  color: var(--accent-color);
  transform: translateY(-1px);
}

header nav ul li a:hover::after {
  width: 80%;
}

header nav ul li a[aria-current="page"] {
  background: var(--accent-color);
  color: var(--bg-color);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
  min-height: 70dvh;
  animation: fadeIn 0.6s ease-out 0.1s both;
}

section {
  background: transparent;
  padding: 0;
  margin-bottom: 3rem;
  animation: fadeIn 0.7s ease-out 0.2s both;
}

section h2 {
  margin-top: 0;
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

section:has(form) {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

section:has(project-card) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  grid-auto-rows: auto;
}

section:has(project-card) h2 {
  grid-column: 1 / -1;
}

article {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeIn 0.5s ease-out both;
}

article:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--secondary-color);
  transform: translateY(-4px);
}

article:has(time) {
  border-left: 3px solid var(--accent-color);
}

experience-item {
  display: block;
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

experience-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--secondary-color);
}

experience-item h3 {
  margin-bottom: 0.5rem;
}

experience-item time {
  color: var(--text-light);
  font-size: 0.875rem;
  font-weight: 500;
}

experience-item dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1.5rem;
  margin: 1rem 0;
}

experience-item dl dt {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.875rem;
}

experience-item dl dd {
  color: var(--text-color);
}

experience-item ul,
experience-item ol {
  margin-left: 1.5rem;
  margin-top: 1rem;
}

form fieldset {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

form fieldset legend {
  font-weight: 600;
  color: var(--primary-color);
  padding: 0 0.5rem;
  font-size: 0.9375rem;
}

form label {
  display: block;
  font-weight: 500;
  margin-top: 1rem;
  margin-bottom: 0.375rem;
  color: var(--primary-color);
  font-size: 0.9375rem;
}

form input,
form textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-family: var(--main-font);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 0.9375rem;
}

form input:hover,
form textarea:hover {
  border-color: var(--secondary-color);
}

form input:focus,
form textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

form input:invalid:not(:placeholder-shown),
form textarea:invalid:not(:placeholder-shown) {
  border-color: #ef4444;
}

form input:valid:not(:placeholder-shown),
form textarea:valid:not(:placeholder-shown) {
  border-color: #10b981;
}

:root[data-theme="dark"] form input:focus,
:root[data-theme="dark"] form textarea:focus {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

form button {
  margin-top: 1.5rem;
  padding: 0.625rem 1.5rem;
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9375rem;
  position: relative;
  overflow: hidden;
}

form button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

form button:hover::before {
  width: 300px;
  height: 300px;
}

form button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.15);
}

form button:active {
  transform: translateY(0) scale(0.98);
}

picture {
  display: block;
  margin: 1.5rem 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

picture:hover {
  box-shadow: var(--shadow-md);
}

picture img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: block;
}

picture:hover img {
  transform: scale(1.05);
}

progress {
  width: 100%;
  height: 0.5rem;
  border-radius: var(--radius-sm);
  appearance: none;
}

progress::-webkit-progress-bar {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

progress::-webkit-progress-value {
  background: var(--accent-color);
  border-radius: var(--radius-sm);
}

progress::-moz-progress-bar {
  background: var(--accent-color);
  border-radius: var(--radius-sm);
}

dialog {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 90dvw;
  box-shadow: var(--shadow-lg);
  background: var(--bg-color);
}

dialog button {
  margin-top: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

dialog button:hover {
  opacity: 0.9;
}

footer {
  background: var(--surface-color);
  color: var(--text-color);
  padding: 2rem;
  text-align: center;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
}

a {
  color: var(--accent-color);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

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

picture img {
  object-fit: cover;
  object-position: center;
}

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

audio,
video {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin: 1rem 0;
}

canvas {
  max-width: 100%;
  border-radius: var(--radius-md);
}

iframe {
  max-width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.menu-toggle {
  display: none;
}

#menu-checkbox {
  display: none;
}

.menu-icon {
  display: none;
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--main-font);
}

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

.data-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.data-btn {
  padding: 0.75rem 1.5rem;
  background: var(--accent-color);
  color: var(--bg-color);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9375rem;
  font-family: var(--main-font);
  position: relative;
  overflow: hidden;
}

.data-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.5s, height 0.5s;
}

.data-btn:hover::after {
  width: 200px;
  height: 200px;
}

.data-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.2);
}

.data-btn:active {
  transform: translateY(0) scale(1);
}

.data-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading States */
.loading {
  pointer-events: none;
  position: relative;
}

.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--bg-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  z-index: 1;
}

.loading.data-btn::after {
  display: none;
}

/* Skeleton Screens */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-color) 0%,
    var(--border-color) 20%,
    var(--surface-color) 40%,
    var(--surface-color) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  opacity: 0.6;
  border: 1px solid var(--border-color);
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.05) 50%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
}

.skeleton-card {
  height: 420px;
  margin-bottom: 2rem;
  animation: fadeIn 0.3s ease-out;
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-title {
  height: 1.5rem;
  margin-bottom: 1rem;
  width: 80%;
}

@media (max-width: 768px) {
  .menu-icon {
    display: block;
  }

  header {
    padding: 1rem 1.5rem;
  }

  header nav ul {
    flex-direction: column;
    gap: 0.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  #menu-checkbox:checked ~ nav ul {
    max-height: 500px;
  }

  #menu-checkbox:checked ~ .menu-icon::before {
    content: "✕";
  }

  .menu-icon::before {
    content: "☰";
  }

  header nav ul li a {
    padding: 0.75rem 1rem;
    width: 100%;
  }

  main {
    padding: 2rem 1.5rem;
  }

  section {
    margin-bottom: 2rem;
  }

  section:has(project-card) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  experience-item {
    padding: 1.25rem;
  }

  experience-item picture img {
    width: 100%;
    height: auto;
  }

  article {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.5rem;
  }

  header {
    padding: 1rem;
  }

  main {
    padding: 1.5rem 1rem;
  }

  section {
    margin-bottom: 1.5rem;
  }

  section:has(form) {
    padding: 1.5rem;
  }

  form fieldset {
    padding: 1rem;
  }

  dialog {
    padding: 1.5rem;
    max-width: 95dvw;
  }

  experience-item {
    padding: 1rem;
  }

  article {
    padding: 1rem;
  }
}

@media (min-width: 769px) and (max-width: 1199px) {
  main {
    padding: 2.5rem 2rem;
  }

  header nav ul {
    gap: 0.5rem;
  }
}

@media (min-width: 1200px) {
  section:has(form) {
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
  }
}

@media print {
  header,
  footer,
  nav {
    display: none;
  }

  main {
    padding: 0;
    max-width: 100%;
  }

  section {
    page-break-inside: avoid;
    box-shadow: none;
  }

  article,
  experience-item {
    border: 1px solid #ddd;
  }
}
