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

:root {
  --font-body: "Inter", sans-serif;
  --font-heading: "Inter", sans-serif;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);

  --max-page-width: 1000px;
  --max-text-width: 72ch;

  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
}

/* Default theme: dark */
:root,
:root[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-soft: #172033;
  --bg-header: rgba(11, 17, 32, 0.92);

  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #dbe3ee;

  --border: #23314a;
  --border-strong: #334155;

  --accent: #79a9ff;
  --accent-hover: #5c91f5;
  --accent-soft: rgba(121, 169, 255, 0.14);

  --success: #22c55e;
  --danger: #ef4444;

  --body-bg:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(96, 165, 250, 0.08), transparent 25%),
    linear-gradient(180deg, #07101f 0%, #0b1120 100%);
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-soft: #f1f5f9;
  --bg-header: rgba(248, 250, 252, 0.94);

  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #334155;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.08);

  --success: #16a34a;
  --danger: #dc2626;

  --body-bg:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.06), transparent 25%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--body-bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
}

/* Header */
header {
  position: static;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
  padding: 0.9rem 1rem 1rem;
  text-align: center;
}

header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
}

header h1 svg {
  width: 0.85em;
  height: 0.85em;
  vertical-align: -0.08em;
  opacity: 0.95;
}

circle {
  fill: var(--accent);
}

/* Navigation */
nav {
  margin-top: 0.8rem;
}

nav ul {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav li {
  margin: 0;
  padding: 0;
}

nav a {
  display: inline-block;
  padding: 0.72rem 1rem;
  border-radius: 999px;
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 600;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

nav a:hover,
nav a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

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

/* Theme select */
.theme-select,
#theme-select {
  display: block;
  width: auto;
  min-width: 180px;
  max-width: 220px;
  margin: 0.9rem auto 0;
  padding: 0.68rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.theme-select:hover,
#theme-select:hover {
  border-color: var(--border-strong);
}

/* Main layout */
main {
  width: min(var(--max-page-width), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

main > * {
  margin-bottom: 1.5rem;
}

/* Content containers */
article,
section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 2vw, 2rem);
  box-shadow: var(--shadow-md);
  margin: 0 auto 1.5rem;
  text-align: left;
}


.theme-toggle {
  display: inline-flex;
  align-items: center;
  /* gap: 0.8rem; */
  gap: 0.6rem;
  margin: 0.9rem auto 0;
  /* padding: 0.55rem 0.9rem; */
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

.theme-toggle-track {
  position: relative;
  width: 54px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 1px solid var(--border);
  overflow: hidden;
}

.theme-toggle-thumb {
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    left 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.2s ease;
}

.theme-icon {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
}

/* LIGHT MODE (left) */

:root[data-theme="light"] .theme-toggle-track {
  background: linear-gradient(135deg, #bfdbfe, #60a5fa);
}

:root[data-theme="light"] .theme-toggle-thumb {
  left: 3px;
  background: #fff7cc;
}

/* DARK MODE (right) */
:root[data-theme="dark"] .theme-toggle-track {
  background: linear-gradient(135deg, #16233a, #243b63);
  box-shadow: inset 0 0 10px rgba(121, 169, 255, 0.12);
}

:root[data-theme="dark"] .theme-toggle-thumb {
  left: 29px;
}

/* Click animation */
.theme-toggle.clicked .theme-toggle-thumb {
  transform: scale(1.1);
}

/* Typography */
h1,
h2,
h3 {
  margin-top: 0;
  font-family: var(--font-heading);
  letter-spacing: -0.03em;
  color: var(--text);
}

h2 {
  font-size: clamp(1.8rem, 2.3vw, 2.35rem);
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

h3 {
  font-size: clamp(1.2rem, 1.8vw, 1.45rem);
  margin-bottom: 0.75rem;
}

p,
li {
  color: var(--text-soft);
  max-width: var(--max-text-width);
  font-size: 1rem;
}

section p,
article p,
section li,
article li {
  margin-left: auto;
  margin-right: auto;
}


strong,
b {
  color: var(--text);
}

em,
i {
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.14em;
  transition: color var(--transition-fast);
}


main article ul,
main article ol,
main section ul,
main section ol {
  list-style-position: inside;
  padding-left: 0;
  margin: 1rem auto 1.5rem auto;
  max-width: 700px;
  text-align: center;
}

main article ul li,
main article ol li,
main section ul li,
main section ol li {
  margin: 0.5rem 0;
  text-align: center;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
}



/* Homepage / centered intro blocks */
article > h2,
article > p,
article > picture,
article > img,
section > h2.centered,
section > p.centered {
  margin-left: auto;
  margin-right: auto;
}

article > h2,
article > p {
  text-align: center;
}

/* Images and media */
img,
picture,
video,
audio,
iframe {
  display: block;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

img {
  height: auto;
  border-radius: var(--radius-md);
}

article img,
section img,
iframe {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

section > h2,
section > p {
  text-align: center;
}

/* Specific image styling */
.robotImage {
  display: block;
  width: min(320px, 100%);
  height: auto;
  margin: 1.5rem auto;
  border-radius: 16px;
  object-fit: cover;
}

.photos {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.photos img {
  width: 10rem;
  height: 10rem;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--bg-elevated);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast);
}

.photos img:hover {
  transform: translateY(-2px);
}

/* Projects grid */
.projects-grid,
#projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

project-card,
.project-card {
  display: block;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
  text-align: left;
}

project-card:hover,
.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

project-card img,
.project-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  margin: 0;
}

project-card .content,
.project-card .content,
project-card article,
.project-card article,
project-card section,
.project-card section {
  padding: 1.1rem 1.15rem 1.25rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  margin: 0;
}

project-card h3,
.project-card h3 {
  margin-bottom: 0.5rem;
  text-align: left;
}

project-card p,
.project-card p {
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-align: left;
}

project-card a,
.project-card a {
  font-weight: 600;
  text-decoration: none;
}

project-card a:hover,
.project-card a:hover {
  text-decoration: underline;
}

/* Buttons */
button,
input[type="submit"],
input[type="reset"] {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 0.8rem 1rem;
  transition:
    background-color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:active,
input[type="submit"]:active,
input[type="reset"]:active {
  transform: translateY(0);
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
  margin: 2rem auto 0;
  padding: 1.5rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.FormCenter {
  text-align: center;
}

legend {
  padding: 0 0.5rem;
  font-weight: 700;
  color: var(--text);
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background-color var(--transition-fast);
}

textarea {
  min-height: 140px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Validation */
input:required:invalid,
textarea:required:invalid {
  border-color: var(--danger);
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
  border-color: var(--success);
}

/* Embedded resume or iframe content */
iframe {
  width: 100%;
  min-height: 700px;
  border-radius: var(--radius-md);
  background: white;
}

/* Footer */
footer {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem 2rem;
  text-align: center;
  color: var(--text-muted);
  background: transparent;
}

footer p {
  margin: 0 auto;
  max-width: var(--max-text-width);
  color: var(--text-muted);
}

/* Utility */
noscript p,
.noscript-note {
  width: min(var(--max-page-width), calc(100% - 2rem));
  margin: 0.75rem auto 0;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 0.95rem;
}

progress {
  width: min(100%, 320px);
  height: 0.9rem;
  border-radius: 999px;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: var(--bg-soft);
}

progress::-webkit-progress-value {
  background: var(--accent);
}

#error-output {
  margin-top: 0.5rem;
  color: var(--danger);
  text-align: center;
}

#info-output {
  margin-top: 0.5rem;
  color: var(--success);
  text-align: center;
}

.flash-illegal {
  animation: flashRed 0.75s ease-in-out;
}

@keyframes flashRed {
  0% {
    background-color: rgba(239, 68, 68, 0.18);
  }
  100% {
    background-color: transparent;
  }
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    padding: 0.85rem 0.75rem 0.9rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  nav ul {
    gap: 0.35rem;
  }

  nav a {
    padding: 0.62rem 0.85rem;
    font-size: 0.95rem;
  }

  main {
    width: min(100% - 1rem, var(--max-page-width));
    padding-top: 1.5rem;
  }

  article,
  section {
    padding: 1.1rem;
  }

  iframe {
    min-height: 480px;
  }

  .photos img {
    width: 8rem;
    height: 8rem;
  }
}

@media (max-width: 520px) {
  header h1 {
    font-size: 1.5rem;
  }

  nav ul {
    flex-direction: column;
  }

  .theme-select,
  #theme-select {
    width: 100%;
    max-width: 220px;
  }

  h2 {
    font-size: 1.55rem;
  }
}