:root {
  --paper: #f8f0ee;
  --surface: #efe3e0;
  --ink: #352129;
  --muted: #76515d;
  --rule: #dbc9c6;
  --accent: #a4425e;
  --accent-2: #c25c78;
  --bar-top: #be5874;
  --bar-mid: #a4425e;
  --bar-bot: #783148;
  --bar-ink: #f8f0ee;
  --hover-ink: #f8f0ee;
  --highlight: rgba(255,255,255,0.74);

  --res-size: 9pt;
  --res-lh: 1.46;
  --res-bullet-gap: 4px;
  --res-sec-gap: 15px;
  --res-margin: 0.5in;
  --zoom: 1;
}

@media (min-width: 1080px) {
  :root { --zoom: 1.15; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 55%, var(--paper)) 100%);
  font-family: "Open Sauce Two", "Segoe UI", sans-serif;
  color: var(--ink);
  font-size: var(--res-size);
  line-height: var(--res-lh);
  padding: 44px 16px 76px;
  -webkit-font-smoothing: antialiased;
}

.ui-ico {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.js-only { display: none; }
.has-js .js-only { display: flex; }

/* Fixed top-left glossy Home corner tab */
.home-corner {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px 0 11px;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1;
  color: var(--bar-ink);
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.34);
  background: linear-gradient(
    180deg,
    var(--bar-top) 0%,
    var(--bar-mid) 49%,
    var(--bar-bot) 51%,
    var(--bar-mid) 100%
  );
  border-right: 1px solid var(--bar-bot);
  border-bottom: 1px solid var(--bar-bot);
  border-radius: 0 0 6px 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 2px 8px rgba(0, 0, 0, 0.22);
  transition: filter 0.12s ease;
}

.home-corner span {
  display: block;
  line-height: 1;
  transform: translateY(-0.5px);
}

.home-corner:hover,
.home-corner:focus-visible {
  filter: brightness(1.1);
  outline: none;
}

/* Sheet + attached Chrome-style variant tabs */
.sheet-wrap {
  width: 8.5in;
  margin: 0 auto;
  zoom: var(--zoom);
}

.res-tabs {
  display: flex;
  align-items: flex-end;
  padding: 0 6px;
  margin-bottom: -1px;
  position: relative;
  z-index: 2;
}

.res-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 25px 0 21px;
  margin-left: -14px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  z-index: var(--tab-z, 1);
  transition: color 0.12s ease;
}

.res-tab:first-child {
  margin-left: 0;
}

.res-tab::before {
  content: "";
  position: absolute;
  inset: 0 2px 0 2px;
  z-index: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 88%, var(--paper)) 0%, var(--surface) 100%);
  border: 1px solid var(--rule);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 1px 0 var(--highlight);
  transform: perspective(26px) rotateX(6deg);
  transform-origin: bottom center;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.res-tab:hover {
  color: var(--ink);
  z-index: 25;
}

.res-tab:hover::before {
  background: linear-gradient(180deg, var(--paper) 0%, color-mix(in srgb, var(--surface) 70%, var(--paper)) 100%);
}

.res-tab.is-active {
  color: var(--ink);
  font-weight: 600;
  z-index: 30;
}

.res-tab.is-active::before {
  background: var(--paper);
  border-color: var(--rule);
  box-shadow: inset 0 1px 0 var(--highlight), 0 -1px 4px rgba(0, 0, 0, 0.05);
}

/* Cover the 1px top border of .sheet under the active tab */
.res-tab.is-active::after {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: -1px;
  height: 2px;
  background: var(--paper);
  z-index: 2;
}

.res-tab-inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  transform: translateY(1px);
}

.tab-ico {
  width: 16px;
  height: 16px;
  display: block;
  color: var(--accent);
  opacity: 0.82;
  flex-shrink: 0;
}

.res-tab.is-active .tab-ico {
  opacity: 1;
}

/* Resume sheet */
.sheet {
  position: relative;
  width: 8.5in;
  min-height: 11in;
  padding: var(--res-margin);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.sheet.is-editing {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent),
    0 2px 16px rgba(0, 0, 0, 0.14);
}

.sheet.is-editing *:focus {
  outline: 1.5px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Desktop multi-page boundary guides (screen only) */
.page-guides {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.page-guide-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1.5px dashed color-mix(in srgb, var(--accent) 45%, var(--rule));
}

.page-guide-tag {
  position: absolute;
  right: 8px;
  top: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--rule);
}

/* Fixed bottom-right tool dock */
.tool-dock {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 900;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--surface) 100%);
  border: 1px solid var(--rule);
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 6px 18px rgba(0, 0, 0, 0.24),
    0 1px 3px rgba(0, 0, 0, 0.12);
  font-size: 12px;
}

.td-zoom {
  display: inline-flex;
  align-items: center;
}

.td-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  cursor: pointer;
  background: linear-gradient(180deg, var(--paper) 0%, color-mix(in srgb, var(--surface) 60%, var(--paper)) 100%);
  border: 1px solid var(--rule);
  box-shadow: inset 0 1px 0 var(--highlight);
  transition: border-color 0.12s ease, color 0.12s ease, filter 0.12s ease;
}

.td-btn:hover,
.td-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.td-ico-btn {
  width: 34px;
  padding: 0;
}

.td-zoom .td-btn {
  border-radius: 0;
  margin-left: -1px;
}
.td-zoom .td-btn:first-child {
  border-radius: 4px 0 0 4px;
  margin-left: 0;
}
.td-zoom .td-btn:last-child {
  border-radius: 0 4px 4px 0;
}
.td-zoom-val {
  min-width: 54px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}

.td-primary {
  background: linear-gradient(180deg, var(--accent-2) 0%, var(--accent) 100%);
  color: var(--hover-ink);
  border-color: var(--bar-bot);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.td-primary:hover,
.td-primary:focus-visible {
  color: var(--hover-ink);
  border-color: var(--bar-bot);
  filter: brightness(1.07);
}

.td-tune-wrap.is-active #rb-tune-toggle,
.td-tune-wrap.open #rb-tune-toggle {
  border-color: var(--accent);
  color: var(--accent);
}

/* Tune drawer opening upward from bottom-right dock */
.td-tune-wrap {
  position: relative;
}

.td-tune-drawer {
  display: none;
  position: absolute;
  right: 0;
  bottom: 46px;
  width: 256px;
  z-index: 1000;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 var(--highlight),
    0 12px 28px rgba(0, 0, 0, 0.32),
    0 2px 6px rgba(0, 0, 0, 0.16);
}

.td-tune-wrap.open .td-tune-drawer {
  display: block;
}

.td-tune-head {
  background: linear-gradient(
    180deg,
    var(--bar-top) 0%,
    var(--bar-mid) 49%,
    var(--bar-bot) 51%,
    var(--bar-mid) 100%
  );
  color: var(--bar-ink);
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 700;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border-bottom: 1px solid var(--bar-bot);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.td-page-count {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.88;
}

.td-tune-reset {
  background: rgba(255, 255, 255, 0.16);
  color: var(--bar-ink);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  padding: 1px 7px;
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}

.td-tune-reset:hover {
  background: rgba(255, 255, 255, 0.28);
}

.td-tune-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--paper) 100%);
}

.td-edit-row {
  display: flex;
  flex-direction: row !important;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--rule);
  cursor: pointer;
  color: var(--ink) !important;
}

.td-edit-row:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
}

.td-edit-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}

.td-edit-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
}

.td-sep {
  height: 1px;
  background: var(--rule);
  opacity: 0.7;
}

.td-tune-body label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.td-tune-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.td-tune-ctrl input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  margin: 0;
}

.td-tune-ctrl output {
  min-width: 40px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Document typography & layout */
header,
h2,
.job-head,
.edu-entry,
footer {
  line-height: 1.38;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 21px;
}

.mark {
  height: 34px;
  width: auto;
  color: var(--ink);
  display: block;
  flex-shrink: 0;
}

h1 {
  margin: 0 0 8px;
  font-size: 22pt;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 0.94em;
  color: var(--muted);
}

.contact > * {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.contact-icon {
  width: 13px;
  height: 13px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.contact a:hover {
  color: var(--accent);
  text-decoration: underline;
}

section {
  margin-bottom: var(--res-sec-gap);
}

section:last-of-type {
  margin-bottom: 4px;
}

h2 {
  margin: 0 0 7px;
  font-size: 1.06em;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
  break-after: avoid;
  page-break-after: avoid;
}

h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rule) 0%, transparent 100%);
}

.job {
  margin-bottom: 13px;
}
.job:last-child { margin-bottom: 0; }

.job-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
  break-after: avoid;
  page-break-after: avoid;
}

.job-title { font-weight: 700; }

.dates {
  font-size: 0.92em;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: lining-nums tabular-nums;
}

ul {
  margin: 0;
  padding-left: 14px;
  orphans: 2;
  widows: 2;
}

li {
  margin-bottom: var(--res-bullet-gap);
  break-inside: avoid;
  page-break-inside: avoid;
}

li::marker {
  color: var(--accent);
  content: "•  ";
}

.edu-entry {
  margin-bottom: 3.5px;
  break-inside: avoid;
  page-break-inside: avoid;
}
.edu-entry:last-child { margin-bottom: 0; }

.edu-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.edu-note {
  margin-top: 2px;
  font-size: 0.94em;
  color: var(--muted);
}

.skills {
  margin: 0;
}

.skill {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding: 4px 7px;
  break-inside: avoid;
}

.skill:nth-child(odd) {
  background: var(--surface);
}

.skill dt {
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.skill dd {
  margin: 0;
}

footer {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 7.5pt;
  color: var(--muted);
}

/* Mobile: ditch emulated paper, full-width borderless resume */
@media screen and (max-width: 8.8in) {
  body {
    background: var(--paper);
    padding: 0;
    font-size: 14px;
    line-height: 1.54;
  }
  .home-corner {
    position: fixed;
    padding: 5px 11px 6px 8px;
    font-size: 12px;
  }
  .sheet-wrap {
    width: auto;
    margin: 0;
    zoom: 1 !important;
  }
  .res-tabs {
    padding: 40px 14px 0;
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .res-tab {
    height: 30px;
    padding: 0 14px;
    white-space: nowrap;
  }
  .sheet {
    width: auto;
    min-height: 0;
    padding: 20px 16px 80px;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  body:not(:has(.res-tabs)) .sheet {
    padding-top: 46px;
  }
  .page-guides,
  .td-zoom {
    display: none;
  }
  h1 {
    font-size: 24px;
  }
  .job-head,
  .edu-line {
    flex-direction: column;
    gap: 1px;
  }
  .skill {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .tool-dock {
    right: 12px;
    bottom: 12px;
  }
}

@media print {
  @page {
    size: letter;
    margin: 0.5in;
  }
  :root {
    --surface: #f1f0ec !important;
    --ink: #1d1e1f !important;
    --muted: #4b4c4d !important;
    --rule: #d5d3cd !important;
    --zoom: 1 !important;
  }
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
  }
  :root[data-palette="infrared-dark"] {
    --accent: #a4425e !important;
  }
  .home-corner,
  .res-tabs,
  .page-guides,
  .tool-dock,
  .wd-pal-wrap {
    display: none !important;
  }
  .sheet-wrap {
    width: auto;
    margin: 0;
    zoom: 1 !important;
  }
  .sheet {
    width: auto;
    min-height: calc(11in - 1in);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none !important;
  }
  html,
  body,
  .sheet {
    background: none !important;
  }
  .sheet.is-editing *:focus {
    outline: none !important;
  }
  footer {
    margin-top: auto;
    padding-top: 8px;
  }
}
