:root {
  color-scheme: dark;
  --background: #050607;
  --surface: #131313;
  --text: #eff8ff;
  --muted: #aab2b5;
  --accent: #bbef1f;
  --accent-text: var(--accent);
  --accent-ink: #050607;
  --green: #23430c;
  --border: #292e29;
  font-family: "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --background: #f6f8f3;
  --surface: #fff;
  --text: #142017;
  --muted: #47564d;
  --accent-text: #386000;
  --border: #d2ddcf;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; }

.shell {
  width: min(100% - clamp(2.5rem, 10vw, 8rem), 75rem);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  transform: translateY(-200%);
}

.skip-link:focus { transform: translateY(0); }

.site-header, .site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1.5rem;
  padding-block: 1.15rem;
}

.site-header { border-bottom: 1px solid var(--border); }

.wordmark {
  margin-right: auto;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.06em;
  text-decoration: none;
}

.wordmark span, .site-header [aria-current="page"] { color: var(--accent-text); }

.site-header [aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.4em;
}

.site-header nav, .site-header .theme-toggle { margin-top: 0; }

.site-footer {
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

.site-footer h2 { margin: 0; font-size: 1.25rem; }
.site-footer p { margin: 0.35rem 0 0; color: var(--muted); }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 5px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(16rem, 0.8fr) minmax(0, 1.5fr);
  align-items: start;
  gap: clamp(2rem, 7vw, 7rem);
  padding-block: clamp(3rem, 8vw, 7rem);
}

.inner-page {
  width: min(100% - clamp(2.5rem, 10vw, 8rem), 52rem);
  padding-block: clamp(3rem, 7vw, 6rem);
}

.page-heading { margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.page-heading .lead { max-width: 38rem; }
.about-copy { max-width: 42rem; font-size: 1.1rem; }
.secondary-project { margin-top: 1.5rem; }
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.project-grid .project-copy {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.project-grid .project-copy p:not(.label) { margin-bottom: 0.75rem; }
.project-grid .stack { margin: 0 0 1rem; }
.project-grid .text-link { align-self: flex-start; margin-top: auto; }
.project-copy h2 { margin: 0.4rem 0 0; }

.intro {
  position: sticky;
  top: 3rem;
}

.role, .label {
  margin: 0;
  color: var(--accent-text);
  font-size: 0.875rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.1; }

h1 {
  margin: 0.65rem 0 1rem;
  font-size: clamp(3.45rem, 6.2vw, 6.15rem);
  letter-spacing: -0.085em;
}

h1 span { color: var(--accent-text); }

.lead {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.18rem;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.2rem;
  margin-top: 2rem;
}

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

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

nav .button {
  padding: 0.5rem 1rem;
  border-radius: 0.55rem;
  background: var(--accent);
  color: var(--accent-ink);
}

nav .button:hover {
  background: #d3ff53;
  color: var(--accent-ink);
}

.theme-toggle {
  margin-top: 1.25rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.theme-toggle:hover, .theme-toggle[aria-pressed="true"] {
  border-color: var(--accent-text);
  color: var(--accent-text);
}

section, article[id] { scroll-margin-top: 2rem; }

h2 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  letter-spacing: -0.045em;
}

.project {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.35rem;
  background: var(--surface);
}

.preview {
  display: grid;
  place-items: center;
  padding: clamp(1rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 77% 15%, #537b18 0%, var(--green) 26%, transparent 69%),
    linear-gradient(150deg, #080a09, #131d0b);
}

.mockup {
  color-scheme: dark;
  --muted: #aab2b5;
  --border: #292e29;
  color: #eff8ff;
  width: 100%;
  max-width: 35rem;
  min-width: 0;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  border: 1px solid #768655;
  border-radius: 0.95rem;
  background: #0c110e;
  box-shadow: 0 1rem 3rem #0008;
}

.mockup-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 0.75rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.mockup-header span:first-child {
  color: var(--accent);
  font-weight: 700;
}

.mockup-title {
  margin: 0.85rem 0;
  font-size: clamp(1rem, 2vw, 1.6rem);
  font-weight: 700;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.3rem, 1vw, 0.7rem);
}

.board > div {
  min-height: 7.5rem;
  padding: clamp(0.25rem, 1vw, 0.65rem);
  border-radius: 0.5rem;
  background: #171d17;
  font-size: 0.8rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.board p { margin: 0 0 0.55rem; color: var(--muted); }

.task {
  margin-bottom: 0.35rem;
  padding: 0.4rem;
  border-radius: 0.3rem;
  background: #282f26;
}

.task.current { background: var(--accent); color: var(--accent-ink); }

[data-theme="light"] .preview {
  background:
    radial-gradient(ellipse at 78% 12%, #daf4a3, transparent 65%),
    linear-gradient(150deg, #f4f8ed, #e6efdc);
}

[data-theme="light"] .mockup {
  color-scheme: light;
  --muted: #47564d;
  --border: #d2ddcf;
  color: var(--text);
  border-color: #c2d2b6;
  background: var(--surface);
  box-shadow: 0 1rem 2.5rem #23381724;
}

[data-theme="light"] .mockup-header span:first-child { color: var(--accent-text); }
[data-theme="light"] .board > div { background: #f0f4eb; }
[data-theme="light"] .task { background: #e1ead8; }
[data-theme="light"] .task.current { background: #d4f278; }

.project-copy { padding: clamp(1.15rem, 4vw, 2rem); }

h3 {
  margin: 0.4rem 0 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
}

.project-copy > p:not(.label), details p, .info p { color: var(--muted); }

details {
  margin-top: 1.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

summary { color: var(--accent-text); cursor: pointer; font-weight: 650; }
details p { margin-bottom: 0; }

.info {
  margin-top: 2.75rem;
  padding-top: 1.65rem;
  border-top: 1px solid var(--border);
}

.info p { margin-bottom: 0; }

.certificate-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.certificate-list li {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
}

.certificate-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem 0;
  color: var(--accent-text);
  font-weight: 650;
  text-decoration: none;
}

.certificate-card:focus-visible { outline-offset: -3px; }
.certificate-card:hover .certificate-title { text-decoration: underline; }

.certificate-card img {
  display: block;
  grid-column: 1 / -1;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  padding: 0.35rem;
  border-radius: 0.4rem;
  background: var(--background);
}

.certificate-format {
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.certificate-list p { margin: 0.3rem 0.85rem 0.85rem; font-size: 0.875rem; }

.work-list {
  padding-inline-start: 1.2rem;
  color: var(--muted);
}

.work-list li + li { margin-top: 0.55rem; }

.stack, .contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.8rem;
  padding: 0;
  list-style: none;
}

.contact-links {
  gap: 0.55rem;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
}

.contact-item img {
  flex: none;
  width: 1rem;
  height: 1rem;
}

:root:not([data-theme="light"]) .contact-item img { filter: invert(1); }

a.contact-item { color: var(--text); }
a.contact-item:hover { border-color: var(--accent-text); color: var(--accent-text); }

.stack li {
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  font-size: 0.875rem;
}

.text-link {
  color: var(--accent-text);
  text-underline-offset: 0.2em;
}

.experience {
  display: grid;
  gap: 1.5rem;
  padding: 0;
  list-style: none;
}

.info .period {
  margin: 0 0 0.4rem;
  font-size: 0.875rem;
}

.experience h3, .resume-heading {
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.experience p { margin-top: 0.6rem; }
.resume-heading { margin-top: 1.75rem; }

@media (max-width: 760px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 3rem; }
  .intro { position: static; }
}

@media (max-width: 520px) {
  .site-header nav { order: 1; width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .intro > *, .page-heading, #projects-title, .project {
    animation: enter 620ms cubic-bezier(0.2, 0.65, 0.3, 1) backwards;
  }

  .intro h1, #projects-title { animation-delay: 60ms; }
  .intro .lead, .project { animation-delay: 130ms; }
  .intro nav, .theme-toggle { animation-delay: 200ms; }

  nav a { transition: color 160ms ease; }

  nav .button {
    transition: background-color 180ms ease, transform 180ms ease;
  }

  .preview {
    position: relative;
    isolation: isolate;
    overflow: hidden;
  }

  .preview::before {
    position: absolute;
    z-index: -1;
    inset: -25%;
    background: radial-gradient(ellipse at 72% 37%, #9ecf3740, transparent 48%);
    content: "";
    animation: glow-drift 4s 200ms ease-in-out both;
  }

  details[open] p { animation: enter 240ms ease-out both; }
}

@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  nav .button:hover { transform: translateY(-2px); }

  .mockup { transition: transform 300ms ease; }
  .preview:hover .mockup { transform: translateY(-4px); }
}

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

@keyframes glow-drift {
  0%, 100% { opacity: 0; transform: translate(8%, -5%); }
  50% { opacity: 1; transform: translate(-8%, 5%); }
}
