/* ═══════════════════════════════════════════════════
   Personal CV / Product Portfolio — web view
   Uses the site design tokens; editorial rather than
   card-heavy, so the content stays the main element.
   ═══════════════════════════════════════════════════ */

:root {
  --blue: #2563eb;
  --blue-l: #3b82f6;
  --dark: #0f172a;
  --mid: #1e293b;
  --body: #475569;
  --muted: #64748b;
  --faint: #94a3b8;
  --light: #f8fafc;
  --border: #e2e8f0;
  --white: #fff;
  --radius: 6px;
  --radius-pill: 100px;
  --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* The page is presented as a sheet of paper on a canvas.
     794px is A4 width at 96dpi, so the web view matches the printed one. */
  --sheet-width: 794px;
  --sheet-pad: 52px;
  --canvas: #eceff3;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: hidden; scroll-behavior: smooth; }

body.cv-body {
  font-family: var(--font-body);
  color: var(--body);
  background: var(--canvas);
  line-height: 1.65;
  font-size: 16px;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

/* ── PAGES ──────────────────────────────────────────
   Real A4 sheets, sized in millimetres so the screen,
   the printer and the PDF all get the same geometry.
   210 × 297mm with 14/16mm margins. */
.cv-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 28px 0 56px;
}
.cv-page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  padding: 14mm 16mm 18mm;
  background: var(--white);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06),
              0 1px 2px rgba(15, 23, 42, 0.06),
              0 12px 34px rgba(15, 23, 42, 0.10);
}
.cv-page-inner { height: 100%; }

/* Page counter, bottom right of every sheet. */
.cv-page-foot {
  position: absolute;
  right: 16mm;
  bottom: 8mm;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* Inside a page the sheet padding already does the work. */
.cv-page-inner .cv-shell { padding: 0; }
.cv-page-inner .cv-section { padding: 0 0 26px; }
.cv-page-inner .cv-section::after { left: 0; right: 0; }
.cv-page-inner .cv-section:last-child { padding-bottom: 0; }
.cv-page-inner .cv-section:last-child::after { content: none; }
.cv-page-heading { margin-bottom: 20px; }

/* Product cards sit directly in the page flow. */
.cv-page-inner > .cv-product { padding: 24px 0; border-top: 0; }
.cv-page-inner > .cv-product:first-of-type { padding-top: 0; }
.cv-page-inner > .cv-product + .cv-product { border-top: 1px solid var(--border); }
/* Keep the accent rail off the text — the rule above would otherwise reset it. */
.cv-page-inner > .cv-product--featured { padding-left: 24px; }

img { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

.cv-shell { padding: 0 var(--sheet-pad); }

.cv-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--dark); color: #fff; padding: 10px 16px; z-index: 100;
}
.cv-skip:focus { left: 12px; top: 12px; }

/* ── NAVIGATION ─────────────────────────────────── */
/* Toolbar above the sheet, aligned to the sheet edges. */
.cv-nav {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.88);
}
.cv-nav-sticky .cv-nav { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(8px); }

.cv-nav-inner {
  max-width: var(--sheet-width);
  margin: 0 auto;
  padding: 10px 4px;
  min-height: 56px;
  display: flex; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
.cv-nav-links { display: flex; flex-wrap: wrap; gap: 18px; }
.cv-nav-links a { color: var(--muted); font-size: 0.86rem; }
.cv-nav-links a:hover { color: var(--blue); text-decoration: none; }

.cv-nav-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.cv-btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); color: var(--mid); cursor: pointer;
  transition: border-color 0.18s, color 0.18s;
}
.cv-btn:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }
.cv-btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.cv-btn-primary:hover { background: var(--blue-l); border-color: var(--blue-l); color: #fff; }

/* ── LANGUAGE DROPDOWN ──────────────────────────────
   A <details> element wearing the same skin as the
   buttons next to it: no library, keyboard-operable. */
.cv-lang { position: relative; }
.cv-lang > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  gap: 6px;
}
.cv-lang > summary::-webkit-details-marker { display: none; }
.cv-lang > summary::marker { content: ""; }
.cv-lang-caret { font-size: 0.7em; line-height: 1; transition: transform 0.18s; }
.cv-lang[open] > summary { border-color: var(--blue); color: var(--blue); }
.cv-lang[open] .cv-lang-caret { transform: rotate(180deg); }

.cv-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 168px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
}
.cv-lang-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.86rem;
  color: var(--mid);
  white-space: nowrap;
}
.cv-lang-item b { font-size: 0.74rem; letter-spacing: 0.06em; color: var(--muted); }
a.cv-lang-item:hover { background: var(--light); color: var(--blue); text-decoration: none; }
a.cv-lang-item:hover b { color: var(--blue); }
.cv-lang-item.is-current { background: var(--light); color: var(--blue); font-weight: 600; }
.cv-lang-item.is-current b { color: var(--blue); }

/* ── PROFILE HEADER ─────────────────────────────── */
.cv-header { padding: 0 0 26px; position: relative; }
.cv-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  border-bottom: 1px solid var(--border);
}
.cv-header-inner {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
/* Contacts run as a band under the identity block: at sheet width there is no
   room for a third column without squeezing the name. */
.cv-header-contacts {
  grid-column: 1 / -1;
  margin-top: 30px;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
}
.cv-header-contacts .cv-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 16px 24px;
}
.cv-header-photo img {
  width: 100%; height: auto; border-radius: var(--radius);
  border: 1px solid var(--border); object-fit: cover; aspect-ratio: 5 / 6;
}

.cv-name {
  font-size: 2.4rem; line-height: 1.15; font-weight: 700;
  color: var(--dark); letter-spacing: -0.02em; margin-bottom: 10px;
}
.cv-role { font-size: 1.06rem; font-weight: 600; color: var(--blue); margin-bottom: 14px; }
.cv-positioning { font-size: 1rem; color: var(--body); max-width: 46ch; }
.cv-location { margin-top: 14px; font-size: 0.86rem; color: var(--muted); }

/* ── CONTACTS ───────────────────────────────────── */
.cv-contacts { display: flex; flex-direction: column; gap: 10px; }
.cv-contact { display: flex; flex-direction: column; gap: 1px; }
.cv-contact-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted);
}
.cv-contact-value { font-size: 0.92rem; color: var(--mid); overflow-wrap: anywhere; }
.cv-contact-value:hover { color: var(--blue); }
.cv-contact-note { font-size: 0.78rem; color: var(--muted); }

/* ── SECTIONS ───────────────────────────────────── */
/* Rules are inset to the text column, so the sheet reads as one page rather
   than a stack of bands. */
.cv-section { position: relative; padding: 52px 0; }
.cv-section::after {
  content: "";
  position: absolute; bottom: 0; left: var(--sheet-pad); right: var(--sheet-pad);
  border-bottom: 1px solid var(--border);
}
.cv-section:last-child::after { content: none; }

.cv-section-title {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 22px;
}

.cv-lead { font-size: 1.14rem; line-height: 1.7; color: var(--mid); max-width: 68ch; }
.cv-body-text { font-size: 1rem; line-height: 1.75; max-width: 72ch; }
.cv-note { font-size: 0.9rem; color: var(--muted); margin-bottom: 22px; }

/* ── PRODUCTS ───────────────────────────────────── */
.cv-products { display: flex; flex-direction: column; }
.cv-product { padding: 28px 0; border-top: 1px solid var(--border); }
.cv-product:first-child { border-top: 0; padding-top: 4px; }
.cv-product--featured { border-left: 2px solid var(--blue); padding-left: 22px; }

.cv-product-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Site favicon next to the product name. Decorative — the name carries the
   meaning, so it is alt="" and never becomes the anchor of the heading. */
.cv-product-logo {
  width: 28px; height: 28px; flex: none;
  border-radius: 6px;
  object-fit: contain;
}
.cv-product-title { font-size: 1.4rem; font-weight: 700; color: var(--dark); letter-spacing: -0.01em; }
.cv-status {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 3px 10px;
}
/* Capped so a long positioning line wraps instead of stretching across
   the full sheet width. */
.cv-product-positioning {
  margin-top: 4px; font-size: 0.98rem; font-weight: 600; color: var(--blue);
  max-width: 52ch;
}
.cv-product-cover {
  margin-top: 18px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius);
}
.cv-product-desc { margin-top: 14px; max-width: 72ch; }

.cv-more { margin-top: 12px; }
.cv-more summary { cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--blue); }
.cv-more > p { margin-top: 10px; max-width: 72ch; }

.cv-kv { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.94rem; }
.cv-kv-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); padding-top: 4px; min-width: 62px;
}
.cv-kv-value { color: var(--mid); font-weight: 600; }

.cv-block { margin-top: 18px; }
.cv-block-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.cv-block-roadmap .cv-block-title { color: var(--muted); }

.cv-list { display: flex; flex-direction: column; gap: 5px; }
.cv-list li { position: relative; padding-left: 16px; font-size: 0.96rem; }
.cv-list li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--border);
}
.cv-block-roadmap .cv-list li { color: var(--muted); }
.cv-list-tight li { font-size: 0.92rem; }

.cv-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.cv-tags li {
  font-size: 0.78rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 3px 11px;
}

/* ── SELECTED WORKS GALLERY (inside a product) ──── */
.cv-block-works { margin-top: 22px; }
.cv-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px 16px;
}
.cv-gitem { display: flex; flex-direction: column; }
.cv-gshot {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top center;
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px;
}
.cv-gbody { display: flex; flex-direction: column; gap: 2px; }
.cv-gtitle { font-size: 0.92rem; font-weight: 700; color: var(--dark); }
.cv-gdesc { font-size: 0.84rem; color: var(--body); line-height: 1.45; }
.cv-gurl { font-size: 0.82rem; font-weight: 600; color: var(--blue); overflow-wrap: anywhere; }
/* Portfolio link, then the plain site link beneath it. */
.cv-product-links { margin-top: 20px; display: flex; flex-direction: column; gap: 6px; }
.cv-gmore { font-size: 0.9rem; font-weight: 600; }
.cv-gnote { margin-left: 8px; font-size: 0.82rem; font-weight: 400; color: var(--muted); }

.cv-product-url { font-size: 0.95rem; font-weight: 600; }
.cv-product-url a { overflow-wrap: anywhere; }
.cv-demo { margin-left: 10px; font-weight: 400; color: var(--muted); font-size: 0.85rem; }

/* ── CLIENT WORK ────────────────────────────────── */
.cv-works { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.cv-work { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cv-work-shot { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-bottom: 1px solid var(--border); }
.cv-work-body { padding: 18px 20px 20px; }
.cv-work-title { font-size: 1.05rem; font-weight: 700; color: var(--dark); }
.cv-work-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.cv-work-desc { margin-top: 10px; font-size: 0.93rem; }
.cv-work-url { margin-top: 12px; font-size: 0.9rem; font-weight: 600; overflow-wrap: anywhere; }
.cv-more-work { margin-top: 26px; font-size: 0.92rem; color: var(--muted); }

/* ── GROUPED LISTS ──────────────────────────────── */
.cv-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 30px 36px; }
.cv-group-title {
  font-size: 0.92rem; font-weight: 700; color: var(--dark); margin-bottom: 10px;
}

/* A group that runs the full width of the sheet: intro paragraph, then the
   items in columns so a long list stays compact. */
.cv-group--full { grid-column: 1 / -1; }
.cv-group-intro {
  font-size: 0.95rem; line-height: 1.7; max-width: 72ch; margin-bottom: 14px;
}
.cv-list-cols {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 5px 24px;
}

/* Sub-columns inside a full-width group. */
.cv-subcols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 22px 30px;
}
.cv-subcol-title {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.cv-groups-tools .cv-tags { margin-top: 0; }

/* ── CLOSING ────────────────────────────────────── */
.cv-section-closing { padding-bottom: 64px; }
.cv-closing-text {
  font-size: 1.06rem; line-height: 1.7; color: var(--mid); max-width: 66ch;
}
.cv-closing-sign {
  margin-top: 20px; font-size: 0.98rem; line-height: 1.6; color: var(--dark); font-weight: 600;
}

/* ── CONTACT CTA ────────────────────────────────── */
.cv-section-contact { padding-bottom: 72px; }
.cv-cta-title {
  font-size: 1.28rem; line-height: 1.5; font-weight: 600; color: var(--dark);
  max-width: 62ch; margin-bottom: 22px;
}
.cv-section-contact .cv-contacts {
  flex-direction: row; flex-wrap: wrap; gap: 12px 40px;
}
.cv-form { margin-top: 30px; max-width: 560px; }
.cv-form input[type="text"],
.cv-form input[type="email"],
.cv-form textarea {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--mid);
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--white); margin-bottom: 14px;
}
.cv-form label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--mid); margin-bottom: 5px; }
.cv-form button {
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  padding: 10px 20px; border: 1px solid var(--blue); border-radius: var(--radius);
  background: var(--blue); color: #fff;
}

/* ── RESPONSIVE ─────────────────────────────────── */
/* Below the sheet width the paper metaphor stops helping: the sheet goes
   full-bleed and the canvas disappears. */
@media (max-width: 860px) {
  body.cv-body { background: var(--white); }
  .cv-doc { gap: 0; padding: 0; }
  .cv-page {
    width: 100%; min-height: 0; padding: 24px 20px 30px;
    border-radius: 0; box-shadow: none;
    border-bottom: 1px solid var(--border);
  }
  .cv-page:last-child { border-bottom: 0; }
  .cv-page-foot { display: none; }
  .cv-nav-inner { max-width: none; padding-left: 20px; padding-right: 20px; }
  :root { --sheet-pad: 32px; }
  .cv-section-contact .cv-contacts { gap: 12px 28px; }
}

@media (max-width: 640px) {
  body.cv-body { font-size: 15.5px; }
  :root { --sheet-pad: 20px; }
  .cv-header { padding: 30px 0 0; }
  .cv-header-contacts { margin-top: 22px; }
  .cv-header-inner { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .cv-header-photo { max-width: 150px; }
  .cv-name { font-size: 1.9rem; }
  .cv-section { padding: 40px 0; }
  .cv-lead { font-size: 1.06rem; }
  .cv-product--featured { padding-left: 16px; }
  .cv-works { grid-template-columns: minmax(0, 1fr); }
  .cv-nav-inner { gap: 14px; }
  .cv-nav-actions { margin-left: 0; width: 100%; }
  .cv-contact-value { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ── PRINT ──────────────────────────────────────────
   No separate print design: every .cv-page is already an
   A4 sheet, so printing maps one sheet to one sheet of
   paper. Page margins live inside .cv-page, so @page has
   none — otherwise they would be applied twice.         */
@page {
  size: A4;
  margin: 0;
}

@media print {
  .cv-nav,
  .cv-skip,
  .cv-btn,
  .cv-form { display: none !important; }

  html, body.cv-body {
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .cv-doc { display: block; gap: 0; padding: 0; }

  .cv-page {
    width: 210mm;
    height: 297mm;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    break-after: page;
    page-break-after: always;
  }
  .cv-page:last-child { break-after: auto; page-break-after: auto; }

  details > summary { display: none; }
  .cv-more > p { display: block; }
}
