/* style.css */
@font-face {
  font-family: Share Tech Mono Fallback;
  src: local(Courier New), local(CourierNewPSMT), local(Liberation Mono), local(Cousine), local(Roboto Mono), local(Droid Sans Mono), local(Noto Sans Mono), local(DejaVu Sans Mono);
  size-adjust: 89.98%;
  unicode-range: U+20-7e;
}

:root {
  --bg: #f5f5f5;
  --surface: #fff;
  --grid-dot: #e0e0e0;
  --border: #e5e5e5;
  --border-hi: #d4d4d4;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-active: #1d4ed8;
  --accent-secondary: #6366f1;
  --txt: #666;
  --txt-br: #1a1a1a;
  --val: #0a0a0a;
  --dim: #999;
  --fp: "Share Tech Mono", "Courier New", monospace;
  --fm: "Share Tech Mono", "Courier New", monospace;
  --fh: "Share Tech Mono", "Share Tech Mono Fallback", "Courier New", monospace;
  --font-ja: "Hiragino Sans", "Noto Sans JP", "BIZ UDPGothic", Meiryo, sans-serif;
  --vs-top: 72px;
  --vs-left: 64px;
  --vs-right: 64px;
  --vs-bottom: 72px;
  --text-u: 1px;
  --body-u: 1px;
  --space-u: 1px;
  --sidebar-w: 230px;
}

body.dark-mode, html.dark-init body {
  --bg: #0a0a0a;
  --surface: #1a1a1a;
  --grid-dot: #1f1f1f;
  --border: #262626;
  --border-hi: #404040;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --accent-secondary: #818cf8;
  --txt: #a3a3a3;
  --txt-br: #f5f5f5;
  --val: #fafafa;
  --dim: #737373;
}

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

html, body {
  overflow: hidden;
  width: 100%;
  height: 100%;
  font-family: Inter, -apple-system, sans-serif;
}

body {
  background: radial-gradient(circle, var(--grid-dot) 1px, transparent 1px) 0 0 / 24px 24px, var(--bg);
  transition: background-color .3s ease-out;
}

html.dark-init body {
  transition: none;
}

#three-canvas {
  position: fixed;
  display: block;
  z-index: 0;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

#scanlines {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, #0000, #0000 3px, #00000004 3px 4px);
  inset: 0;
}

#dither {
  position: fixed;
  z-index: 99;
  pointer-events: none;
  mix-blend-mode: overlay;
  animation: 10s linear infinite dither-drift;
  background-image: repeating-conic-gradient(#80808003 0% 25%, #0000 0% 50%);
  background-size: 4px 4px;
  inset: 0;
}

@keyframes dither-drift {
  to {
    transform: translate(4px, 4px);
  }
}

#loader {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items:  center;
  transition: opacity .2s, visibility .2s;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  #loader {
    transition: none;
  }
}

.loader-inner {
  text-align: center;
}

.loader-title {
  font-family: var(--fp);
  color: var(--accent);
  letter-spacing: 4px;
  margin-bottom: 24px;
  font-size: 14px;
}

.loader-bar {
  background: var(--border);
  width: 200px;
  height: 4px;
  margin: 0 auto 14px;
}

.loader-fill {
  background: var(--accent);
  width: 0%;
  height: 100%;
  transition: width .3s;
}

.loader-text {
  font-family: var(--fp);
  color: var(--txt);
  letter-spacing: 3px;
  animation: 1.2s step-end infinite blink;
  font-size: 12px;
}

#overlay {
  position: fixed;
  z-index: 2;
  pointer-events: none;
  font-family: var(--fm);
  color: var(--txt-br);
  inset: 0;
}

#exp-header {
  position: fixed;
  top: 0;
  left: var(--vs-left);
  right: var(--vs-right);
  height: var(--vs-top);
  display: flex;
  font-family: var(--fh);
  pointer-events: none;
  z-index: 10;
  justify-content: space-between;
  align-items:  center;
  padding-top: 4px;
}

.exp-left {
  display: flex;
  align-items:  center;
  gap: 8px;
}

.exp-right {
  display: flex;
  pointer-events: auto;
  align-items:  center;
  gap: 12px;
}

.exp-label {
  font-size: calc(36 * var(--text-u));
  color: var(--val);
  letter-spacing: calc(5 * var(--text-u));
  text-decoration: none;
  pointer-events: auto;
  transition: color .2s ease-out;
}

#overlay h1, #overlay h2 {
  font-weight: inherit;
}

#overlay .ph > h2 {
  font: inherit;
  display: flex;
  align-items:  center;
  gap: inherit;
}

.exp-sep {
  font-size: calc(20 * var(--text-u));
  color: var(--txt);
}

.exp-type {
  font-size: calc(20 * var(--text-u));
  color: var(--txt-br);
  letter-spacing: calc(3 * var(--text-u));
}

#theme-toggle {
  --sw-u: var(--text-u);
  --sw-body: #efece4;
  --sw-gap: #8f8a7e;
  --sw-mark: #bdb8ac;
  --sw-plate-hi: #f4f2ec;
  --sw-plate-lo: #dcd9d2;
  --sw-plate-edge: #cbc9c2;
  --sw-face: #f8f6f3;
  --sw-ring: #bab6ac;
  position: relative;
  display: inline-flex;
  height: calc(22px + 14 * var(--text-u));
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: none;
  border: 0;
  justify-content: center;
  align-items:  center;
  padding: 0;
}

body.dark-mode #theme-toggle {
  --sw-body: #242424;
  --sw-gap: #050505;
  --sw-mark: #4c4c4c;
  --sw-plate-hi: #666;
  --sw-plate-lo: #212121;
  --sw-plate-edge: #1f1f1f;
  --sw-face: #1b1b1b;
  --sw-rim: #434343;
  --sw-lip: #545454;
}

#theme-toggle .ts-visual {
  position: relative;
  width: calc(26 * var(--sw-u));
  height: 100%;
}

#theme-toggle .ts-canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
}

#theme-toggle .ts-visual:before, #theme-toggle .ts-visual:after {
  content: "";
  position: absolute;
}

#theme-toggle.is-3d .ts-visual:before, #theme-toggle.is-3d .ts-visual:after {
  content: none;
}

#theme-toggle .ts-visual:before {
  border-radius: calc(2.5 * var(--sw-u));
  background: linear-gradient(165deg, var(--sw-plate-hi), var(--sw-body) 40%, var(--sw-plate-lo));
  box-shadow: inset calc(-.7 * var(--sw-u)) calc(-.7 * var(--sw-u)) 0 var(--sw-plate-edge);
  width: 70%;
  height: 91%;
  top: 4%;
  left: 15%;
}

#theme-toggle .ts-visual:after {
  border-radius: calc(.6 * var(--sw-u));
  background: linear-gradient(var(--sw-mark), var(--sw-mark)) 76% 50% / calc(.45 * var(--sw-u)) 26% no-repeat, linear-gradient(to bottom, var(--sw-gap) 0 7%, var(--sw-face) 7%);
  box-shadow: 0 0 0 calc(.4 * var(--sw-u)) var(--sw-ring), 0 calc(1.4 * var(--sw-u)) calc(.8 * var(--sw-u)) #00000038;
  width: 27%;
  height: 31%;
  top: 35%;
  left: 37%;
}

body.dark-mode #theme-toggle .ts-visual:after {
  background: linear-gradient(var(--sw-mark), var(--sw-mark)) 76% 50% / calc(.45 * var(--sw-u)) 26% no-repeat, linear-gradient(to bottom, var(--sw-rim) 0 8%, var(--sw-face) 8% 92%, var(--sw-gap) 92%);
  box-shadow: 0 0 0 calc(.4 * var(--sw-u)) var(--sw-gap), 0 calc(.9 * var(--sw-u)) 0 calc(.3 * var(--sw-u)) var(--sw-lip);
}

.exp-btn {
  font-family: var(--fh);
  font-size: calc(14 * var(--text-u));
  color: var(--val);
  letter-spacing: calc(3 * var(--text-u));
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-decoration: none;
  display: inline-block;
  padding: 10px 28px;
  transition: background .2s ease-out, color .2s ease-out, border-color .2s ease-out;
  line-height: 1;
}

.exp-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

#virtual-screen {
  position: fixed;
  top: var(--vs-top);
  left: var(--vs-left);
  right: var(--vs-right);
  bottom: var(--vs-bottom);
  pointer-events: none;
  z-index: 2;
  border: 1px solid var(--border);
}

#exp-footer {
  position: fixed;
  bottom: 0;
  left: var(--vs-left);
  right: var(--vs-right);
  height: var(--vs-bottom);
  display: flex;
  font-family: var(--fp);
  pointer-events: none;
  z-index: 4;
  justify-content: space-between;
  align-items:  center;
}

.ef-credit {
  font-family: Inter, -apple-system, sans-serif;
  font-size: calc(16 * var(--text-u));
  color: var(--dim);
  letter-spacing: calc(.5 * var(--text-u));
  font-weight: 300;
}

.ef-copy {
  font-family: var(--fp);
  font-size: calc(13 * var(--text-u));
  color: var(--dim);
  letter-spacing: calc(1.5 * var(--text-u));
}

#model-selector {
  position: fixed;
  height: var(--vs-bottom);
  display: flex;
  font-family: var(--fp);
  pointer-events: none;
  z-index: 10;
  align-items:  center;
  gap: 12px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.model-btn {
  pointer-events: auto;
  font-family: var(--fm);
  font-size: calc(11 * var(--text-u));
  color: var(--txt);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  cursor: pointer;
  justify-content: center;
  align-items:  center;
  width: 30px;
  height: 30px;
  padding: 0;
  transition: color .2s ease-out, border-color .2s ease-out;
  line-height: 1;
}

.model-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.model-btn:focus:not(:focus-visible) {
  outline: none;
}

#model-selector [hidden] {
  display: none;
}

#model-retry {
  width: auto;
  padding: 0 8px;
}

#model-retry[aria-disabled="true"] {
  color: var(--dim);
  cursor: default;
}

.model-info {
  display: flex;
  min-width: calc(210 * var(--text-u));
  justify-content: center;
  align-items: baseline;
  gap: 8px;
}

#model-label {
  font-size: calc(15 * var(--text-u));
  letter-spacing: calc(2 * var(--text-u));
  color: var(--txt-br);
}

#model-label.loading {
  color: var(--dim);
  animation: 1.2s step-end infinite blink;
}

#model-count {
  font-size: calc(12 * var(--text-u));
  color: var(--dim);
  letter-spacing: calc(1 * var(--text-u));
}

.mobile-content {
  display: contents;
}

#sidebar-l, #sidebar-r {
  position: fixed;
  top: calc(var(--vs-top)  + 6 * var(--space-u));
  bottom: calc(var(--vs-bottom)  + 6 * var(--space-u));
  width: var(--sidebar-w);
  display: flex;
  gap: calc(4 * var(--space-u)  - 1px);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  pointer-events: auto;
  z-index: 5;
  flex-direction: column;
}

#sidebar-l::-webkit-scrollbar {
  display: none;
}

#sidebar-r::-webkit-scrollbar {
  display: none;
}

#sidebar-l {
  left: calc(var(--vs-left)  + 6 * var(--space-u));
}

#sidebar-r {
  --scrollbar-w: 0px;
  right: calc(var(--vs-right)  + 6 * var(--space-u)  - var(--scrollbar-w));
  width: calc(var(--sidebar-w)  + var(--scrollbar-w));
}

@supports selector(::-webkit-scrollbar) {
  #sidebar-r {
    --scrollbar-w: 4px;
    overflow-y: scroll;
    scrollbar-width: auto;
  }

  #sidebar-r::-webkit-scrollbar {
    display: block;
    width: 4px;
  }

  #sidebar-r::-webkit-scrollbar-thumb {
    background: var(--dim);
  }

  #sidebar-r::-webkit-scrollbar-thumb:hover {
    background: var(--txt);
  }
}

@supports  not selector(::-webkit-scrollbar) {
  #sidebar-r {
    scrollbar-width: thin;
    scrollbar-color: var(--dim) transparent;
  }
}

.panel {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: calc(8 * var(--space-u)) calc(10 * var(--space-u));
  overflow: hidden;
  position: relative;
  display: flex;
  border: 1px solid var(--border);
  background: #fff9;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform .2s ease-out, box-shadow .2s ease-out, background-color .3s ease-out, border-color .3s ease-out;
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px #0000000f;
}

body.dark-mode .panel {
  background: #1a1a1a99;
}

body.dark-mode .panel:hover {
  box-shadow: 0 4px 12px #0000004d;
}

.ph {
  font-family: var(--fp);
  font-size: calc(24 * var(--text-u));
  color: var(--accent);
  letter-spacing: calc(.5 * var(--text-u));
  margin-bottom: calc(6 * var(--space-u));
  padding-bottom: calc(4 * var(--space-u));
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  flex-shrink: 0;
  align-items:  center;
  gap: 4px;
}

.dot {
  animation: 2.5s ease-in-out infinite pulse;
  border-radius: 50%;
  flex-shrink: 0;
  width: 4px;
  height: 4px;
}

.dot.g {
  background: var(--accent-secondary);
}

.dot.b {
  background: var(--accent);
}

.dot.a {
  background: var(--accent-hover);
}

.dot.p {
  background: var(--accent-secondary);
}

.pc {
  font-size: calc(20 * var(--text-u));
  overflow: hidden;
  color: var(--txt-br);
  flex: 1;
  line-height: 1.4;
}

.skill-row {
  display: flex;
  margin-bottom: calc(3 * var(--space-u));
  align-items:  center;
  gap: 6px;
}

.skill-name {
  font-size: calc(16 * var(--text-u));
  color: var(--txt);
  flex-shrink: 0;
  min-width: 8.125em;
}

.skill-bar {
  background: var(--border-hi);
  flex: 1;
  height: 4px;
}

.skill-fill {
  background: var(--accent-secondary);
  height: 100%;
  transition: width .8s;
}

.career-entry {
  margin-bottom: calc(6 * var(--space-u));
  padding-left: calc(8 * var(--space-u));
  border-left: 2px solid var(--accent);
}

.career-year {
  font-family: var(--fp);
  font-size: calc(16 * var(--text-u));
  color: var(--accent);
  letter-spacing: calc(1 * var(--text-u));
  margin-bottom: calc(1 * var(--space-u));
}

.career-role {
  font-size: calc(16 * var(--text-u));
  color: var(--val);
  font-weight: 400;
}

.career-company {
  font-size: calc(16 * var(--text-u));
  color: var(--txt);
}

.project-entry {
  margin-bottom: calc(8 * var(--space-u));
  padding-bottom: calc(6 * var(--space-u));
  border-bottom: 1px solid var(--border);
}

.project-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.project-name {
  font-family: var(--fp);
  font-size: calc(15 * var(--text-u));
  color: var(--accent);
  letter-spacing: calc(1 * var(--text-u));
  text-decoration: none;
  pointer-events: auto;
  display: inline;
  margin-bottom: 2px;
  transition: color .2s ease-out;
}

.project-name:after {
  content: "→";
  display: inline-block;
  font-size: calc(14 * var(--text-u));
  margin-left: 4px;
  transition: transform .2s ease-out;
}

.project-name:hover {
  color: var(--accent-hover);
}

.project-name:hover:after {
  transform: translateX(3px);
}

.project-desc {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, var(--font-ja);
  font-size: calc(14 * var(--body-u));
  color: var(--txt);
  margin-bottom: calc(2 * var(--space-u));
  word-break: auto-phrase;
  line-height: 1.4;
}

.project-tech {
  font-family: var(--fp);
  font-size: calc(12 * var(--body-u));
  color: var(--dim);
  letter-spacing: calc(.5 * var(--body-u));
}

.project-repo {
  float: right;
  color: var(--accent);
  text-decoration: none;
  pointer-events: auto;
  margin-left: 8px;
  transition: color .2s ease-out;
}

.project-repo:after {
  content: "→";
  display: inline-block;
  margin-left: 4px;
  transition: transform .2s ease-out;
}

.project-repo:hover {
  color: var(--accent-hover);
}

.project-repo:hover:after {
  transform: translateX(3px);
}

.ph-link {
  font-size: calc(12 * var(--text-u));
  letter-spacing: calc(1.5 * var(--text-u));
  color: var(--txt);
  text-decoration: none;
  pointer-events: auto;
  margin-left: auto;
  transition: color .2s ease-out;
}

.ph-link:hover {
  color: var(--accent);
}

.work-entry {
  display: block;
  margin-bottom: calc(8 * var(--space-u));
  padding-bottom: calc(6 * var(--space-u));
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  pointer-events: auto;
}

.work-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.work-name {
  display: block;
  font-family: "Share Tech Mono", "Courier New", var(--font-ja);
  font-size: calc(14 * var(--text-u));
  color: var(--accent);
  margin-bottom: calc(2 * var(--space-u));
  word-break: auto-phrase;
  transition: color .2s ease-out;
  line-height: 1.4;
}

.work-name:after {
  content: " →";
  position: relative;
  transition: left .2s ease-out;
  left: 0;
}

.work-entry:hover .work-name {
  color: var(--accent-hover);
}

.work-entry:hover .work-name:after {
  left: 3px;
}

.work-desc {
  display: block;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, var(--font-ja);
  font-size: calc(14 * var(--body-u));
  color: var(--txt);
  line-height: 1.4;
}

.link-row {
  display: flex;
  padding: calc(4 * var(--space-u)) 0;
  text-decoration: none;
  pointer-events: auto;
  color: var(--txt-br);
  align-items:  center;
  gap: 6px;
  transition: color .2s ease-out;
}

.link-row:hover {
  color: var(--accent);
}

.link-icon {
  font-size: calc(12 * var(--body-u));
  color: var(--accent-secondary);
  flex-shrink: 0;
}

.link-label {
  font-size: calc(16 * var(--body-u));
  letter-spacing: calc(1 * var(--body-u));
}

.link-arrow {
  font-size: calc(14 * var(--body-u));
  opacity: 0;
  margin-left: auto;
  transition: opacity .2s ease-out, transform .2s ease-out;
  transform: translateX(-4px);
}

.link-row:hover .link-arrow {
  opacity: 1;
  transform: translateX(0);
}

#writing-picks {
  margin-bottom: calc(2 * var(--space-u));
}

#writing-picks:empty {
  display: none;
}

.writing-elsewhere {
  margin-top: calc(4 * var(--space-u));
  padding-top: calc(8 * var(--space-u));
  border-top: 1px solid var(--border);
}

.writing-entry {
  display: block;
  margin-bottom: calc(6 * var(--space-u));
  text-decoration: none;
  pointer-events: auto;
}

.writing-elsewhere .writing-entry {
  margin-bottom: calc(8 * var(--space-u));
}

.writing-entry:last-child {
  margin-bottom: 0;
}

.writing-title {
  display: block;
  font-family: "Share Tech Mono", "Courier New", var(--font-ja);
  font-size: calc(14 * var(--body-u));
  color: var(--txt-br);
  word-break: auto-phrase;
  transition: color .2s ease-out;
  line-height: 1.4;
}

.writing-title:after {
  content: " →";
  position: relative;
  color: var(--accent);
  transition: left .2s ease-out;
  left: 0;
}

.writing-entry[target] .writing-title:after {
  content: " ↗";
}

.writing-entry:hover .writing-title {
  color: var(--accent);
}

.writing-entry:hover .writing-title:after {
  left: 3px;
}

.writing-meta {
  display: block;
  margin-top: calc(1 * var(--space-u));
  font-family: var(--fp);
  font-size: calc(12 * var(--body-u));
  color: var(--dim);
  letter-spacing: calc(.5 * var(--body-u));
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: .35;
  }
}

@media (prefers-reduced-motion: reduce) {
  #dither, .dot, .loader-text, #model-label.loading {
    animation: none;
  }
}

@media (min-width: 1441px) {
  body {
    --text-u-max: 1.28px;
    --fit-fixed: 348px;
    --fit-lines: 672;
    --text-u: max(1px, min(1px + (100vw - 1440px) * .00025, var(--text-u-max), (100vh - var(--fit-fixed)) / var(--fit-lines)));
    --body-u: var(--text-u);
    --space-u-max: 2.5px;
    --fit-space: 240;
    --space-u: clamp(1px, 1px + (100vh - var(--fit-fixed)  - var(--fit-lines) * var(--text-u)) / var(--fit-space), var(--space-u-max));
    --sidebar-w: calc(230 * var(--text-u)  + 20 * (var(--space-u)  - 1px));
    --frame-gutter: 64px;
    --frame-w-base: 1312px;
    --model-clear: 84vh;
    --sidebar-inset: calc(6 * var(--space-u));
    --frame-w: min(100vw - 2 * var(--frame-gutter), max(var(--frame-w-base), var(--model-clear)  + 2 * (var(--sidebar-w)  + var(--sidebar-inset))));
    --vs-left: calc((100vw - var(--frame-w)) / 2);
    --vs-right: calc((100vw - var(--frame-w)) / 2);
  }

  body:not(.things-page):not(.blog-page):not(.work-page):not(.hire-page):not(.not-found-page) :-webkit-any(.skill-name, .career-year, .career-role, .career-company, .project-desc, .project-tech, .work-name, .work-desc, .writing-title, .writing-meta, .link-label) {
    line-height: calc(1.4em + 2 * (var(--space-u)  - 1px));
  }

  body:not(.things-page):not(.blog-page):not(.work-page):not(.hire-page):not(.not-found-page) :-moz-any(.skill-name, .career-year, .career-role, .career-company, .project-desc, .project-tech, .work-name, .work-desc, .writing-title, .writing-meta, .link-label) {
    line-height: calc(1.4em + 2 * (var(--space-u)  - 1px));
  }

  body:not(.things-page):not(.blog-page):not(.work-page):not(.hire-page):not(.not-found-page) :is(.skill-name, .career-year, .career-role, .career-company, .project-desc, .project-tech, .work-name, .work-desc, .writing-title, .writing-meta, .link-label) {
    line-height: calc(1.4em + 2 * (var(--space-u)  - 1px));
  }
}

@media (min-width: 1441px) and (min-aspect-ratio: 15 / 8) {
  body {
    --sidebar-w: calc(340 * var(--text-u)  + 20 * (var(--space-u)  - 1px));
    --fit-fixed: 348px;
    --fit-lines: 558;
    --fit-space: 228;
  }

  #sidebar-l .panel:first-child .pc {
    display: grid;
    grid-template-rows: repeat(var(--skill-rows, 5), auto);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    column-gap: 16px;
  }

  .skill-row {
    align-items: stretch;
    gap: calc(2 * var(--space-u));
    margin-bottom: calc(6 * var(--space-u));
    flex-direction: column;
  }

  .skill-name {
    min-width: 0;
  }

  .skill-bar {
    flex: none;
    width: 100%;
  }

  .career-entry {
    display: grid;
    grid-template-columns: 6em 1fr;
    column-gap: 12px;
  }

  .career-year {
    grid-row: 1 / span 2;
  }
}

@media (min-width: 1921px) {
  #sidebar-r {
    --body-u-max: 1.1px;
    --body-u: min(var(--text-u), var(--body-u-max));
  }
}

@media (max-width: 1000px) {
  :root {
    --vs-top: 40px;
    --vs-left: 16px;
    --vs-right: 16px;
    --vs-bottom: 40px;
  }

  #sidebar-l, #sidebar-r {
    width: 120px;
  }

  #sidebar-r {
    width: calc(120px + var(--scrollbar-w));
  }

  .ph {
    font-size: 16px;
  }

  .pc {
    font-size: 15px;
  }

  .exp-label {
    letter-spacing: 3px;
    font-size: 22px;
  }

  .exp-type {
    font-size: 14px;
  }

  .ef-credit {
    font-size: 13px;
  }

  .skill-row {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  .skill-name {
    overflow-wrap: break-word;
    min-width: 0;
    font-size: 14px;
  }

  .skill-bar {
    flex: none;
    width: 100%;
  }

  .career-year, .career-role {
    font-size: 14px;
  }

  .career-company {
    font-size: 13px;
  }

  .project-name {
    font-size: 14px;
  }

  .project-desc {
    font-size: 13px;
  }

  .project-tech {
    font-size: 11px;
  }

  .work-name, .work-desc, .writing-title {
    font-size: 13px;
  }

  .writing-meta {
    font-size: 11px;
  }

  .link-label {
    font-size: 14px;
  }

  .exp-btn {
    padding: 8px 18px;
    font-size: 12px;
  }

  #theme-toggle {
    --sw-u: calc(30px / 36);
    height: 30px;
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  html, body {
    overflow-y: auto;
    height: auto;
  }

  #three-canvas {
    inset: auto;
    position: relative !important;
    width: 100% !important;
    height: 60vh !important;
  }

  #loader {
    position: absolute;
    top: 30vh;
  }

  #scanlines, #dither {
    position: absolute;
    height: 60vh;
  }

  #overlay {
    position: relative;
    inset: auto;
  }

  #exp-header {
    position: fixed;
    background: var(--bg);
    z-index: 100;
    height: 48px;
    top: 0;
    left: 16px;
    right: 16px;
  }

  #virtual-screen {
    display: none;
  }

  #model-selector {
    position: static;
    pointer-events: auto;
    justify-content: center;
    height: auto;
    padding: 14px 0 2px;
    transform: none;
  }

  #model-label {
    font-size: 13px;
  }

  #sidebar-l, #sidebar-r {
    position: static;
    display: contents;
    width: 100%;
  }

  .mobile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 8px;
  }

  #sidebar-l .panel:first-child, #sidebar-r .panel:last-child {
    position: relative;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: .4s ease-out backwards fadeSlideIn;
    background: #ffffffb3;
    padding: 10px;
    box-shadow: 0 4px 16px #00000014;
  }

  #sidebar-l .panel:first-child {
    order: 1;
  }

  #sidebar-r .panel:last-child {
    order: 2;
  }

  #sidebar-l .panel:last-child {
    order: 3;
  }

  #sidebar-r .panel:nth-child(2) {
    order: 4;
  }

  #sidebar-r .panel:first-child {
    grid-column: 1 / -1;
    order: 0;
  }

  #writing {
    grid-column: 1 / -1;
    order: 5;
    padding: 12px 14px;
  }

  #sidebar-l .panel:first-child .ph {
    margin-bottom: 6px;
    font-size: 13px;
  }

  #sidebar-l .panel:first-child .skill-row {
    margin-bottom: 6px;
  }

  #sidebar-l .panel:first-child .skill-name {
    min-width: unset;
    padding: 0;
    font-size: 13px;
  }

  #sidebar-l .panel:first-child .skill-row:nth-child(n+8) {
    display: none;
  }

  #sidebar-r .panel:last-child .ph {
    margin-bottom: 6px;
    font-size: 13px;
  }

  #sidebar-r .panel:last-child .link-arrow {
    display: none;
  }

  #sidebar-r .panel:last-child .link-icon {
    padding: 2px;
    font-size: 14px;
  }

  #sidebar-r .panel:last-child .link-label {
    font-size: 13px;
  }

  #sidebar-r .panel:last-child .link-row {
    min-height: 36px;
    padding: 2px 0;
  }

  #sidebar-r .panel:first-child, #sidebar-l .panel:last-child, #sidebar-r .panel:nth-child(2) {
    padding: 12px 14px;
  }

  .ph {
    margin-bottom: 8px;
    font-size: 16px;
  }

  .pc {
    font-size: 15px;
  }

  .skill-name {
    min-width: 72px;
    font-size: 14px;
  }

  .career-year {
    font-size: 14px;
  }

  .career-role {
    font-size: 15px;
  }

  .career-company, .project-name, .project-desc {
    font-size: 14px;
  }

  .project-tech {
    font-size: 12px;
  }

  .work-name {
    font-size: 15px;
  }

  .work-desc {
    font-size: 14px;
  }

  .writing-title {
    font-size: 15px;
  }

  .writing-meta {
    font-size: 12px;
  }

  .link-label {
    font-size: 15px;
  }

  #exp-footer {
    position: static;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    height: auto;
    padding: 16px;
  }

  .ef-credit {
    font-size: 12px;
  }

  .ef-copy {
    font-size: 11px;
  }

  .exp-label {
    letter-spacing: 2px;
    white-space: nowrap;
    font-size: 20px;
  }

  .exp-sep, .exp-type {
    display: none;
  }

  .exp-right {
    flex-shrink: 0;
    gap: 8px;
  }

  .exp-btn {
    text-align: center;
    white-space: nowrap;
    min-width: 44px;
  }

  body.dark-mode #sidebar-l .panel:first-child, body.dark-mode #sidebar-r .panel:last-child {
    background: #1a1a1ab3;
    box-shadow: 0 4px 16px #0006;
  }
}

@media (max-width: 768px) and (orientation: portrait) {
  #three-canvas {
    height: 70vh !important;
    height: 70svh !important;
  }

  #loader {
    top: 35vh;
    top: 35svh;
  }

  #scanlines, #dither {
    height: 70vh;
    height: 70svh;
  }
}

@media (max-width: 768px), (pointer: coarse) {
  .exp-btn {
    position: relative;
  }

  .exp-btn:after {
    content: "";
    position: absolute;
    width: max(100%, 44px);
    height: 44px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .model-btn {
    position: relative;
  }

  .model-btn:after {
    content: "";
    position: absolute;
    width: 44px;
    height: 44px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

@media (pointer: coarse) and (not (max-width: 768px)) {
  .model-btn:after {
    margin-top: min(0px, (var(--vs-bottom)  - 44px) / 2);
  }
}

@media (max-width: 480px) {
  #exp-header {
    left: 12px;
    right: 12px;
  }

  .exp-label {
    letter-spacing: clamp(1px, calc(1px + (100vw - 360px) / 30), 2px);
    font-size: clamp(15px, 6.66667vw - 8px, 20px);
  }

  .exp-btn {
    letter-spacing: 1px;
    padding: 8px 10px;
  }

  #sidebar-l .panel:first-child, #sidebar-r .panel:last-child {
    padding: 8px;
  }

  .mobile-content {
    grid-template-columns: 1fr 1fr;
  }

  #sidebar-l .panel:last-child, #sidebar-r .panel:nth-child(2) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 359px) {
  .exp-btn {
    letter-spacing: .5px;
    padding: 8px 6px;
  }
}

@media print {
  body:-webkit-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :-webkit-any(#scanlines, #dither) {
    display: none;
  }

  body:-moz-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :-moz-any(#scanlines, #dither) {
    display: none;
  }

  body:is(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :is(#scanlines, #dither) {
    display: none;
  }

  body:-webkit-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) #exp-header {
    position: static;
    margin-inline: var(--vs-left) var(--vs-right);
    flex: none;
  }

  body:-moz-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) #exp-header {
    position: static;
    margin-inline: var(--vs-left) var(--vs-right);
    flex: none;
  }

  body:is(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) #exp-header {
    position: static;
    margin-inline: var(--vs-left) var(--vs-right);
    flex: none;
  }

  body:-webkit-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :-webkit-any(#blog-screen, #hire-screen, #work-screen, #things-screen, #nf-screen) {
    margin-top: 0;
  }

  body:-moz-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :-moz-any(#blog-screen, #hire-screen, #work-screen, #things-screen, #nf-screen) {
    margin-top: 0;
  }

  body:is(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :is(#blog-screen, #hire-screen, #work-screen, #things-screen, #nf-screen) {
    margin-top: 0;
  }

  @media (max-width: 768px) {
    body:-webkit-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :-webkit-any(#blog-screen, #hire-screen, #work-screen, #things-screen, #nf-screen) {
      margin-top: 8px;
    }

    body:-moz-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :-moz-any(#blog-screen, #hire-screen, #work-screen, #things-screen, #nf-screen) {
      margin-top: 8px;
    }

    body:is(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) :is(#blog-screen, #hire-screen, #work-screen, #things-screen, #nf-screen) {
      margin-top: 8px;
    }
  }

  body:-webkit-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) {
    --bg: #fff;
    --surface: #fff;
    --grid-dot: transparent;
    --border: #e5e5e5;
    --border-hi: #d4d4d4;
    --accent: var(--accent-active);
    --accent-hover: var(--accent);
    --accent-secondary: #4338ca;
    --txt: #404040;
    --txt-br: #1a1a1a;
    --val: #0a0a0a;
    --dim: #666;
  }

  body:-moz-any(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) {
    --bg: #fff;
    --surface: #fff;
    --grid-dot: transparent;
    --border: #e5e5e5;
    --border-hi: #d4d4d4;
    --accent: var(--accent-active);
    --accent-hover: var(--accent);
    --accent-secondary: #4338ca;
    --txt: #404040;
    --txt-br: #1a1a1a;
    --val: #0a0a0a;
    --dim: #666;
  }

  body:is(.blog-page, .hire-page, .work-page, .things-page, .not-found-page) {
    --bg: #fff;
    --surface: #fff;
    --grid-dot: transparent;
    --border: #e5e5e5;
    --border-hi: #d4d4d4;
    --accent: var(--accent-active);
    --accent-hover: var(--accent);
    --accent-secondary: #4338ca;
    --txt: #404040;
    --txt-br: #1a1a1a;
    --val: #0a0a0a;
    --dim: #666;
  }
}

/* work.css */
body.work-page {
  overflow: hidden auto;
  height: auto;
  min-height: 100%;
}

html:has(body.work-page) {
  overflow: hidden auto;
  height: auto;
  min-height: 100%;
}

html:has(body.work-page) {
  --work-header-height: var(--vs-top);
}

html:has(body.work-page .work-column) {
  scroll-padding-top: calc(var(--work-header-height)  + 4px);
}

body.work-page {
  --measure: calc(720 * var(--text-u));
  --font-display: "Share Tech Mono", "Courier New", var(--font-ja);
  --font-read: "Inter", -apple-system, BlinkMacSystemFont, var(--font-ja);
  --sheet: color-mix(in srgb, var(--surface) 60%, var(--bg));
  font-family: var(--font-display);
  color: var(--txt-br);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  min-height: 100dvh;
}

body.work-page #exp-header {
  height: var(--work-header-height);
  pointer-events: auto;
  background: linear-gradient(var(--bg) 70%, transparent);
}

body.work-page .exp-type {
  text-decoration: none;
  transition: color .2s ease-out;
}

body.work-page .exp-label:hover, body.work-page .exp-type:hover {
  color: var(--accent);
}

#work-screen {
  margin: var(--vs-top) var(--vs-right) 0 var(--vs-left);
  border: 1px solid var(--border);
  padding: calc(22 * var(--text-u)) calc(20 * var(--text-u)) calc(28 * var(--text-u));
  position: relative;
  z-index: 2;
  flex: 1;
}

#work-screen:before, #work-screen:after {
  content: "";
  position: absolute;
  border: 1px solid var(--dim);
  pointer-events: none;
  width: 10px;
  height: 10px;
}

#work-screen:before {
  border-width: 1px 0 0 1px;
  top: 6px;
  left: 6px;
}

#work-screen:after {
  border-width: 0 1px 1px 0;
  bottom: 6px;
  right: 6px;
}

.work-head {
  display: flex;
  justify-content: space-between;
  align-items:  flex-end;
  gap: calc(16 * var(--text-u));
  margin-bottom: calc(20 * var(--text-u));
}

.work-head .ph {
  font-size: calc(28 * var(--text-u));
  letter-spacing: calc(3 * var(--text-u));
  border: 0;
  margin: 0;
  padding: 0;
  font-weight: 400;
}

.work-sub {
  display: flex;
  align-items: baseline;
  gap: calc(14 * var(--text-u));
  font-size: calc(12 * var(--text-u));
  letter-spacing: calc(2 * var(--text-u));
  color: var(--txt);
  white-space: nowrap;
}

.work-count:before {
  content: "[ ";
}

.work-count:after {
  content: " ]";
}

.work-link {
  font-size: calc(12 * var(--text-u));
  letter-spacing: calc(2 * var(--text-u));
  color: var(--accent);
  text-decoration: none;
  margin: -8px 0;
  padding: 8px 0;
  transition: color .2s ease-out;
}

.work-link:hover {
  color: var(--accent-hover);
}

body.work-page:not(.dark-mode) .work-link {
  color: var(--accent-active);
}

body.work-page:not(.dark-mode) .work-link:hover {
  text-decoration: underline;
}

.work-column, .sheet, .case-nav {
  max-width: calc(var(--measure)  + 2 * 40 * var(--text-u));
  margin: 0 auto;
}

.cases-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: calc(14 * var(--text-u));
}

@media (min-width: 640px) {
  .cases-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.case {
  gap: calc(10 * var(--text-u));
  padding: calc(14 * var(--text-u)) calc(16 * var(--text-u)) calc(16 * var(--text-u));
  animation: .4s ease-out backwards fadeSlideIn;
  overflow: visible;
}

.case-meta {
  display: flex;
  font-size: calc(11 * var(--text-u));
  letter-spacing: calc(1.5 * var(--text-u));
  align-items:  center;
}

.case-no {
  color: var(--accent-secondary);
  padding: calc(2 * var(--text-u)) calc(6 * var(--text-u));
  border: 1px solid;
  line-height: 1;
}

.case-title {
  font: inherit;
  text-wrap: balance;
  word-break: auto-phrase;
  overflow-wrap: anywhere;
  margin: 0;
  font-weight: 400;
}

.case-link {
  font-size: calc(17 * var(--text-u));
  letter-spacing: .04em;
  color: var(--val);
  text-decoration: none;
  transition: color .2s ease-out;
  line-height: 1.5;
}

.case-link:before {
  content: "";
  position: absolute;
  inset: -1px;
}

.case:hover .case-link:before {
  bottom: -3px;
}

.case-link:after {
  content: " →";
  position: relative;
  color: var(--accent);
  transition: left .2s ease-out;
  font-size: .8em;
  left: 0;
}

.case:hover .case-link {
  color: var(--accent);
}

.case:hover .case-link:after {
  left: 4px;
}

.case-summary {
  font-family: var(--font-read);
  font-size: calc(14 * var(--text-u));
  color: var(--txt);
  text-autospace: normal;
  overflow-wrap: anywhere;
  font-weight: 400;
  line-height: 1.7;
}

.sheet {
  padding: calc(36 * var(--text-u)) calc(40 * var(--text-u)) calc(48 * var(--text-u));
  background: var(--sheet);
  border: 1px solid var(--border);
  transition: background-color .3s ease-out, border-color .3s ease-out;
}

.sheet-head {
  display: flex;
  gap: calc(14 * var(--text-u));
  padding-bottom: calc(20 * var(--text-u));
  margin-bottom: calc(32 * var(--text-u));
  border-bottom: 1px solid var(--border);
  flex-direction: column;
}

.sheet-title {
  font-size: calc(28 * var(--text-u));
  letter-spacing: .04em;
  color: var(--val);
  text-wrap: balance;
  word-break: auto-phrase;
  font-weight: 400;
  line-height: 1.5;
}

.sheet-body {
  font-family: var(--font-read);
  font-size: calc(16 * var(--text-u));
  letter-spacing: .02em;
  color: var(--txt-br);
  line-break: strict;
  overflow-wrap: anywhere;
  text-autospace: normal;
  font-weight: 400;
  line-height: 1.9;
}

.sheet-body > * + * {
  margin-top: 1.5em;
}

.sheet-body h2 {
  padding-bottom: calc(8 * var(--text-u));
  border-bottom: 1px solid var(--border);
  font-size: calc(22 * var(--text-u));
  color: var(--val);
  word-break: auto-phrase;
  margin-top: 3em;
  font-weight: 600;
  line-height: 1.5;
}

.sheet-body h2:before {
  content: "";
  display: inline-block;
  margin-right: calc(10 * var(--text-u));
  background: var(--accent);
  vertical-align: .2em;
  width: 6px;
  height: 6px;
}

.sheet-body h2 + * {
  margin-top: 1em;
}

.sheet-body > :first-child {
  margin-top: 0;
}

.case-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(14 * var(--text-u));
  margin-top: calc(14 * var(--text-u));
}

.case-nav-link {
  padding: calc(12 * var(--text-u)) calc(16 * var(--text-u));
  gap: calc(6 * var(--text-u));
  text-decoration: none;
}

.case-nav-link[rel="next"] {
  grid-column: 2;
  text-align: right;
}

.case-nav-label {
  font-size: calc(11 * var(--text-u));
  letter-spacing: calc(1.5 * var(--text-u));
  color: var(--accent);
}

.case-nav-title {
  font-family: var(--font-read);
  font-size: calc(14 * var(--text-u));
  color: var(--txt-br);
  text-autospace: normal;
  text-wrap: balance;
  word-break: auto-phrase;
  transition: color .2s ease-out;
  line-height: 1.6;
}

.case-nav-link:hover .case-nav-title {
  color: var(--accent);
}

body.work-page #exp-footer {
  position: static;
  height: var(--vs-bottom);
  margin: 0 var(--vs-right) 0 var(--vs-left);
  pointer-events: auto;
}

@media (max-width: 1000px) {
  #work-screen {
    padding: 16px 12px 20px;
  }

  .work-head .ph {
    font-size: 20px;
  }
}

@media (max-width: 768px) {
  html:has(body.work-page) {
    --work-header-height: 48px;
  }

  body.work-page #exp-header {
    background: var(--bg);
    z-index: 100;
    top: 0;
  }

  body.work-page #scanlines, body.work-page #dither {
    position: fixed;
    height: auto;
  }

  #work-screen {
    margin: 56px 8px 0;
    padding: 14px 10px 18px;
  }

  .work-head {
    margin-bottom: 14px;
  }

  .work-head:has(.ph) {
    flex-direction: column;
    align-items:  flex-start;
    gap: 6px;
  }

  .work-sub, .work-link {
    font-size: 11px;
  }

  .sheet {
    padding: 22px 16px 32px;
  }

  .sheet-head {
    margin-bottom: 24px;
  }

  .sheet-title {
    font-size: 22px;
  }

  .sheet-body {
    line-height: 1.85;
  }

  .sheet-body h2 {
    font-size: 20px;
  }

  .case-nav {
    grid-template-columns: 1fr;
  }

  .case-nav-link[rel="next"] {
    grid-column: auto;
  }

  .case-nav > span:empty {
    display: none;
  }

  body.work-page #exp-footer {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    height: auto;
    padding: 16px;
  }
}

@media print {
  .case {
    animation: none;
  }
}
