:root {
  --bg0: #f7f5f2;
  --bg1: #ede8e1;
  --text: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #0f6b5c;
  --accent-soft: rgba(15, 107, 92, 0.12);
  --border: #d9d3cb;
  --surface: #ffffff;
  --danger: #a12828;
  --radius: 12px;
  --max: 440px;
  --shadow: 0 1px 0 rgba(26, 26, 26, 0.04);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg0: #0e1110;
  --bg1: #161b19;
  --text: #f2f0eb;
  --muted: #a8a39a;
  --accent: #3db89a;
  --accent-soft: rgba(61, 184, 154, 0.16);
  --border: #2a312e;
  --surface: #1a201e;
  --danger: #ef8a8a;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Attribute `hidden` must always win over component display rules. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Source Sans 3", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  transition: background 0.35s ease, color 0.35s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

.page {
  width: min(100% - 2.5rem, var(--max));
  margin: 0 auto;
  padding: 1.75rem 0 3rem;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.icon-btn:active {
  transform: scale(0.96);
}

.hero {
  text-align: center;
  margin-bottom: 1.75rem;
}

.avatar {
  width: 104px;
  height: 104px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--surface);
  margin: 0 auto 1rem;
  display: block;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.45s ease forwards;
}

.avatar.placeholder {
  display: grid;
  place-items: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 2rem;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.85rem, 5vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.45s ease 0.08s forwards;
}

.hero .title {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  opacity: 0;
  animation: rise 0.45s ease 0.14s forwards;
}

.hero .bio {
  margin: 0.85rem auto 0;
  max-width: 36ch;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.98rem;
  opacity: 0;
  animation: rise 0.45s ease 0.2s forwards;
}

.links {
  display: grid;
  gap: 0.7rem;
  margin: 0 0 1.75rem;
}

.link-btn {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.85rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.link-btn:hover,
.link-btn:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px) scale(1.01);
  outline: none;
}

.link-btn:active {
  transform: scale(0.99);
}

.link-btn.emphasis {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--surface) 88%, var(--accent));
}

.link-btn .icon {
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.link-btn .icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.link-btn .copy .name {
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.2;
}

.link-btn .copy .desc {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.3;
}

.section-label {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.projects {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.75rem;
}

.project {
  display: block;
  padding: 0.8rem 0.95rem;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease;
}

.project:hover,
.project:focus-visible {
  color: var(--accent);
  outline: none;
}

.project strong {
  display: block;
  font-size: 0.98rem;
}

.project span {
  color: var(--muted);
  font-size: 0.86rem;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
}

.social {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.social:hover,
.social:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.social:active {
  transform: scale(0.96);
}

.social svg {
  width: 1.2rem;
  height: 1.2rem;
}

.actions {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
}

.secondary-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.secondary-btn:hover,
.secondary-btn:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.qr-wrap {
  text-align: center;
  margin-bottom: 1.5rem;
}

.qr-wrap canvas,
.qr-wrap img {
  width: 132px;
  height: 132px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.qr-wrap p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.state.error {
  color: var(--danger);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: var(--bg0);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
  opacity: 0;
  transition: transform 0.28s ease, opacity 0.28s ease;
  z-index: 50;
  max-width: min(90vw, 360px);
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .avatar,
  .hero h1,
  .hero .title,
  .hero .bio {
    opacity: 1;
    transform: none;
  }
}
