:root {
  color-scheme: light;
  --black: #111111;
  --yellow: #f59e0b;
  --background: #fafafa;
  --primary: #fafafa;
  --primary-contrast: #111111;
  --muted: #656565;
  --muted-dark: #dedede;
  --link: #2563eb;
}

/* System preference also works when JavaScript is disabled. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --black: #111111;
    --yellow: #f59e0b;
    --background: #111111;
    --primary: #111111;
    --primary-contrast: #ffffff;
    --muted: #a1a1a1;
    --muted-dark: #353535;
    --link: #60a5fa;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #111111;
  --primary: #111111;
  --primary-contrast: #ffffff;
  --muted: #a1a1a1;
  --muted-dark: #353535;
  --link: #60a5fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--primary-contrast);
  font-family: "IBM Plex Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(2rem, 5vh, 4rem) 1.5rem;
}

.profile { width: min(100%, 40rem); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.domain { margin: 0; color: var(--muted); font-size: 0.875rem; letter-spacing: 0.02em; }
.name-period { color: var(--muted); }

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 3.25rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.04em;
}

.summary { margin: 0.9rem 0 0; max-width: 30rem; color: var(--muted); font-size: 1.125rem; line-height: 1.7; }
.profile-section { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.5rem; padding: 0; margin-top: 1.75rem; }
.profile-section h2 { margin: 0; color: var(--muted); font-size: 0.875rem; font-weight: 400; line-height: 1.6; }
.entries { display: grid; gap: 1.25rem; }
.entry-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; }
.entry h3 { margin: 0; font-size: 1rem; font-weight: 400; line-height: 1.5; }
.entry p { margin: 0.4rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.entry .date { margin: 0; font-size: 0.875rem; }
.skills { display: flex; flex-wrap: wrap; gap: 0.6rem; list-style: none; margin: 0; padding: 0; }
.contact { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }

.entry-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.entry-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex: 0 0 1rem;
  object-fit: cover;
  border-radius: 0.3rem;
}

/* Filled contrast boxes with primary-colored text. */
.keyword { display: inline-block; padding: 0 0.16em 0.04em; background: var(--yellow); color: var(--black); line-height: 1.1; }
.skills .keyword { padding: 0.1rem 0.25rem; font-size: 0.875rem; line-height: 1.2; }

.external-link {
  display: inline-block;
  margin-top: 0.65rem;
  color: var(--link);
  font-size: 0.95rem;
  text-decoration: none;
}

.external-link:hover { text-decoration: underline; }
.external-link:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }

.theme-toggle {
  min-height: 44px;
  flex-shrink: 0;
  padding: 0.5rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--primary-contrast); }
.theme-toggle[aria-pressed="true"] { color: var(--primary-contrast); }
.profile-section[aria-labelledby="contact"] { border-top: 1px solid var(--muted-dark); padding-top: 1.5rem; margin-top: 3rem; }
.theme-toggle:focus-visible { outline: 2px solid var(--primary-contrast); outline-offset: 5px; }

@media (max-width: 540px) {
  main { padding: 2rem 1.5rem; }
  .profile-section { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .masthead { margin-bottom: 1.75rem; }
}

@media print {
  :root { --background: #fff; --primary: #fff; --primary-contrast: #111; --muted: #555; --muted-dark: #ddd; --link: #2563eb; }
  :root[data-theme], :root:not([data-theme]) { color-scheme: light; --background: #fff; --primary: #fff; --primary-contrast: #111; --muted: #555; --muted-dark: #ddd; --link: #2563eb; }
  main { min-height: auto; padding: 0; display: block; }
  .profile { width: 100%; }
  .theme-toggle { display: none; }
  .profile-section { break-inside: avoid; }
}

.secondary, .entry .detail { color: var(--muted); }
.entry .detail { font-size: 0.875rem; }
.focus { border-top: 1px solid var(--muted-dark); padding-top: 1.5rem; }
