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

:root {
  --color-text: #1a1a1a;
  --color-muted: #444;
  --color-link: #0066cc;
  --color-link-hover: #004499;
  --color-border: #ccc;
  --color-bg: #fff;
  --color-bg-muted: #f5f5f5;
  --color-inverse: #fff;
  --max-width: 680px;
  --layout-max-width: 1100px;
  --aside-width: 320px;
}

/* Auto: follow system preference when no manual choice */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-text: #e4e4e7;
    --color-muted: #a1a1aa;
    --color-link: #60a5fa;
    --color-link-hover: #93c5fd;
    --color-border: #3f3f46;
    --color-bg: #18181b;
    --color-bg-muted: #27272a;
    --color-inverse: #18181b;
  }
}

/* Manual: force light mode */
[data-theme="light"] {
  --color-text: #1a1a1a;
  --color-muted: #444;
  --color-link: #0066cc;
  --color-link-hover: #004499;
  --color-border: #ccc;
  --color-bg: #fff;
  --color-bg-muted: #f5f5f5;
  --color-inverse: #fff;
}

/* Manual: force dark mode */
[data-theme="dark"] {
  --color-text: #e4e4e7;
  --color-muted: #a1a1aa;
  --color-link: #60a5fa;
  --color-link-hover: #93c5fd;
  --color-border: #3f3f46;
  --color-bg: #18181b;
  --color-bg-muted: #27272a;
  --color-inverse: #18181b;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

main {
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  max-width: var(--layout-max-width);
}

.page-layout {
  display: grid;
  grid-template-columns: var(--aside-width) 1fr;
  gap: 3.5rem;
  align-items: start;
}

.page-aside {
  position: sticky;
  top: 2rem;
}

.page-main {
  min-width: 0;
}

@media (max-width: 899px) {
  .page-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .page-aside {
    position: static;
  }
}

.header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.photo {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.header-text {
  flex: 1;
  min-width: 0;
}

@media (max-width: 420px) {
  .header {
    flex-direction: column;
  }
}

.page-aside .bio {
  margin-bottom: 0;
}

.page-aside .bio p {
  margin-bottom: 0;
}

.page-aside .header {
  flex-direction: column;
}

.page-aside .photo {
  width: 180px;
  height: 180px;
}

.page-aside .timeline {
  padding-left: 6rem;
}

.page-aside .timeline::before {
  left: 4.5rem;
}

.page-aside .timeline-marker {
  left: -1rem;
}

.page-aside .timeline-date {
  margin-right: 1.5rem;
  font-size: 0.8rem;
}

@media (max-width: 899px) {
  .page-aside .header {
    flex-direction: row;
  }

  .page-aside .photo {
    width: 240px;
    height: 240px;
  }

  .page-aside .timeline {
    padding-left: 8rem;
  }

  .page-aside .timeline::before {
    left: 6.5rem;
  }

  .page-aside .timeline-marker {
    left: -1.5rem;
  }

  .page-aside .timeline-date {
    margin-right: 2.25rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .page-aside .header {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .timeline {
    padding-left: 0;
  }

  .timeline::before {
    left: 0;
  }

  .timeline-marker {
    left: -0.25rem;
  }

  .timeline-date {
    position: static;
    width: auto;
    margin-bottom: 0.25rem;
  }

  .timeline-item {
    padding-left: 1.5rem;
  }
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.tagline {
  font-size: 1.1rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.contact-top {
  font-size: 0.95rem;
  color: var(--color-muted);
  margin-bottom: 0;
}

.contact-top a {
  color: var(--color-link);
  text-decoration: none;
}

.contact-top a:hover {
  text-decoration: underline;
}

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 8rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6.5rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 2rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-text);
  border: 2px solid var(--color-inverse);
  box-shadow: 0 0 0 1px var(--color-border);
}

.timeline-date {
  position: absolute;
  right: 100%;
  margin-right: 2.25rem;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo,
    monospace;
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.5;
  white-space: nowrap;
  text-align: right;
}

.timeline-content p {
  margin: 0;
}

main > p,
.page-main > p {
  margin-bottom: 0.75rem;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  color: var(--color-link-hover);
}

h2 {
  font-size: 1rem;
  font-weight: 600;
  text-transform: lowercase;
  color: var(--color-text);
  margin-bottom: 1rem;
  font-family: inherit;
}

h2 + p,
h2 + ul {
  margin-top: 0;
}

ul {
  margin: 0 0 1rem 1.25rem;
}

li {
  margin-bottom: 0.4rem;
}

.activity-with-thumb {
  list-style: none;
  margin-left: -1.25rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.activity-thumb {
  width: 160px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  display: block;
}

.activity-thumb-link:hover .activity-thumb {
  opacity: 0.9;
}

.activity-thumb-logo {
  object-fit: contain;
  padding: 0.1rem;
  background: var(--color-bg-muted);
}

.activity-thumb-dual {
  display: flex;
  width: 160px;
}

.activity-thumb-dual .activity-thumb {
  width: 80px;
  height: 90px;
  flex-shrink: 0;
}

.activity-text {
  flex: 1;
  min-width: 0;
}

.footer-note {
  margin-top: 3rem;
  font-size: 0.85rem;
  color: var(--color-muted);
  font-style: italic;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.theme-toggle:hover {
  background: var(--color-bg-muted);
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Moon = switch to dark (shown in light mode), Sun = switch to light (shown in dark mode) */
.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

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

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

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