:root {
  color-scheme: light dark;

  --bg: #fbfbfd;
  --bg-elevated: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #0071e3;
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 28px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.10);

  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --ink: #f5f5f7;
    --ink-soft: #98989d;
    --border: rgba(255, 255, 255, 0.12);
    --accent: #2997ff;
    --accent-contrast: #ffffff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.45);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.35), 0 24px 48px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --ink: #f5f5f7;
  --ink-soft: #98989d;
  --border: rgba(255, 255, 255, 0.12);
  --accent: #2997ff;
  --accent-contrast: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.45);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.35), 0 24px 48px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 980px;
  margin: 0 auto;
  padding: 0.9rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-brand {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transition: background 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  transform: scale(1.06);
}

.theme-toggle .icon {
  width: 17px;
  height: 17px;
}

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* ---------- layout ---------- */

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  position: relative;
  z-index: 1;
}

.section {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--border);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.section.in-view {
  opacity: 1;
  transform: none;
}

.section-heading {
  margin-bottom: 1.75rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.eyebrow-inline {
  margin-bottom: 0.6rem;
  display: block;
}

.section-title {
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  margin: 0;
}

.section-intro {
  color: var(--ink-soft);
  margin-top: -1rem;
  margin-bottom: 2rem;
  max-width: 50ch;
}

/* ---------- hero ---------- */

.hero {
  padding: clamp(5rem, 14vw, 9rem) 0 clamp(3rem, 8vw, 4.5rem);
  text-align: center;
}

.hero-title {
  font-size: clamp(2.75rem, 8vw, 4.5rem);
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
  font-weight: 650;
}

.hero-tagline {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  min-height: 1.6em;
  margin: 0 auto 2.25rem;
  max-width: 40ch;
}

.hero-actions {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.5rem;
  border-radius: 980px;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--bg-elevated);
  transform: translateY(-1px);
}

/* ---------- about ---------- */

.about-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

@media (max-width: 680px) {
  .about-grid { grid-template-columns: 1fr; }
}

.lede {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--ink);
  line-height: 1.65;
}

.info-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--ink-soft);
}

.info-value {
  font-weight: 500;
  text-align: right;
}

.skills h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
}

.tag-list li,
.tag-list span {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 980px;
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.tag-list-sm span {
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
}

/* ---------- projects ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem;
}

.project-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: var(--shadow);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

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

.project-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-icon svg {
  width: 22px;
  height: 22px;
}

.project-card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.project-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.project-card .tag-list {
  margin-top: auto;
}

.project-link {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.project-link span {
  transition: transform 0.2s ease;
}

.project-card:hover .project-link span {
  transform: translateX(3px);
}

/* ---------- now / stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.stat-tile {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 16px;
  padding: 1.4rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  display: block;
  font-size: clamp(1.9rem, 4.5vw, 2.4rem);
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.35rem;
}

.now-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 60ch;
}

.now-list li {
  border-left: 2px solid var(--accent);
  padding-left: 0.9rem;
  color: var(--ink-soft);
}

.now-list strong {
  color: var(--ink);
}

/* ---------- contact ---------- */

.contact-wrap {
  max-width: 480px;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-row label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.form-row input,
.form-row textarea {
  font: inherit;
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink);
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.form-row-hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.contact-form .btn {
  align-self: flex-start;
}

.form-status {
  margin: 0;
  font-size: 0.88rem;
  min-height: 1.2em;
}

.form-status[data-state="success"] {
  color: #1a8f4b;
  font-weight: 500;
}

.form-status[data-state="error"] {
  color: #d92d20;
}

.social-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 2.25rem;
  font-size: 0.88rem;
}

.social-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--ink);
}

.social-links svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem clamp(1.25rem, 4vw, 2.5rem);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  max-width: 780px;
  margin: 0 auto;
}

.footer-clock {
  font-variant-numeric: tabular-nums;
}
