:root {
  --pico-font-size: 16px;
  --pico-spacing: 1rem;
}

body {
  padding-top: 1rem;
}

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

header h1 a::after {
  content: "↩";
  display: inline-block;
  margin-left: 0.4rem;
  color: var(--pico-h1-color);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

header h1 a:hover,
header h1 a:focus-visible {
  color: var(--pico-primary);
  text-decoration: underline;
}

header h1 a:hover::after,
header h1 a:focus-visible::after {
  opacity: 1;
}

header nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

header nav a {
  text-decoration: none;
}

.subtitle {
  font-size: 1.25rem;
  color: var(--pico-muted-color);
  margin-bottom: 0.5rem;
}

#summary .summary-quote {
  position: relative;
  margin: 1.5rem 0;
  padding: 1rem 1.5rem 1rem 4rem;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--pico-color);
  max-width: 60ch;
  border-left: none;
}

#summary .summary-quote::before {
  content: "\201C";
  position: absolute;
  top: -1.5rem;
  left: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8rem;
  line-height: 1;
  font-style: normal;
  color: var(--pico-muted-color);
  opacity: 0.25;
  pointer-events: none;
}

#assessments article {
  margin-bottom: 1rem;
}

#assessments .footnote {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  margin-bottom: 0.5rem;
}

#assessments .quotes {
  margin-top: 0.25rem;
  padding-left: 1.5rem;
}

#assessments .quotes li {
  margin: 0.25rem 0;
  font-style: italic;
}

#references dt {
  font-weight: bold;
  margin-top: 0.5rem;
}

#references dd {
  margin-left: 1rem;
  color: var(--pico-muted-color);
}

.training-seal {
  float: right;
  margin: 0 0 0.5rem 0.5rem;
  display: inline-block;
}

.training-seal img {
  width: 60px;
  height: auto;
  display: block;
}

.language-switcher {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.5rem;
  padding: 0;
  justify-content: flex-start;
}

.language-switcher button {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: var(--pico-secondary-background);
  border: 1px solid var(--pico-secondary-border);
  color: var(--pico-secondary-inverse);
  cursor: pointer;
  border-radius: 0.25rem;
}

.language-switcher button.active {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-color: var(--pico-primary-border);
}

.language-switcher button:hover {
  background: var(--pico-secondary-hover-background);
}

/* ---- Collapsible accordion ---- */

.collapsible {
  margin: 1rem 0;
}

.collapsible-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.collapsible-header::before {
  content: "\203A"; /* single right-pointing angle ›  */
  display: inline-block;
  font-size: 1.4em;
  line-height: 1;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.collapsible.expanded .collapsible-header::before {
  transform: rotate(90deg);
}

.collapsible-badge {
  font-size: 0.75rem;
  font-weight: normal;
  padding: 0.1rem 0.5rem;
  border-radius: 1rem;
  background: var(--pico-secondary-background);
  color: var(--pico-muted-color);
  border: 1px solid var(--pico-secondary-border);
  white-space: nowrap;
}

.collapsible-badge:empty {
  display: none;
}

.collapsible-badge.has-active {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-color: var(--pico-primary-border);
}

.collapsible-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  .collapsible-body {
    transition: none;
  }
  header h1 a::after {
    transition: none;
  }
  .tags button {
    transition: none;
  }
  .reference-btn {
    transition: none;
  }
}

.collapsible.expanded .collapsible-body {
  grid-template-rows: 1fr;
}

.collapsible-body > div {
  overflow: hidden;
}

.collapsible.expanded .collapsible-body > div {
  padding-top: 1rem;
}

/* ---- Profile selector ---- */

#profile-selector select {
  max-width: 400px;
  margin-bottom: 1rem;
}

/* ---- Tag cloud ---- */

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

.tags li {
  display: inline-block;
  margin: 0;
}

.tags button {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tags button:not([aria-pressed="true"]) {
  background-color: var(--pico-secondary-background);
  color: var(--pico-secondary-inverse);
  border: 1px solid var(--pico-secondary-border);
}

.tags button[aria-pressed="true"] {
  background-color: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-color: var(--pico-primary-border);
}

.tags button:hover:not([aria-pressed="true"]) {
  background-color: var(--pico-secondary-hover-background);
}

.filter-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.reference-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
  opacity: 0.5;
  transition: opacity 0.2s;
  vertical-align: middle;
  line-height: 1;
}

.reference-btn:hover {
  opacity: 1;
}

#experience article {
  margin-bottom: 1.5rem;
}

#experience article header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

#experience article header > span:first-child {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1rem;
}

#experience article header h3 {
  margin: 0 0.5rem 0 0;
  font-size: 1.25rem;
  display: inline;
}

#experience article .period {
  font-size: 0.875rem;
  color: var(--pico-muted-color);
  white-space: nowrap;
}

#experience article .company {
  font-weight: 600;
  color: var(--pico-primary);
}

.company-logo {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  height: 3rem;
  width: auto;
  opacity: 0.2;
  z-index: 0;
}

#experience article {
  position: relative;
  z-index: 1;
}

#experience article .tags {
  margin: 0.5rem 0;
}

dt {
  font-weight: 600;
}

dl.tags dt {
  font-weight: normal;
}

dl.tags dd,
ul.tags li {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  margin: 0.15rem 0.1rem;
  font-size: 0.75rem;
  border-radius: 0.25rem;
  background-color: var(--pico-secondary-background);
  color: var(--pico-secondary-inverse);
  border: 1px solid var(--pico-secondary-border);
}

ul.tags li.highlight {
  border-color: var(--pico-primary-border);
}

#contact dl,
#personal dl,
#trainings dl,
#awards dl,
#fellowships dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
}

#personal dl.tags dd {
  width: fit-content;
}

#contact dd ul {
  display: inline;
  padding: 0;
  margin: 0;
  list-style: none;
}

#contact dd ul li {
  display: inline;
}

#contact dd ul li:not(:last-child)::after {
  content: " \00B7 ";
  margin-right: 0.25rem;
}

#education article {
  margin-bottom: 1rem;
}

#education article header {
  font-size: 0.875rem;
  color: var(--pico-muted-color);
  margin-bottom: 0.25rem;
}

#education dl {
  margin: 0;
}

#education dd {
  margin-left: 0;
  margin-bottom: 0.5rem;
}

/* Side-by-side definition list. Each conference is a spec-compliant
   <div> group (HTML5 allows <div> to wrap dt/dd groups in a <dl>),
   rendered as a CSS table row: the <dt> is the term cell and the run
   of <dd> siblings is auto-wrapped into a single second cell, so the
   term column auto-sizes and stays aligned across every group -- no
   fixed widths and no subgrid (which CSS validators still reject). */
#avocational dl {
  margin: 0;
  display: table;
  width: 100%;
  border-spacing: 0 0.35rem;
}

#avocational dl > div {
  display: table-row;
}

#avocational dt {
  display: table-cell;
  /* width:1% + nowrap shrink the term column to its content (the
     longest conference label) so the table's 100% width doesn't
     inflate it -- the second column absorbs the remaining space. */
  width: 1%;
  padding-right: 1rem;
  white-space: nowrap;
  vertical-align: baseline;
}

#avocational dd {
  display: block;
  margin: 0;
}

#skills,
#api {
  margin: 2rem 0;
}

#skills article,
#api-experience article {
  margin-bottom: 1rem;
}

#skills article header,
#api-experience article header {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

#skills article .tags,
#api-experience article .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--pico-muted-border);
  text-align: center;
}

footer [aria-label="love"] {
  color: red;
  display: inline-block;
  animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
  0% { transform: scale(1); }
  15% { transform: scale(1.3); }
  30% { transform: scale(1); }
  45% { transform: scale(1.3); }
  60% { transform: scale(1); }
  80% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

dialog {
  width: 90vw;
  height: 90vh;
}

@media (min-width: 768px) {
  dialog > article {
    max-width: 1200px;
  }
}

dialog article {
  height: 100%;
  display: flex;
  flex-direction: column;
}

dialog iframe {
  flex: 1;
  border: none;
  border-radius: var(--pico-border-radius);
}

dialog .dialog-hint {
  font-size: 0.75rem;
  color: var(--pico-muted-color);
  margin: 0;
  padding: 0.5rem 0;
  text-align: left;
}

dialog .dialog-hint kbd {
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--pico-muted-border);
  border-radius: 0.2rem;
  background: var(--pico-secondary-background);
  font-family: inherit;
}

dialog iframe {
  width: 100%;
  height: calc(100% - 3rem);
  border: none;
  border-radius: 0.25rem;
}

#toggle-sections label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

#extra-sections section {
  margin-bottom: 2rem;
}

@media (max-width: 575px) {
  header nav ul {
    display: inline-grid;
    gap: 0;
  }

  header nav li {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }

  #experience article header {
    flex-direction: column;
  }

  #experience article .period {
    order: -1;
  }

  #contact dl,
  #personal {
    grid-template-columns: 1fr;
    padding-left: 1rem;
    gap: 0;
  }

  #contact dt,
  #personal dt {
    margin-top: 0.5rem;
    margin-left: 0;
  }

  .company-logo {
    top: 0.5rem;
    bottom: auto;
  }

  #contact dd,
  #personal dd {
    margin-left: 0;
  }

  #contact dt:first-of-type,
  #personal dt:first-of-type {
    margin-top: 0;
  }
}

@media print {
  @page {
    margin: 1.5cm 1cm;
  }

  body {
    padding: 0;
  }

  header nav,
  #profile-selector,
  #tag-cloud,
  #toggle-sections,
  .filter-buttons,
  footer,
  .language-switcher,
  .reference-btn,
  .company-logo {
    display: none !important;
  }

  [data-tooltip]::after {
    content: " (" attr(data-tooltip) ")";
    background: transparent !important;
    border: none !important;
    color: inherit !important;
    display: inline !important;
    font-size: inherit !important;
    font-style: normal !important;
    font-weight: normal !important;
    margin: 0 !important;
    opacity: 1 !important;
    padding: 0 !important;
    pointer-events: auto !important;
    position: static !important;
    text-decoration: none !important;
    text-overflow: inherit !important;
    transform: none !important;
    white-space: inherit !important;
    z-index: auto !important;
  }

  main {
    padding: 0;
    max-width: 100%;
    display: block;
  }

  main > section {
    margin-bottom: 0.75rem;
  }

  #personal,
  #api-experience,
  #avocational,
  #trainings,
  #education,
  #awards,
  #fellowships,
  #interests,
  #skills,
  #contact {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #personal:not([hidden]),
  #api-experience:not([hidden]),
  #avocational:not([hidden]),
  #trainings:not([hidden]),
  #education:not([hidden]),
  #awards:not([hidden]),
  #fellowships:not([hidden]),
  #interests:not([hidden]),
  #skills:not([hidden]),
  #experience:not([hidden]),
  #contact:not([hidden]) {
    display: block !important;
  }

  article {
    break-inside: avoid;
    page-break-inside: avoid;
    border: none;
    padding: 0.25rem 0;
  }

  article header {
    margin: 0;
    padding: 0.15rem 0;
    background: none;
    border-bottom: none;
  }

  #experience article {
    margin-bottom: 0.5rem;
  }

  #experience article header {
    margin-bottom: 0.15rem;
  }

  #experience article .period {
    padding-right: 0.35rem;
  }

  #experience article .tags {
    margin: 0.25rem 0 0;
  }

  #experience article p {
    margin: 0.15rem 0;
  }

  h2 {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.3;
    margin: 1.75rem 0 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--pico-muted-border);
    break-after: avoid;
    page-break-after: avoid;
    break-inside: avoid;
  }

  main > section:first-of-type h2 {
    margin-top: 0;
  }

  h3 {
    font-size: 1rem;
  }

  dl.tags dd,
  ul.tags li,
  dl.tags dd.highlight,
  ul.tags li.highlight {
    border: 1px solid gray;
    background: none;
    color: black;
  }

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

  #contact,
  #skills,
  #education {
    display: block;
  }

  #contact {
    margin-bottom: 1rem;
  }

  #contact dl,
  #personal {
    gap: 0;
  }

  #skills article {
    display: block;
    width: 100%;
  }

  #education dl {
    display: block;
    width: 100%;
  }

  #persistence-icons {
    display: none !important;
  }

  #copy-permalink {
    display: none !important;
  }
}

#persistence-icons {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 0;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#persistence-icons.active {
  opacity: 1;
  pointer-events: auto;
}

#persistence-icons button {
  border: 1px dotted var(--pico-muted-border-color);
  border-radius: 40%;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  padding: 0;
  font-size: 2rem;
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.8);
  transition:
    transform 0.2s ease-out,
    box-shadow 0.2s ease-out,
    margin 0.2s ease-out;
  margin-left: -2rem;
  z-index: 1;
}

#persistence-icons button:nth-of-type(1) { z-index: 5; }
#persistence-icons button:nth-of-type(2) { z-index: 4; }
#persistence-icons button:nth-of-type(3) { z-index: 3; }
#persistence-icons button:nth-of-type(4) { z-index: 2; }

#persistence-icons:hover button {
  margin-left: 0.5rem;
  z-index: 100;
}

#persistence-icons button:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow:
    0 8px 0 var(--cookie-shadow),
    0 12px 20px rgba(0, 0, 0, 0.25),
    inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

#persistence-icons button:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 0 var(--cookie-shadow),
    0 3px 5px rgba(0, 0, 0, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

#persistence-icons button span {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

#persistence-icons button .icon-base,
#persistence-icons button .icon-fire {
  position: absolute;
  transition: opacity 2s ease;
}

#persistence-icons button .icon-base {
  opacity: 1;
}

#persistence-icons button .icon-fire {
  opacity: 0;
}

#persistence-icons button:hover .icon-base {
  opacity: 0;
}

#persistence-icons button:hover .icon-fire {
  opacity: 1;
}

#persistence-icons [data-tooltip]::before {
  white-space: normal;
}

#copy-permalink.copied {
  background-color: var(--pico-success-background);
  border-color: var(--pico-success-border);
  color: var(--pico-success-inverse);
}
