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

:root {
  --color-text: #1c1917;
  --color-text-body: #292524;
  --color-text-muted: #57534e;
  --color-text-soft: #78716c;
  --color-bg-1: #faf8f5;
  --color-bg-2: #f0ebe4;
  --color-bg-3: #e8e2d9;
  --color-border: rgba(28, 25, 23, 0.12);
  --color-border-subtle: rgba(28, 25, 23, 0.08);
  --color-border-toggle: rgba(28, 25, 23, 0.1);
  --color-panel: rgba(255, 255, 255, 0.75);
  --color-toggle-wrap: rgba(255, 255, 255, 0.55);
  --color-toggle-wrap-shadow: rgba(28, 25, 23, 0.04);
  --color-role-text: #57534e;
  --color-role-hover-text: #1c1917;
  --color-role-hover-bg: rgba(255, 255, 255, 0.7);
  --color-role-active-bg: #1c1917;
  --color-role-active-text: #fff;
  --color-role-active-shadow: rgba(28, 25, 23, 0.2);
  --color-panel-shadow: rgba(28, 25, 23, 0.06);
  --color-detail-note: #44403c;
  --color-link: #92400e;
  --color-footer-sep: #a8a29e;
  --color-focus: #b45309;
  --color-theme-btn-bg: rgba(255, 255, 255, 0.6);
  --color-theme-btn-border: rgba(28, 25, 23, 0.12);
  --color-theme-btn-text: #44403c;
}

html[data-theme="dark"] {
  --color-text: #fafaf9;
  --color-text-body: #e7e5e4;
  --color-text-muted: #a8a29e;
  --color-text-soft: #a8a29e;
  --color-bg-1: #0c0a09;
  --color-bg-2: #1c1917;
  --color-bg-3: #292524;
  --color-border: rgba(250, 250, 249, 0.1);
  --color-border-subtle: rgba(250, 250, 249, 0.08);
  --color-border-toggle: rgba(250, 250, 249, 0.12);
  --color-panel: rgba(41, 37, 36, 0.92);
  --color-toggle-wrap: rgba(28, 25, 23, 0.55);
  --color-toggle-wrap-shadow: rgba(0, 0, 0, 0.2);
  --color-role-text: #d6d3d1;
  --color-role-hover-text: #fafaf9;
  --color-role-hover-bg: rgba(68, 64, 60, 0.45);
  --color-role-active-bg: #f5f5f4;
  --color-role-active-text: #1c1917;
  --color-role-active-shadow: rgba(0, 0, 0, 0.25);
  --color-panel-shadow: rgba(0, 0, 0, 0.2);
  --color-detail-note: #d6d3d1;
  --color-link: #fbbf24;
  --color-footer-sep: #78716c;
  --color-focus: #fbbf24;
  --color-theme-btn-bg: rgba(68, 64, 60, 0.5);
  --color-theme-btn-border: rgba(250, 250, 249, 0.12);
  --color-theme-btn-text: #e7e5e4;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--color-text);
  background: linear-gradient(
    165deg,
    var(--color-bg-1) 0%,
    var(--color-bg-2) 45%,
    var(--color-bg-3) 100%
  );
  transition: color 0.2s ease, background 0.2s ease;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  padding-left: max(1rem, env(safe-area-inset-left));
}

@media (min-width: 30rem) {
  .page {
    padding: 2.5rem 1.5rem 3rem;
    padding-top: max(2.5rem, env(safe-area-inset-top));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-bottom: max(3rem, env(safe-area-inset-bottom));
    padding-left: max(1.5rem, env(safe-area-inset-left));
  }
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

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

.theme-toggle {
  flex-shrink: 0;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-theme-btn-text);
  background: var(--color-theme-btn-bg);
  border: 1px solid var(--color-theme-btn-border);
  border-radius: 0.45rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  filter: brightness(1.05);
}

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

.theme-toggle i {
  font-size: 1.1rem;
  line-height: 1;
}

.name {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.social-links {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

.social-links li {
  display: inline-flex;
  align-items: center;
}

.social-links__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-link);
  text-decoration: none;
}

.social-links__link:hover {
  text-decoration: underline;
}

.social-links__link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 0.2rem;
}

.social-links__link i {
  font-size: 1.05em;
  opacity: 0.95;
}

.footer__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.summary h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.summary-text {
  margin: 0;
  color: var(--color-text-body);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.summary-contact {
  margin-top: 0.75rem;
}

.summary a {
  color: var(--color-link);
  text-decoration: none;
  font-weight: 500;
}

.summary a:hover {
  text-decoration: underline;
}

.summary a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 0.2rem;
}

.role-toggle {
  margin-top: 2rem;
  margin-bottom: 1.25rem;
}

.role-sentence {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.5rem;
  line-height: 1.5;
  color: var(--color-text-body);
}

.role-sentence-lead {
  font-weight: 500;
}

.role-sentence-end {
  font-weight: 500;
  color: var(--color-text-body);
}

.role-toggle-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 0.65rem;
  background: var(--color-toggle-wrap);
  border: 1px solid var(--color-border-toggle);
  box-shadow: 0 1px 2px var(--color-toggle-wrap-shadow);
}

.role-btn {
  flex: 1 1 auto;
  min-width: min(100%, 8rem);
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-role-text);
  background: transparent;
  border: none;
  border-radius: 0.45rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

a.role-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  color: var(--color-role-text);
}

.role-btn:hover {
  color: var(--color-role-hover-text);
  background: var(--color-role-hover-bg);
}

.role-btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.role-btn.is-active {
  color: var(--color-role-active-text);
  background: var(--color-role-active-bg);
  box-shadow: 0 2px 8px var(--color-role-active-shadow);
}

.details {
  position: relative;
}

.detail-panel {
  padding: 1.25rem 1.35rem;
  border-radius: 0.65rem;
  background: var(--color-panel);
  border: 1px solid var(--color-border-subtle);
  box-shadow: 0 4px 24px var(--color-panel-shadow);
}

.detail-panel[hidden] {
  display: none;
}

.detail-panel h3 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.detail-list {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
}

.detail-list li {
  margin-bottom: 0.4rem;
}

.detail-list li:last-child {
  margin-bottom: 0;
}

.detail-note {
  margin: 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--color-border-subtle);
  font-size: 0.95rem;
  color: var(--color-detail-note);
}

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

.detail-panel a:hover {
  text-decoration: underline;
}

.detail-intro {
  margin: 0 0 1rem;
  color: var(--color-text-body);
  font-size: 0.98rem;
}

.advocate-section + .advocate-section,
.engineer-section + .engineer-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-subtle);
}

.advocate-section h4,
.engineer-section h4 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-soft);
}

.advocate-section .detail-list,
.engineer-section .detail-list {
  margin-bottom: 0;
}

.detail-list--advocate-links li {
  margin-bottom: 0.5rem;
}

.detail-list--advocate-links li:last-child {
  margin-bottom: 0;
}

.detail-list--advocate-links a {
  font-weight: 600;
}

.skills-summary {
  margin: 0 0 1rem;
  color: var(--color-text-body);
  font-size: 0.98rem;
}

/* Labels (Tools:, Built using:) bold; stack lists stay regular weight */
.text-label {
  font-weight: 600;
  color: var(--color-text);
  margin-right: 0.35em;
}

.project-title {
  display: block;
  font-weight: 600;
  margin: 0 0 0.15rem;
}

.project-award {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-muted);
  line-height: 1.35;
  margin: 0 0 0.25rem;
}

.project-desc {
  display: block;
  margin: 0 0 0.35rem;
  line-height: 1.45;
}

.project-tools {
  display: block;
  margin: 0;
  line-height: 1.45;
}

.detail-panel a.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-link);
  background: var(--color-toggle-wrap);
  border: 1px solid var(--color-border-toggle);
  border-radius: 0.45rem;
  text-decoration: none;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.detail-panel a.project-link:hover {
  text-decoration: none;
  background: var(--color-role-hover-bg);
  border-color: var(--color-border);
}

.detail-panel a.project-link:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.detail-panel a.project-link i {
  font-size: 0.75rem;
  opacity: 0.9;
}

.engineer-section .detail-list:last-child {
  margin-bottom: 0;
}

.experience-block {
  margin: 0 0 1rem;
}

.experience-block:last-child {
  margin-bottom: 0;
}

.experience-meta {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
}

.experience-company {
  margin: 0 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.experience-job {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text-body);
}

.experience-dates {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.experience-block .detail-list {
  margin-bottom: 0;
}

.education-block + .education-block {
  margin-top: 0.4rem;
  padding-top: 0;
  border-top: none;
}

.education-block .detail-list:last-child {
  margin-bottom: 0;
}

.detail-list--one {
  list-style-position: outside;
}

.detail-list--projects li {
  margin-bottom: 1rem;
  line-height: 1.45;
}

.detail-list--projects li:last-child {
  margin-bottom: 0;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.footer a {
  color: var(--color-link);
  text-decoration: none;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.footer a:hover {
  text-decoration: underline;
}

.footer-sep {
  margin: 0 0.35rem;
  color: var(--color-footer-sep);
}

/* Narrow screens: comfortable reading width, stacked controls, no horizontal scroll */
@media (max-width: 29.99rem) {
  .header {
    gap: 0.75rem;
  }

  .role-sentence {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .role-sentence-lead {
    align-self: flex-start;
  }

  .role-toggle-buttons {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .role-btn {
    flex: none;
    min-width: 0;
    width: 100%;
    text-align: center;
  }

  .role-sentence-end {
    align-self: flex-start;
    margin-top: -0.35rem;
  }
}

@media (max-width: 22rem) {
  .name {
    font-size: 1.5rem;
  }
}
