/* Tuned to fit exactly one A4 page. If it overflows: trim a project line. */
@import url('fonts.css');

:root {
  --paper:       #efeae0;
  --sheet:       #fffdf8;
  --ink:         #1b1813;
  --mid:         #5c554a;
  --faint:       #9c9283;
  --rule:        #e4ddcf;
  --accent:      #b04e2c;
  --accent-soft: #f4e6db;

  --display: 'Liberation Serif', 'Times New Roman', Georgia, serif;
  --sans:    'Hanken Grotesk', -apple-system, system-ui, sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'Courier New', monospace;

  /* A4 dimensions */
  --page-w: 210mm;
  --page-h: 297mm;
}

/* Secret "vibe-code" theme — Catppuccin Mocha */
body.theme-mocha {
  --paper:       #181825;   /* mantle — page ground */
  --sheet:       #1e1e2e;   /* base — the card */
  --ink:         #cdd6f4;   /* text */
  --mid:         #a6adc8;   /* subtext0 */
  --faint:       #6c7086;   /* overlay0 */
  --rule:        #313244;   /* surface0 */
  --accent:      #fab387;   /* peach */
  --accent-soft: #45475a;   /* surface1 */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  padding: 48px 20px 96px;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle paper grain for atmosphere */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

.hidden { display: none; }

.loading {
  text-align: center;
  margin-top: 120px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--page-w);
  margin: 0 auto 20px;
}

.back-link {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mid);
  text-decoration: none;
  padding-bottom: 2px;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.3s, color 0.3s;
}
.back-link:hover { color: var(--ink); background-size: 100% 1px; }

.toolbar button {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--sheet);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.25s, transform 0.25s;
}
.toolbar button:hover { background: var(--accent); transform: translateY(-1px); }

.page {
  counter-reset: sec;
  width: 100%;
  max-width: var(--page-w);
  min-height: var(--page-h);
  max-height: var(--page-h);
  margin: 0 auto;
  background: var(--sheet);
  padding: 12mm 14mm 12mm;
  box-shadow: 0 1px 2px rgba(30,22,12,0.05), 0 24px 60px -24px rgba(30,22,12,0.25);
  overflow: hidden;             /* hard stop — nothing bleeds past page */
}

.page::before {
  content: "R\00E9sum\00E9";
  display: block;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 9px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 10px;
}

.header h1 {
  font-family: var(--display);
  font-size: 2.1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
  margin-bottom: 3px;
}

.title { font-size: 0.74rem; color: var(--accent); font-weight: 500; }

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--mid);
  overflow-wrap: anywhere;
}

.header-right a { color: var(--mid); text-decoration: none; }
.header-right a:hover { color: var(--accent); }

.availability {
  font-family: var(--sans);
  font-size: 0.68rem;
  color: var(--ink);
  font-weight: 500;
  margin-top: 2px;
  font-style: italic;
}

.summary {
  font-size: 0.76rem;
  color: var(--mid);
  line-height: 1.6;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  text-align: justify;
}

.body {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 0 22px;
}

/* grid children may shrink below their content's intrinsic width */
.body > * { min-width: 0; }

.section { margin-bottom: 9px; }

.section h2 {
  display: flex;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink);
  margin-bottom: 7px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}

.section h2::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  color: var(--accent);
  margin-right: 0.7em;
}

.project { margin-bottom: 8px; }

.project-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1px;
}

.project-name { font-size: 0.82rem; font-weight: 600; color: var(--ink); }

.badge {
  font-family: var(--mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 999px;
}
.badge-dev      { background: var(--accent-soft); color: var(--accent); }
.badge-complete { background: #e7efe7; color: #3d6b46; }
.badge-maintained { background: #e6eef5; color: #3a5f8a; }
.badge-planned  { background: #efece4; color: var(--faint); }

.project-stack {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--faint);
  margin-bottom: 2px;
  overflow-wrap: anywhere;
}

.project-desc { font-size: 0.73rem; color: var(--mid); line-height: 1.55; text-align: justify; }

.project-link {
  font-family: var(--mono);
  font-size: 0.63rem;
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  margin-top: 2px;
}
.project-link:hover { text-decoration: underline; }

.entry { margin-bottom: 8px; }
.entry-compact { margin-bottom: 5px; }

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.entry-role { font-size: 0.82rem; font-weight: 600; color: var(--ink); }

.entry-date {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--faint);
  white-space: nowrap;
}

.entry-sub { font-size: 0.73rem; color: var(--accent); font-weight: 500; margin-bottom: 2px; }

.entry-bullets { list-style: none; padding: 0; }
.entry-bullets li {
  font-size: 0.73rem;
  color: var(--mid);
  line-height: 1.55;
  padding-left: 12px;
  position: relative;
  text-align: justify;
}
.entry-bullets li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.edu-entry { margin-bottom: 7px; }

.edu-header { display: flex; justify-content: space-between; align-items: baseline; }

.edu-place { font-size: 0.79rem; font-weight: 600; color: var(--ink); }

.edu-date {
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--faint);
}

.edu-degree { font-size: 0.73rem; color: var(--mid); margin-bottom: 1px; }
.edu-note { font-size: 0.68rem; color: var(--faint); }

.skill-group { margin-bottom: 6px; }

.skill-group h3 {
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 2px;
}

.skill-group p { font-size: 0.73rem; color: var(--mid); line-height: 1.5; }

.awards-list { list-style: none; padding: 0; }

.lang-level {
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--faint);
  margin-left: 4px;
}

.awards-list li {
  font-size: 0.73rem;
  color: var(--mid);
  line-height: 1.7;
  padding-left: 12px;
  position: relative;
}
.awards-list li::before {
  content: "\2013";
  position: absolute;
  left: 0;
  color: var(--accent);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.header, .summary, .section {
  animation: rise 0.55s cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
.header  { animation-delay: 0.05s; }
.summary { animation-delay: 0.12s; }
.section:nth-of-type(1) { animation-delay: 0.20s; }
.section:nth-of-type(2) { animation-delay: 0.27s; }
.section:nth-of-type(3) { animation-delay: 0.34s; }

/* scoped to screen so print/PDF (A4 ≈ 793px) keeps the two-column layout */
@media screen and (max-width: 820px) {
  html { font-size: 18px; }              /* scale compact A4 type up for phone reading */

  body { padding: 26px 14px 64px; }

  .page {
    width: 100%;
    min-height: 0;
    max-height: none;
    height: auto;
    overflow: visible;
    padding: 34px 24px 44px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .header h1 { font-size: 2.4rem; }
  .header-right { align-items: flex-start; }

  .body {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .summary { margin-bottom: 22px; padding-bottom: 18px; line-height: 1.7; }
  .section { margin-bottom: 22px; }
  .section h2 { margin-bottom: 12px; }
  .project, .edu-entry, .skill-group { margin-bottom: 14px; }
  .project-desc, .skill-group p, .awards-list li { line-height: 1.65; }
}

@page { size: A4; margin: 0; }

@media print {
  html, body { background: #fff; padding: 0; margin: 0; }
  html:has(body.theme-mocha), body.theme-mocha { background: var(--paper); }
  body::before { display: none; }
  .no-print { display: none !important; }
  .page {
    width: 210mm;
    min-height: 297mm;
    max-height: 297mm;
    background: #fff;
    box-shadow: none;
    padding: 12mm 14mm;
    overflow: hidden;            /* keep it to one page */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;  /* render paper tone, badges, accent rule */
  }
  body.theme-mocha .page { background: var(--sheet); }
  * { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
  .back-link, .toolbar button, .header-right a { transition: none; }
}
