:root {
  color-scheme: light;
  --ink: #2c302c;
  --muted: #65665e;
  --accent: #8b4233;
  --paper: #fbf8ef;
  --rule: #d7d4c8;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #c29f75;
  min-width: 280px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 0%, #fff7dc38, transparent 65%),
    linear-gradient(#5c3e1610, #5c3e1620),
    url("assets/desk.png") center / cover;
}

.desk {
  padding: 58px 32px 28px;
  overflow: hidden;
}

.paper {
  position: relative;
  isolation: isolate;
  width: min(100%, 860px);
  aspect-ratio: 210 / 297;
  display: flex;
  flex-direction: column;
  scroll-margin-top: 28px;
  margin: 0 auto;
  padding: 55px 64px 30px;
  background:
    radial-gradient(ellipse at 0% 90%, #dac89c14, transparent 45%),
    linear-gradient(110deg, #ffffff45, transparent 30%, #e2d8bd0a 80%),
    var(--paper);
  box-shadow:
    0 1px 2px #372c233d,
    1px 6px 8px #372c232e,
    4px 24px 48px #372c2340,
    inset 0 0 24px #d3c9ac14;
  transform: rotate(-.35deg);
}

.paper::before {
  content: "";
  position: absolute;
  inset: 5px -4px -5px 3px;
  z-index: -1;
  background: var(--paper);
  border-right: 6px solid #efeadd;
  border-bottom: 6px solid #efeadd;
  filter: drop-shadow(0 3px 3px #372c2326);
  transform: rotate(.7deg);
}

.paper::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: .045;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23735e40' opacity='.6' filter='url(%23n)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.paper + .paper { margin-top: 64px; }

.coffee-stain {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.coffee-stain::before {
  content: "";
  position: absolute;
  top: 90px;
  right: -33%;
  width: 44%;
  aspect-ratio: 1312 / 1199;
  background: url("assets/coffee-ring.png") center / contain no-repeat;
  opacity: .32;
  mix-blend-mode: multiply;
}

.paper-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cv-header { container-type: inline-size; }

.identity {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
}

h1 {
  margin: 0;
  font: 700 4.4rem / 1.05 Georgia, "Times New Roman", serif;
  letter-spacing: -.065em;
}

.name-period { color: var(--accent); }

.photo-slot {
  position: relative;
  align-self: stretch;
  pointer-events: none;
}

.cv-photo {
  position: absolute;
  z-index: 2;
  top: -49px;
  left: 50%;
  width: 110px;
  margin: 0;
  padding: 9px 8px 11px;
  background: linear-gradient(120deg, #fffefa, #f3f0e7);
  box-shadow:
    0 1px 2px #30271d35,
    3px 6px 9px #30271d30,
    inset 0 0 0 1px #e2ddd0;
  transform: translateX(-50%) rotate(-8deg);
}

.cv-photo img { display: block; width: 100%; height: auto; }

.cv-photo::after {
  content: "";
  position: absolute;
  inset: 9px 8px 11px;
  background: linear-gradient(135deg, #ffffff10, transparent 55%);
  box-shadow: inset 0 0 0 1px #30271d15;
  pointer-events: none;
}

.photo-staple {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: calc(50% - 14px);
  width: 28px;
  height: 3px;
  border: 1px solid #7b7d77;
  border-radius: 2px;
  background: linear-gradient(#fff, #c5c8c1 35%, #858982 75%, #d8dbd3);
  box-shadow: 0 1px 1px #29251f65;
  transform: rotate(9deg);
}

.photo-staple::before, .photo-staple::after {
  content: "";
  position: absolute;
  top: -1px;
  width: 2px;
  height: 5px;
  border-radius: 1px;
  background: linear-gradient(90deg, #747770, #e6e8e1);
  box-shadow: 0 1px 1px #29251f80;
}

.photo-staple::before { left: -1px; }
.photo-staple::after { right: -1px; }

.intro {
  margin: 29px 0 31px;
  font: 400 1.125rem / 1.55 Georgia, "Times New Roman", serif;
  letter-spacing: -.018em;
}

.intro p { margin: 0; }
.intro p + p { margin-top: 14px; }

.contact-details {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .875rem;
  line-height: 1.4;
}

.contact-details li { white-space: nowrap; }
.contact-details abbr { text-decoration: none; }
.contact-details a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.contact-details a:hover { color: var(--accent); }
.contact-details a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cv-header::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  background: var(--accent);
}

.experience {
  margin-top: 31px;
}

.role { margin-top: 27px; }
.experience > .role:first-child { margin-top: 0; }
.role + .role {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.role--continuation { margin-top: 0; }

.certifications-section .role-header { margin-bottom: 6px; }
.certification-list { margin: 0; font-size: 1rem; line-height: 1.55; }

.role-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  align-items: baseline;
  margin-bottom: 15px;
}

.role-header--stacked {
  flex-direction: column;
  align-items: flex-start;
}

.role-header--stacked .dates {
  margin-left: 0;
  white-space: normal;
}

.role-header h2, .role-toggle h2 {
  margin: 0;
  font: 700 1.125rem / 1.45 Georgia, "Times New Roman", serif;
  letter-spacing: -.02em;
}

.dates {
  flex-shrink: 0;
  margin: 0 0 0 auto;
  color: #000;
  font-family: "Courier New", monospace;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.achievements { list-style: none; padding: 0; margin: 0; }

summary {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-height: 40px;
  padding: 6px 6px 6px 19px;
  font-size: 1rem;
  line-height: 1.55;
  cursor: pointer;
  list-style: none;
  border-radius: 2px;
  transition: background-color .16s ease, color .16s ease;
}

.achievement-text {
  position: relative;
  margin: 0;
  padding: 6px 6px 6px 19px;
  font-size: 1rem;
  line-height: 1.55;
}

summary::-webkit-details-marker { display: none; }
summary::marker { content: ""; }

summary::before, .achievement-text::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 17px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

summary > span:first-child { flex: 1; }
strong { font-weight: 600; }

.disclosure {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin-top: .275rem;
  color: var(--accent);
  opacity: .65;
}

.disclosure::before, .disclosure::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.disclosure::before { top: 7px; left: 3px; width: 10px; height: 1px; }
.disclosure::after { top: 3px; left: 7px; width: 1px; height: 10px; }
details[open] .disclosure::after { display: none; }

summary:hover { color: var(--accent); background: #8b42330a; }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
details[open] summary { color: var(--accent); }

.role-toggle {
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 0;
  line-height: 1.45;
}

.role-toggle::before { display: none; }
.role-toggle h2 { flex: 1; }

.role-chevron {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(-45deg);
}

.role-disclosure[open] .role-chevron { transform: rotate(45deg); }
.role-details { margin-top: 6px; }
.role-details .dates { margin: 0 0 15px; white-space: normal; }

.story {
  margin: 4px 22px 17px 19px;
  padding: 5px 0 5px 17px;
  border-left: 2px solid #8b42334d;
  color: #56594f;
  font-size: 1rem;
  line-height: 1.7;
  animation: reveal .18s ease-out;
}

.story p { margin: 0; }
.story p + p { margin-top: 10px; }

@keyframes reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

@container (max-width: 660px) {
  .identity {
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 14px 16px;
  }
  .identity h1 { grid-column: 1 / -1; }
  .contact-details { grid-column: 1; grid-row: 2; }
  .photo-slot { grid-column: 2; grid-row: 2; }
  .cv-photo { top: -6px; width: 82px; padding: 6px 5px 8px; }
  .cv-photo::after { inset: 6px 5px 8px; }
  .photo-staple { top: 1px; width: 24px; left: calc(50% - 12px); }
}

@media (max-width: 700px) {
  .desk { padding: 28px 20px 20px; }
  .paper { padding: 36px 30px 26px; aspect-ratio: auto; transform: rotate(0); }
  .paper + .paper { margin-top: 40px; }
  h1 { font-size: clamp(2.5rem, 8.5vw, 3.75rem); }
  .coffee-stain::before { top: 260px; }
  .intro { margin-top: 26px; }
  .desktop-break { display: none; }
  .role-header { flex-direction: column; gap: 6px; }
  .dates { margin-left: 0; }
  summary { padding-top: 8px; padding-bottom: 8px; min-height: 48px; gap: 10px; }
  .achievement-text { padding-top: 8px; padding-bottom: 8px; }
  summary::before, .achievement-text::before { top: 19px; }
  .story { margin-right: 0; padding-left: 12px; }
}

@media (max-width: 360px) {
  .desk { padding: 16px 12px; }
  .paper { padding: 30px 20px 24px; }
  .identity { grid-template-columns: minmax(0, 1fr) 76px; gap: 14px 12px; }
  .cv-photo { width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  @page { size: A4; margin: 15mm; }
  body { background: white; }
  body::before, .paper::before, .paper::after, .coffee-stain, .disclosure, .role-chevron { display: none; }
  .desk { padding: 0; overflow: visible; }
  .paper { width: 100%; padding: 0; aspect-ratio: auto; background: white; box-shadow: none; transform: none; }
  .cv-photo { top: -6px; width: 82px; padding: 6px 5px 8px; box-shadow: none; transform: translateX(-50%) rotate(-7deg); }
  .cv-photo::after { inset: 6px 5px 8px; }
  .paper + .paper { margin-top: 0; break-before: page; }
  .story { display: none !important; }
  details[open] summary { color: var(--ink); }
  summary, .achievement-text { padding-top: 6px; padding-bottom: 6px; min-height: 0; }
  summary::before, .achievement-text::before { top: 17px; }
  .role-disclosure::details-content { content-visibility: visible; }
  .role-disclosure > .role-details { display: block !important; }
  .role-toggle { padding: 0; }
  .achievements li { break-inside: avoid; }
}
