:root {
  --resume-bg: #ece6db;
  --resume-bg-soft: #f2ede4;
  --resume-panel: #f8f4ed;
  --resume-panel-strong: #fffaf2;
  --resume-ink: #171714;
  --resume-muted: #6f675d;
  --resume-line: rgba(54, 47, 38, 0.12);
  --resume-line-strong: rgba(54, 47, 38, 0.22);
  --resume-accent: #8a673f;
  --resume-accent-strong: #5c4328;
  --resume-surface-dark: #171714;
  --resume-surface-dark-strong: #0f100e;
  --resume-shadow: 0 28px 72px rgba(42, 35, 26, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--resume-bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--resume-ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(138, 103, 63, 0.11), transparent 27%),
    radial-gradient(circle at 88% 12%, rgba(39, 63, 60, 0.08), transparent 24%),
    linear-gradient(180deg, #f7f1e8 0%, #eee7dc 48%, #e7ded1 100%);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

button,
a {
  font: inherit;
}

.resume-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem clamp(0.75rem, 2.5vw, 1.5rem);
  border-bottom: 1px solid var(--resume-line);
  background: rgba(248, 244, 237, 0.94);
  box-shadow: 0 14px 34px rgba(42, 35, 26, 0.08);
  backdrop-filter: blur(14px);
}

.toolbar-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
}

.page-controls {
  justify-self: center;
}

.zoom-controls {
  justify-self: end;
}

.toolbar-link,
.tool-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--resume-line-strong);
  background: var(--resume-panel-strong);
  color: var(--resume-ink);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.toolbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.9rem;
  white-space: nowrap;
}

.tool-button {
  min-width: 74px;
  padding: 0 0.75rem;
  cursor: pointer;
}

.tool-button.compact {
  min-width: 44px;
  padding: 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.toolbar-link:hover,
.toolbar-link:focus-visible,
.tool-button:hover,
.tool-button:focus-visible {
  border-color: var(--resume-accent);
  color: var(--resume-accent-strong);
  background: var(--resume-panel);
  outline: none;
  transform: translateY(-1px);
}

.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.download-link {
  border-color: transparent;
  color: #f6f1ea;
  background: linear-gradient(
    135deg,
    var(--resume-surface-dark) 0%,
    var(--resume-surface-dark-strong) 100%
  );
}

.download-link:hover,
.download-link:focus-visible {
  color: #f6f1ea;
  background: linear-gradient(135deg, var(--resume-accent) 0%, var(--resume-accent-strong) 100%);
}

.page-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  margin: 0;
  color: var(--resume-muted);
  font-size: 0.96rem;
  font-weight: 600;
  white-space: nowrap;
}

.page-separator {
  padding: 0 0.28rem;
  color: rgba(23, 23, 23, 0.42);
}

.viewer-stage {
  min-height: calc(100dvh - 68px);
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  gap: 0.9rem;
  padding: clamp(0.75rem, 2.5vw, 1.5rem);
  overflow: auto;
}

.canvas-wrap {
  max-width: 100%;
  min-width: 0;
}

#pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #ffffff;
  border: 1px solid var(--resume-line);
  box-shadow: var(--resume-shadow);
}

.viewer-status {
  min-height: 1.4rem;
  margin: 0;
  color: var(--resume-muted);
  font-size: 0.95rem;
  text-align: center;
}

.viewer-status[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .resume-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.55rem;
    padding: 0.55rem;
  }

  .page-controls {
    order: 4;
    flex: 1 0 100%;
    width: 100%;
  }

  .zoom-controls {
    margin-left: auto;
  }

  .download-link {
    flex: 0 0 auto;
  }

  .toolbar-link,
  .tool-button {
    min-height: 40px;
    font-size: 0.92rem;
  }

  .tool-button {
    min-width: 68px;
  }

  .tool-button.compact {
    min-width: 42px;
  }

  .page-count {
    flex: 1;
    min-width: 58px;
  }

  .viewer-stage {
    min-height: calc(100dvh - 116px);
    padding: 0.65rem;
  }

  #pdf-canvas {
    box-shadow: 0 10px 28px rgba(20, 23, 20, 0.16);
  }
}

@media (max-width: 420px) {
  .toolbar-link {
    padding: 0 0.72rem;
  }

  .tool-button {
    min-width: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toolbar-link,
  .tool-button {
    transition: none;
  }
}
