/* V3 application documents. One source for readable screens and A4 export. */
@font-face {
  font-family: "Portfolio Thai";
  src: url("fonts/NotoSansThai.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --ink: #242424;
  --muted: #616161;
  --line: #dedede;
  --soft: #f5f5f5;
  --accent: #171717;
  --accent-dark: #171717;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #ededed; font-family: "Segoe UI", Arial, sans-serif; font-size: 10pt; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
p, ul { margin: 0; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.page { display: flex; flex-direction: column; width: 210mm; min-height: 297mm; margin: 28px auto; padding: 12mm 14mm; background: #fff; box-shadow: 0 4px 24px #0000000a; }
.document-header { padding-bottom: 3mm; border-bottom: 1.5pt solid var(--ink); }
.document-kicker { margin: 0 0 2mm; color: var(--muted); font-size: 8pt; font-weight: 650; line-height: 1.3; letter-spacing: .12em; text-transform: uppercase; }
.document-header h1 { margin: 0; color: var(--accent); font-size: 29pt; font-weight: 750; line-height: 1.13; letter-spacing: -.045em; }
.role { margin: 1.6mm 0 2.4mm; font-size: 10.6pt; font-weight: 650; }
.contact-list { display: flex; flex-wrap: wrap; column-gap: 3.6mm; row-gap: .8mm; color: #494949; font-size: 8.5pt; }
.contact-list a { white-space: nowrap; }
.summary { margin-top: 3mm; line-height: 1.4; }
strong { font-weight: 650; }
.document-section { margin-top: 3.2mm; }
.document-section h2 { display: flex; align-items: center; gap: 3mm; margin: 0 0 2mm; color: var(--accent); font-size: 9pt; font-weight: 750; line-height: 1.25; letter-spacing: .115em; text-transform: uppercase; }
.document-section h2::after { flex: 1; height: .6pt; background: var(--line); content: ""; }
.job { margin-top: 2mm; break-inside: avoid; }
.job:first-of-type { margin-top: 0; }
.job-head { display: flex; justify-content: space-between; align-items: baseline; gap: 3mm; }
.job-head h3 { margin: 0; font-size: 10pt; font-weight: 700; line-height: 1.3; }
.job-head h3 span { font-weight: 400; }
.job-head time { flex-shrink: 0; color: var(--muted); font-size: 8.5pt; font-variant-numeric: tabular-nums; white-space: nowrap; }
.job-sub { margin: .5mm 0; color: var(--muted); font-size: 9pt; }
.job ul, .cv-project ul { margin: .7mm 0 0; padding-left: 4mm; }
.job li, .cv-project li { margin: .6mm 0 0; padding-left: .4mm; }
.project-line { margin-top: 1.8mm; break-inside: avoid; }
.project-line:first-of-type { margin-top: 0; }
.project-line h3 { margin: 0 0 .4mm; font-size: 10pt; font-weight: 700; }
.project-line h3 span { color: var(--muted); font-size: 9pt; font-weight: 400; }
.skill-row { margin-top: .9mm; }
.education-row { display: flex; justify-content: space-between; align-items: baseline; gap: 3mm; }
.education-row strong, .education-row span { display: block; }
.education-row span { margin-top: .5mm; }
.education-row time { flex-shrink: 0; color: var(--muted); font-size: 8.5pt; white-space: nowrap; }
.doc-note { margin-top: 1mm; color: var(--muted); font-size: 9pt; }

.cv-page { font-size: 10.2pt; line-height: 1.32; }
.cv-page .job { margin-top: 3.2mm; }
.cv-page .job:first-of-type { margin-top: 0; }
.cv-page .job li { margin-top: 1.1mm; }
.cv-page .document-section { margin-top: 4mm; }
.cv-page .job-head h3 { font-size: 10.3pt; }
.cv-footer { display: flex; justify-content: space-between; gap: 3mm; margin-top: auto; padding-top: 3mm; color: var(--muted); font-size: 8pt; }
.continuation-header { display: flex; justify-content: space-between; gap: 4mm; padding-bottom: 2.5mm; border-bottom: 1.5pt solid var(--ink); font-size: 9pt; }
.continuation-header span { font-weight: 650; }
.continuation-header a { color: var(--muted); }
.page-heading { margin: 5mm 0 0; }
.page-heading h2 { margin: 0; font-size: 26pt; font-weight: 750; line-height: 1.12; letter-spacing: -.035em; }
.cv-project { margin-top: 3.2mm; padding-top: 3.2mm; border-top: .6pt solid var(--line); break-inside: avoid; }
.cv-project:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.cv-project-head { display: flex; justify-content: space-between; align-items: baseline; gap: 3mm; }
.cv-project-head h3 { margin: 0; font-size: 11.3pt; line-height: 1.3; }
.cv-project-head > span { color: var(--muted); font-size: 8.6pt; }
.project-stack { margin: .7mm 0 1.3mm; color: var(--muted); font-size: 8.7pt; }
.independent-section { font-size: 9.3pt; }
.independent-section a { text-decoration: underline; text-underline-offset: 2px; }

html[lang="th"] body { font-family: "Portfolio Thai", "Leelawadee UI", Tahoma, sans-serif; }
html[lang="th"] .document-header h1, html[lang="th"] .role { font-family: "Segoe UI", Arial, sans-serif; }
html[lang="th"] .document-kicker, html[lang="th"] .document-section h2 { letter-spacing: 0; text-transform: none; line-height: 1.5; }
html[lang="th"] .page-heading h2 { letter-spacing: 0; line-height: 1.4; }

@page { size: A4; margin: 0; }
@media print {
  html, body { background: white; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .screen-only { display: none !important; }
  .page { min-height: 296.5mm; margin: 0; box-shadow: none; break-after: page; }
  .page:last-child { break-after: auto; }
  h2, h3, .job-head, .cv-project-head { break-after: avoid; }
  p, li { orphans: 2; widows: 2; }
  html[lang="th"] body, html[lang="th"] .cv-page { font-size: 10.5pt; line-height: 1.45; }
  html[lang="th"] .cv-page { line-height: 1.4; }
  html[lang="th"] .summary { line-height: 1.5; }
  html[lang="th"] .document-section h2 { font-size: 10pt; }
  html[lang="th"] .job-head h3 { font: 700 9.8pt/1.4 "Segoe UI", Arial, sans-serif; }
  html[lang="th"] .job-head time, html[lang="th"] .education-row time { font-size: 8.8pt; line-height: 1.5; }
  html[lang="th"] .cv-page .job { margin-top: 2.8mm; }
  html[lang="th"] .cv-page .job:first-of-type { margin-top: 0; }
  html[lang="th"] .page-heading h2 { font-size: 24pt; }
  html[lang="th"] .cv-page .document-section { margin-top: 3.2mm; }
  html[lang="th"] .cv-project { margin-top: 2.5mm; padding-top: 2.5mm; }
  html[lang="th"] .cv-project:first-child { margin-top: 0; padding-top: 0; }
  html[lang="th"] .skill-row { font-size: 10pt; }
}

@media screen {
  body { font-size: 16px; line-height: 1.6; }
  .document-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; padding: 12px max(24px, calc((100% - 1000px) / 2)); border-bottom: 1px solid var(--line); background: #fffffff5; }
  .document-toolbar a, .document-toolbar button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 1px solid transparent; border-radius: 999px; font: 650 14px/1.3 "Segoe UI", Arial, sans-serif; text-decoration: none; cursor: pointer; }
  .document-toolbar button { color: var(--ink); border-color: var(--line); background: white; }
  .document-toolbar a:hover, .document-toolbar button:hover { background: var(--soft); }
  .document-toolbar .download { color: white; border-color: var(--accent); background: var(--accent); }
  .document-toolbar .download:hover { background: #3b3b3b; }
  .document-toolbar .portfolio-link { gap: 10px; padding-left: 0; }
  .identity-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: white; background: var(--accent); font-size: 12px; letter-spacing: .06em; }
  .document-switch, .document-language-switch, .document-actions { display: flex; align-items: center; gap: 6px; }
  .document-controls { display: flex; align-items: center; gap: 12px; }
  .document-switch, .document-language-switch { padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
  .document-switch a[aria-current="page"], .document-language-switch a[aria-current="page"] { color: white; background: var(--accent); }
  .document-language-switch a { min-width: 44px; }
  .page { width: min(1000px, calc(100% - 48px)); min-height: 0; padding: 56px 64px; margin: 32px auto; }
  .document-header { padding-bottom: 24px; }
  .document-kicker { margin-bottom: 12px; font-size: 12px; }
  .document-header h1 { font-size: clamp(32px, 4vw, 48px); }
  .role { margin: 12px 0 16px; font-size: 18px; }
  .contact-list { column-gap: 20px; row-gap: 6px; font-size: 14px; }
  .contact-list a { display: inline-flex; align-items: center; min-height: 24px; }
  .contact-list a:hover { text-decoration: underline; text-underline-offset: 4px; }
  .summary { margin-top: 24px; line-height: 1.65; }
  .document-section, .cv-page .document-section { margin-top: 32px; }
  .document-section h2 { gap: 16px; margin-bottom: 18px; font-size: 13px; }
  .job, .cv-page .job { margin-top: 22px; }
  .job-head, .cv-project-head { gap: 16px; }
  .job-head h3, .cv-page .job-head h3, .project-line h3 { font-size: 17px; }
  .job-head time, .education-row time { font-size: 13px; }
  .job-sub { margin: 4px 0 8px; font-size: 14px; }
  .job ul, .cv-project ul { margin-top: 6px; padding-left: 20px; }
  .job li, .cv-page .job li, .cv-project li { margin-top: 6px; padding-left: 2px; }
  .project-line { margin-top: 20px; }
  .project-line h3 { margin-bottom: 4px; }
  .project-line h3 span { font-size: 14px; }
  .skill-row { margin-top: 10px; }
  .doc-note { margin-top: 10px; font-size: 14px; }
  .cv-page { font-size: 16px; line-height: 1.6; }
  .cv-footer { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; }
  .continuation-header { padding-bottom: 18px; font-size: 14px; }
  .page-heading { margin-top: 28px; }
  .page-heading h2 { font-size: 36px; }
  .cv-project { margin-top: 24px; padding-top: 24px; }
  .cv-project-head h3 { font-size: 20px; }
  .cv-project-head > span, .project-stack { font-size: 14px; }
  .project-stack { margin: 6px 0 10px; }
  .independent-section { font-size: 16px; }
}

@media screen and (max-width: 760px) {
  .document-toolbar { flex-wrap: wrap; gap: 10px; padding: 10px 20px; }
  .document-controls { order: 3; width: 100%; justify-content: space-between; }
  .document-switch { flex: 1; }
  .document-switch a { flex: 1; }
  .document-toolbar a, .document-toolbar button { padding-inline: 12px; }
  .page { width: 100%; margin: 0; padding: 36px 24px; box-shadow: none; }
  .page + .page { border-top: 8px solid var(--soft); }
  .document-header h1 { font-size: clamp(30px, 7vw, 42px); overflow-wrap: anywhere; }
  .role { font-size: 16px; }
  .contact-list { flex-direction: column; }
  .job-head, .education-row, .cv-project-head { flex-direction: column; gap: 4px; }
  .job-head h3 span { display: block; }
  .job-head time, .education-row time { font-size: 14px; }
  .project-line h3 span { display: block; margin-top: 3px; }
  .cv-footer, .continuation-header { flex-wrap: wrap; }
  .document-section h2 { letter-spacing: .08em; }
}

@media screen and (max-width: 380px) {
  .document-toolbar { padding-inline: 12px; }
  .document-toolbar .portfolio-link { gap: 6px; }
  .document-toolbar a, .document-toolbar button { padding-inline: 9px; }
  .document-actions { gap: 4px; }
}
