:root {
  color-scheme: dark;
  --paper: #e8ece9;
  --muted: #b0bbb9;
  --cyan: #8ed9e9;
  --orange: #edab76;
  --line: #4b5555;
  --ink: #14191b;
  --flip: 0deg;
  --quarter-turn: 0deg;
}
* { box-sizing: border-box; }
body { margin: 0; background: #333a3c; color: var(--paper); font-family: "Bahnschrift", "Trebuchet MS", sans-serif; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 4px; }
a:hover { color: var(--cyan); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
.scene { position: fixed; inset: -12px; background: linear-gradient(#17202455, #11181b80), url("../img/background_window.jpg") center / cover; filter: blur(6px); pointer-events: none; }
.stage { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; overflow: hidden; }
.card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 36px minmax(0, 1fr) 86px;
  width: min(1025px, calc(100vw - 64px), calc((100dvh - 96px) * 1.694214876));
  aspect-ratio: 1025 / 605;
  border: 1px solid #6a747177;
  border-radius: 0;
  background: #171b1c;
  box-shadow: 0 2px 1px #ffffff22 inset, 0 -2px 1px #000000aa inset, 0 3px 5px #00000099, 0 26px 65px #00000088;
  transform: rotate(calc(var(--quarter-turn) + var(--flip)));
  container-type: inline-size;
}
/* Static fibres + a broad sheen imitate matte, brushed stock without a canvas loop. */
.card::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: url("../img/velvet.svg") repeat, repeating-linear-gradient(112deg, #ffffff03 0 1px, transparent 1px 3px), linear-gradient(125deg, #75858117, transparent 42%, #00000040 76%, #97b0aa0c); opacity: .65; }
.card::after { content: ""; position: absolute; width: 62px; height: 3px; top: -1px; right: 35px; background: var(--orange); pointer-events: none; }
.card-header { display: flex; align-items: center; gap: 16px; padding: 0 32px; font: 10px/1.2 "Consolas", "Courier New", monospace; letter-spacing: 1.5px; color: var(--muted); border-bottom: 1px solid #ffffff10; }
.header-line { height: 1px; flex: 1; background: #ffffff14; }
.section-code { color: var(--cyan); }
.card-body { min-height: 0; }
.panel { display: grid; grid-template-columns: 33% minmax(0, 1fr); gap: 44px; height: 100%; padding: 26px 34px 28px; }
.visual { position: relative; min-width: 0; min-height: 0; padding: 9px; border: 1px solid #778a8638; background: #080c0d; }
.visual::before, .visual::after { content: ""; position: absolute; width: 24px; height: 38px; pointer-events: none; border-color: var(--paper); border-style: solid; }
.visual::before { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.visual::after { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.visual img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.65); }
.portrait img { object-position: center 35%; }
.work-visual img { object-position: top; filter: saturate(.8); }
.visual figcaption { position: absolute; bottom: 9px; left: 9px; right: 9px; display: flex; justify-content: space-between; gap: 8px; padding: 9px 8px; background: #101819dd; color: #d4dcdb; font: 8px/1.2 "Consolas", monospace; letter-spacing: 1px; }
.panel-copy { min-height: 0; min-width: 0; overflow: auto; padding: 4px 8px 8px 0; scrollbar-color: #718780 #161d1e; scrollbar-width: thin; overscroll-behavior: contain; font-size: 16px; line-height: 1.55; }
.intro-copy { display: flex; flex-direction: column; align-items: flex-start; }
.greeting { display: inline-flex; align-items: center; min-height: 33px; background: var(--paper); color: var(--ink); padding: 5px 12px; font-size: 14px; margin-bottom: 20px; position: relative; }
.greeting::after { content: ""; position: absolute; left: 14px; bottom: -8px; border-top: 8px solid var(--paper); border-right: 8px solid transparent; }
.cursor { width: 7px; height: 2px; margin: 10px 0 0 5px; background: currentColor; }
h1 { font-size: 36px; font-weight: 500; line-height: 1.07; letter-spacing: -1.1px; }
.patronymic { display: block; font-size: .78em; margin-top: 5px; }
.profession { margin-top: 14px; color: var(--muted); font-size: 15px; }
.accent-slash { color: var(--orange); padding: 0 5px; }
.contact-list { width: 100%; margin: 22px 0 21px; font-size: 13px; }
.contact-list > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid #ffffff12; }
.contact-list dt { text-transform: uppercase; font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.contact-list dd { overflow-wrap: anywhere; }
#time { font-variant-numeric: tabular-nums; }
.mail-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 34px; padding: 9px 16px; border: 1px solid var(--cyan); color: var(--cyan); text-decoration: none; font-size: 14px; background: #8ed9e909; margin-top: auto; }
.mail-button:hover { background: var(--cyan); color: var(--ink); }
.mail-button span { font-size: 19px; }
.eyebrow { text-transform: uppercase; font: 10px/1.5 "Consolas", monospace; letter-spacing: 1.6px; color: var(--muted); margin-bottom: 8px; }
h2 { font-weight: 500; font-size: 40px; line-height: 1.1; letter-spacing: -1px; margin-bottom: 17px; }
.heading-dot { color: var(--orange); }
.section-intro { color: var(--muted); font-size: 14px; margin-bottom: 19px; }
.project { border-top: 1px solid var(--line); }
.project:last-child { border-bottom: 1px solid var(--line); }
.project summary { display: flex; align-items: center; gap: 15px; cursor: pointer; min-height: 51px; list-style: none; font-size: 18px; }
.project summary::-webkit-details-marker { display: none; }
.project-number { color: var(--muted); font: 11px "Consolas", monospace; }
.project-toggle { margin-left: auto; position: relative; width: 18px; height: 18px; color: var(--cyan); }
.project-toggle::before, .project-toggle::after { content: ""; position: absolute; width: 12px; height: 1px; background: currentColor; left: 3px; top: 8px; }
.project-toggle::after { transform: rotate(90deg); }
.project[open] .project-toggle::after { transform: rotate(0deg); }
.project[open] summary { color: var(--cyan); }
.project p { color: var(--muted); font-size: 14px; padding: 0 10px 15px 30px; }
.skill-block { padding: 13px 0; border-top: 1px solid #ffffff22; }
h3 { color: var(--cyan); font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.skill-block p { color: var(--muted); font-size: 14px; }
.prose > p:not(.eyebrow) { font-size: 15px; margin-bottom: 15px; color: #c6cecb; }
.card-footer { display: flex; justify-content: space-between; min-height: 0; border-top: 1px solid var(--line); background: #080c0c50; }
.signature { display: flex; align-items: center; gap: 16px; padding-left: 33px; }
.signature-mark { font: 28px/1 "Bahnschrift", "Trebuchet MS", sans-serif; letter-spacing: -2px; }
.signature-mark > span { color: var(--orange); margin-left: 3px; }
.signature-text { color: #d4dcda; font: 10px/1.5 "Consolas", monospace; letter-spacing: 1px; }
.signature-text small { display: block; font-family: "Trebuchet MS", sans-serif; font-size: 10px; letter-spacing: 0; color: var(--muted); margin-top: 4px; }
.card-nav { display: flex; height: 100%; }
.nav-link { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; width: 87px; border-left: 1px solid #ffffff22; text-decoration: none; color: var(--muted); font-size: 10px; position: relative; }
.nav-link svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.nav-link:hover { background: #ffffff08; color: var(--paper); }
.nav-link[aria-current] { background: var(--paper); color: var(--ink); }
.nav-link[aria-current]::before { content: ""; position: absolute; top: -7px; left: calc(50% - 7px); width: 14px; height: 14px; background: var(--paper); transform: rotate(45deg); }
.nav-link:focus-visible { outline-offset: -5px; }
.orientation-toggle { display: none; position: fixed; z-index: 5; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); min-width: 64px; min-height: 44px; align-items: center; justify-content: center; gap: 6px; padding: 8px; border: 1px solid #cedfdf66; color: var(--paper); background: #162125cc; box-shadow: 0 2px 8px #00000022; font-size: 12px; }
.orientation-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.orientation-toggle[aria-pressed="true"] { color: var(--cyan); border-color: var(--cyan); }
@container (max-width: 800px) {
  .card-header { padding: 0 19px; font-size: 8px; letter-spacing: .8px; }
  .panel { grid-template-columns: 29% minmax(0, 1fr); gap: 23px; padding: 17px 21px; }
  .panel-copy { padding-top: 0; }
  .greeting { min-height: 24px; font-size: 12px; padding: 3px 8px; margin-bottom: 13px; }
  h1 { font-size: 28px; }
  .profession { font-size: 12px; margin-top: 9px; }
  .contact-list { font-size: 12px; margin: 12px 0; }
  .contact-list > div { grid-template-columns: 86px minmax(0,1fr); padding: 5px 0; gap: 8px; }
  .contact-list dt { font-size: 8px; }
  .mail-button { font-size: 12px; padding: 6px 11px; gap: 22px; }
  .visual { padding: 6px; }
  .visual figcaption { bottom: 6px; left: 6px; right: 6px; font-size: 7px; }
  .visual figcaption span:last-child { display: none; }
  h2 { font-size: 28px; margin-bottom: 10px; }
  .eyebrow { font-size: 8px; margin-bottom: 5px; }
  .section-intro { font-size: 12px; margin-bottom: 11px; }
  .project summary { min-height: 44px; font-size: 15px; gap: 10px; }
  .project p { font-size: 12px; padding-left: 23px; }
  .skill-block { padding: 9px 0; }
  .skill-block p, .prose > p:not(.eyebrow) { font-size: 13px; }
  .signature { padding-left: 21px; gap: 10px; }
  .signature-text { font-size: 8px; }
  .signature-text small { display: none; }
  .signature-mark { font-size: 22px; }
  .nav-link { width: 65px; font-size: 9px; gap: 4px; }
  .nav-link svg { width: 20px; height: 20px; }
}
@container (max-width: 580px) {
  .panel { gap: 16px; padding: 12px 17px; grid-template-columns: 27% minmax(0, 1fr); }
  h1 { font-size: 23px; }
  .greeting { margin-bottom: 11px; }
  .profession { font-size: 11px; }
  .contact-list { font-size: 11px; margin: 9px 0; }
  .contact-list > div { grid-template-columns: 76px minmax(0,1fr); }
  .signature-text { display: none; }
  .nav-link { width: 61px; }
  .section-code { letter-spacing: 0; }
}
@media (max-width: 1100px), (max-height: 720px) { .card { grid-template-rows: 28px minmax(0,1fr) 66px; } }
@media (max-width: 1024px), (pointer: coarse) { .orientation-toggle { display: flex; } }
@media (max-width: 600px) and (orientation: portrait), (pointer: coarse) and (max-width: 1024px) and (orientation: portrait) {
  :root { --quarter-turn: 90deg; }
  .card { width: min(1025px, calc(100dvh - 112px), calc((100vw - 64px) * 1.694214876)); grid-template-rows: 25px minmax(0,1fr) 60px; }
}
@media (prefers-reduced-motion: no-preference) {
  .panel { animation: panel-enter .28s ease-out; }
  .cursor { animation: blink 1.2s steps(1) infinite; }
  @keyframes panel-enter { from { opacity: .35; } to { opacity: 1; } }
  @keyframes blink { 50% { opacity: 0; } }
}
