:root {
  --bg-dark: #0a0a0a;
  --bg-light: #ffffff;
  --text-dark: #0a0a0a;
  --text-light: #ffffff;
  --muted: #9a9a9a;
  --border: #d7d7d7;
  --nav-h: 64px;
}

* { 
  box-sizing: border-box; 
}

html { 
  scroll-behavior: smooth; 
  scroll-padding-top: var(--nav-h); 
}

body {
  margin: 0;
  font-family: "Times New Roman", Times, serif;
  line-height: 1.5;
  color: var(--text-light);
  background: var(--bg-dark);
}

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

a { 
  color: inherit; 
  text-underline-offset: 2px; 
}

a.link { 
  text-decoration: underline; 
}

.skip-link {
  position: absolute; 
  left: -9999px; 
  top: auto; 
  width: 1px; 
  height: 1px; 
  overflow: hidden;
}

.skip-link:focus { 
  left: 8px; 
  top: 8px; 
  width: auto; 
  height: auto; 
  padding: 6px 10px; 
  background: #fff; 
  color: #000; 
}

/* ===== Sticky Top Nav ===== */
.up {
  position: fixed; 
  inset: 0 0 auto 0; 
  height: var(--nav-h); 
  z-index: 1000;
  display: flex; 
  align-items: center; 
  gap: 12px;
  background: rgba(0,0,0,0.7); 
  backdrop-filter: blur(6px);
  padding: 6px 10px;
}

.home { height: 100%; aspect-ratio: 1 / 1; }
.home-pic { background: #fff; border-radius: 50%; height: 100%; transition: filter 200ms ease; }
.home-pic:hover { filter: grayscale(1) brightness(0.8); }

.navigation { display: flex; gap: 10px; width: 100%; justify-content: center; }
.navigation a {
  padding: 6px 10px; text-decoration: none; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 3px; transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.navigation a:hover { background: #fff; color: #000; transform: translateY(-1px); }
.navigation a.active { outline: 1px solid #fff; }

/* ===== Sections ===== */
.section { min-height: 100svh; display: flex; align-items: center; }
.section-inner { width: min(1120px, 92vw); margin: 0 auto; padding: 72px 0; }
.section--dark { background: var(--bg-dark); color: var(--text-light); }
.section--light { background: var(--bg-light); color: var(--text-dark); }

.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.section-title { font-size: clamp(28px, 4vw, 40px); line-height: 1.2; margin: 0; }
.section-icon { width: 28px; height: 28px; object-fit: contain;}
.section--dark .section-icon { filter: invert(1); }

/* ===== Hero ===== */
.hero .container { display: grid; place-items: center; width: 100%; padding-top: var(--nav-h); }
.site-title { font-size: clamp(32px, 8vw, 72px); text-align: center; text-shadow: 2px 2px rgba(255,255,255,0.22); margin-top: 16px; }
.tagline { text-align: center; color: var(--muted); margin-top: 8px; }
.duck-pic { width: min(360px, 70%); height: auto; border-radius: 50%; }

/* ===== About ===== */
.about-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 24px; }
.about-media figcaption { color: var(--muted); font-size: 14px; margin-top: 8px; }
.list { padding-left: 18px; }
.list li { margin: 6px 0; }

/* ===== Table (Education) ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid currentColor; }
.table thead th { font-weight: 700; }
.table tbody tr:hover { background: rgba(0,0,0,0.05); }
.section--dark .table tbody tr:hover { background: rgba(255,255,255,0.07); }

/* ===== Cards (Projects) ===== */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  border: 1px solid currentColor; padding: 16px; border-radius: 10px; height: 100%;
  display: flex; flex-direction: column; gap: 10px; transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}
.card:hover { transform: translateY(-4px); background: #000; color: #fff; }
.section--light .card:hover { background: #111; color: #fff; }
.card-header { display: flex; align-items: center; gap: 10px; }
.card-icon { width: 20px; height: 20px; object-fit: contain; }
.card-title { margin: 0; font-size: 20px; }
.card-text { margin: 0; }
.card-list { padding-left: 18px; margin: 0; }
.card-actions { margin-top: auto; display: flex; gap: 14px; }
.card-actions .link { position: relative; }
.card-actions .link::after { content: "→"; margin-left: 6px; opacity: 0; transition: opacity 150ms ease, transform 150ms ease; display: inline-block; }
.card-actions .link:hover::after { opacity: 1; transform: translateX(2px); }

/* ===== Timeline (Experience) ===== */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 1px solid currentColor; }
.timeline-item { position: relative; margin-left: 18px; padding-left: 16px; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -7px; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.muted { color: var(--muted); }

/* ===== Skills ===== */
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { border: 1px solid currentColor; padding: 6px 10px; border-radius: 999px; }
.columns { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; margin-top: 20px; }

/* ===== Contact ===== */
.contact-form { display: grid; gap: 14px; max-width: 680px; }
.field { display: grid; gap: 6px; }
label { font-weight: 700; }
input, textarea { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid currentColor; background: transparent; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus { outline: none; box-shadow: 0 0 0 2px currentColor inset; }
.actions { display: flex; align-items: center; gap: 12px; }
.btn { appearance: none; border: 1px solid currentColor; background: transparent; color: inherit; padding: 10px 16px; border-radius: 999px; cursor: pointer; transition: background 160ms ease, color 160ms ease, transform 160ms ease; }
.btn:hover { background: #fff; color: #000; transform: translateY(-1px); }
.form-note { color: var(--muted); font-size: 14px; }

/* ===== Footer ===== */
.site-footer { min-height: auto; }
.inline-links { list-style: none; padding: 0; margin: 10px 0 0; display: flex; gap: 16px; }
.inline-links a { text-decoration: underline; }

/* ===== Reveal on scroll ===== */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 420ms ease, transform 420ms ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --nav-h: 56px; }
  .cards { grid-template-columns: 1fr; }
  .columns { grid-template-columns: 1fr; }
  .navigation { justify-content: flex-end; gap: 6px; }
  .navigation a { padding: 6px 8px; font-size: 12px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; }
  .navigation a { transition: none; }
}

.form-status { 
  font-size: 14px; 
  color: inherit; 
}

.form-status.error { 
  color: #d33; 
}

#ui-layer { 
  position: fixed; 
  inset: 0; 
  z-index: 2000; 
  pointer-events: none; 
}

.toast {
  position: fixed; 
  left: 50%; 
  bottom: 28px; 
  transform: translateX(-50%);
  background: #111; 
  color: #fff; 
  border: 1px solid #fff;
  padding: 10px 14px; 
  border-radius: 999px; 
  display: none; 
  pointer-events: auto;
}

.toast.show {
  display: inline-block;
}

.modal[hidden] { 
  display: none; 
}

.modal__backdrop { 
  position: fixed; 
  inset: 0; 
  background:rgba(0,0,0,.6); 
  pointer-events: auto; 
}

.modal__panel {
  position: fixed; 
  top: 50%; 
  left: 50%;
  transform: translate(-50%,-50%);
  background: #fff; 
  color: #000; 
  border: 1px solid #000;
  padding: 24px; 
  width: min(480px, 92vw); 
  border-radius: 12px; 
  pointer-events: auto;
}
