/* ============================================================
   Resume — Modern Refined
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg, oklch(0.985 0.004 260));
  color: var(--ink, oklch(0.15 0.015 260));
  font-family: var(--font-body);
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.r-root { min-height: 100vh; }

.r-stage {
  display: flex;
  justify-content: center;
  padding: 32px 20px 80px;
}

/* ----- A4 Paper ----- */
.r-paper {
  width: 210mm;
  min-height: 297mm;
  background: var(--paper);
  color: var(--ink);
  padding: 18mm 18mm 16mm;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 12px 40px -12px rgba(0,0,0,0.18);
  position: relative;
  overflow: hidden;
}

.r-paper.with-accent-block::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 8mm;
  height: 100%;
  background: var(--accent);
  z-index: 0;
}

.r-paper.with-accent-block::after {
  content: "";
  position: absolute;
  top: 0; left: 8mm;
  width: 1px;
  height: 60mm;
  background: var(--accent-soft);
  z-index: 0;
}

/* ============================================================
   Header
   ============================================================ */
.r-header {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 12mm;
  align-items: start;
  padding-bottom: 8mm;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8mm;
  position: relative;
  z-index: 1;
}

.r-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6mm;
  display: flex;
  align-items: center;
  gap: 8px;
}
.r-eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}

.r-name {
  font-family: var(--font-head);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
  line-height: 1.15;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--ink);
}

.r-name-kana {
  font-size: 12px;
  font-weight: 500;
  color: var(--sub);
  letter-spacing: 0.18em;
}

.r-title {
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 0.05em;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: inline-block;
  font-weight: 500;
}

.r-meta {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  font-size: 12px;
}
.r-meta > div {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
}
.r-meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--sub);
  text-transform: uppercase;
  margin: 0;
}
.r-meta dd {
  margin: 0;
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
  font-weight: 500;
}

/* ============================================================
   Section frame
   ============================================================ */
.r-section {
  margin-bottom: 9mm;
  position: relative;
  z-index: 1;
}

[data-density="compact"] .r-section { margin-bottom: 6mm; }

.sec-head {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 5mm;
}

.sec-num {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.02em;
}

.sec-titles { display: flex; align-items: baseline; gap: 12px; }

.sec-ja {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.06em;
}

.sec-en {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--sub);
  text-transform: uppercase;
}

.sec-rule {
  height: 1px;
  background: linear-gradient(to right, var(--ink), var(--line) 30%);
  align-self: end;
  margin-bottom: 4px;
}

/* ============================================================
   Summary
   ============================================================ */
.r-summary {
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink);
  margin: 0 0 6mm;
  text-align: justify;
  text-wrap: pretty;
  padding: 0 0 0 16px;
  border-left: 3px solid var(--accent);
  font-weight: 400;
}

.r-highlights {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--line);
}
.r-highlights li {
  padding: 8px 12px 10px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.r-highlights li:last-child { border-right: none; }

.hl-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}
.hl-label {
  font-size: 11px;
  color: var(--ink);
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ============================================================
   Strengths
   ============================================================ */
.r-strengths {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4mm 6mm;
}
.r-strengths > li {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: start;
}
.str-idx {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding: 4px 0;
  border-top: 2px solid var(--accent);
}
.str-title {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.str-body {
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink);
  margin: 0;
  text-wrap: pretty;
}

/* ============================================================
   Skills
   ============================================================ */
.skill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5mm 8mm;
}

.skill-group { }
.skill-group-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--ink);
  margin: 0 0 3mm;
  padding-bottom: 5px;
  border-bottom: 1.5px solid var(--ink);
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.skill-list { list-style: none; margin: 0; padding: 0; }
.skill-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dotted var(--line);
  font-size: 12px;
}
.skill-name { color: var(--ink); font-weight: 500; flex-shrink: 0; }
.skill-meta { display: flex; align-items: center; gap: 10px; }
.skill-years {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink);
  min-width: 32px;
  text-align: left;
}

.level-bar { display: inline-flex; gap: 2px; }
.lb-dot {
  width: 16px;
  height: 5px;
  background: var(--line);
  border-radius: 1px;
}
.lb-dot.on { background: var(--accent); }

/* ============================================================
   Career & Projects (integrated)
   ============================================================ */
.career-tree {
  display: flex;
  flex-direction: column;
  gap: 7mm;
}

.career-block {
  position: relative;
}

.career-block-head {
  display: grid;
  grid-template-columns: 38mm 1fr;
  gap: 6mm;
  padding: 3mm 4mm 3mm 4mm;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  margin-bottom: 4mm;
  align-items: start;
}

.cbh-period {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
  padding-top: 2px;
  font-weight: 500;
}
.cbh-company {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.03em;
}
.cbh-role {
  font-size: 10.5px;
  color: var(--accent-deep);
  margin-top: 2px;
  font-weight: 500;
}
.cbh-note {
  font-size: 10px;
  line-height: 1.7;
  color: var(--sub);
  margin: 4px 0 0;
}

.career-projects {
  display: flex;
  flex-direction: column;
  gap: 5mm;
  padding-left: 6mm;
  position: relative;
}
.career-projects::before {
  content: "";
  position: absolute;
  left: 2mm;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.career-projects > .proj-card::before {
  content: "";
  position: absolute;
  left: -4mm;
  top: 12mm;
  width: 4mm;
  height: 1px;
  background: var(--line);
  z-index: 0;
}
.career-projects > .proj-card {
  position: relative;
}

/* ============================================================
   Projects
   ============================================================ */
.proj-grid { display: grid; grid-template-columns: 1fr; gap: 6mm; }

.proj-card {
  border: 1px solid var(--line);
  padding: 5mm 6mm 5mm;
  background: var(--paper);
  position: relative;
  break-inside: avoid;
}
.proj-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  opacity: 0.85;
}

.proj-head { margin-bottom: 4mm; }

.proj-period {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3mm;
}
.proj-idx {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--accent);
  padding: 3px 8px;
  background: var(--accent-soft);
  border-radius: 2px;
}
.proj-dates {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.proj-duration {
  font-size: 11px;
  color: var(--ink);
  padding-left: 10px;
  border-left: 1px solid var(--line);
  font-weight: 500;
}

.proj-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 3mm;
  color: var(--ink);
  letter-spacing: 0.03em;
  line-height: 1.5;
}

.proj-tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  font-size: 11.5px;
}
.proj-tags li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 6px;
  align-items: baseline;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}
.tag-k {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--sub);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tag-v { color: var(--ink); font-weight: 500; }

.proj-overview {
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink);
  margin: 0 0 4mm;
  white-space: pre-wrap;
  text-wrap: pretty;
}

.proj-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6mm;
}
.proj-cols--full {
  grid-template-columns: 1fr;
}
.proj-cols--full .proj-overview {
  margin-bottom: 0;
  margin-bottom: 4mm;
}
.proj-col h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 2mm;
  padding-bottom: 4px;
  border-bottom: 1.5px solid var(--line);
}

.proj-bullets {
  list-style: none;
  margin: 0;
  padding: 0;
}
.proj-bullets li {
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink);
  padding: 2px 0 2px 16px;
  position: relative;
  white-space: pre-wrap;
  text-wrap: pretty;
}
.proj-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  width: 8px;
  height: 1.5px;
  background: var(--sub);
}
.proj-achievements li::before { background: var(--accent); height: 2.5px; top: 11px; }
.proj-achievements li { color: var(--ink); font-weight: 500; }

.proj-stack {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-top: 3mm;
  border-top: 1px dashed var(--line);
}
.stack-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sub);
  padding-top: 5px;
  flex-shrink: 0;
}
.proj-stack ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.proj-stack li {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  background: var(--chip);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  letter-spacing: 0.02em;
}

/* ============================================================
   Education
   ============================================================ */
.edu-list { list-style: none; margin: 0; padding: 0; }
.edu-list li {
  display: grid;
  grid-template-columns: 38mm 1fr;
  gap: 6mm;
  padding: 3mm 0;
  border-bottom: 1px solid var(--line);
}
.edu-list li:last-child { border-bottom: none; }
.edu-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  letter-spacing: 0.04em;
  font-weight: 500;
}
.edu-school { font-size: 13px; font-weight: 700; color: var(--ink); }
.edu-note { font-size: 11.5px; color: var(--ink); margin-top: 3px; line-height: 1.7; }

/* ============================================================
   Footer
   ============================================================ */
.r-footer {
  margin-top: 10mm;
  padding-top: 4mm;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.r-foot-meta { font-size: 10px; color: var(--sub); }

/* ============================================================
   Tweaks panel additions
   ============================================================ */
.tweak-swatches {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.tweak-swatches .swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  outline: 1px solid rgba(0,0,0,0.1);
}
.tweak-swatches .swatch.active {
  border-color: white;
  outline: 2px solid #333;
}

/* ============================================================
   Print
   ============================================================ */
@media print {
  @page {
    size: A4;
    margin: 14mm 0 0;
  }
  @page :first {
    margin: 0;
  }
  html, body {
    background: white;
  }
  .r-stage {
    padding: 0;
  }
  .r-paper {
    box-shadow: none;
    width: 210mm;
    min-height: 297mm;
    padding: 14mm 14mm 12mm;
  }
  .proj-card, .r-section { break-inside: avoid; }
  .twk-panel, #tweaks-toggle { display: none !important; }
}
