:root {
  color-scheme: light dark;

  --content-width: 61ch;

  --bg: #fdfdfc;
  --fg: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #2557b0;
  --rule: #e6e6e3;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315;
    --fg: #e8e8e6;
    --muted: #a0a0a0;
    --accent: #7aa8e8;
    --rule: #2a2c2e;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fdfdfc;
  --fg: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #2557b0;
  --rule: #e6e6e3;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111315;
  --fg: #e8e8e6;
  --muted: #a0a0a0;
  --accent: #7aa8e8;
  --rule: #2a2c2e;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main {
  position: relative;
  max-inline-size: var(--content-width);
  margin-inline: auto;
  padding: clamp(2rem, 4vw + 1rem, 4rem) 1.25rem 1.25rem;
}

#theme-toggle {
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-end: 1rem;
  inline-size: 2.25rem;
  block-size: 2.25rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#theme-toggle svg {
  inline-size: 1rem;
  block-size: 1rem;
}

.icon-moon { display: block; }
.icon-sun { display: none; }

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

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }

header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-block-end: 2rem;
}

header .photo {
  inline-size: 7rem;
  block-size: 7rem;
  flex-shrink: 0;
  overflow: hidden;
}

header .photo img {
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  transform: scale(1.4);
}

header h1 {
  font-size: clamp(1.5rem, 1.3rem + 1vw, 1.875rem);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 0.95em;
}

section {
  margin-block-end: 2rem;
}

section p {
  margin-block: 0 1rem;
  text-align: justify;
  hyphens: auto;
}

section p:last-child {
  margin-block-end: 0;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  text-decoration-thickness: 0.06em;
}

a:hover {
  text-decoration-thickness: 0.12em;
}

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

address {
  font-style: normal;
}

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.links li::before {
  content: "→ ";
  color: var(--muted);
  margin-inline-end: 0.15em;
}

footer {
  border-block-start: 1px solid var(--rule);
  padding-block: 0.75rem 1.25rem;
  color: var(--muted);
  font-size: 0.85em;
}

footer .footer-inner {
  max-inline-size: var(--content-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

@media (max-width: 480px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  header .photo {
    inline-size: 6rem;
    block-size: 6rem;
  }
}
