/* ============================================================
   Vladyslav Taran — Portfolio  ·  v2 "Engineering Console"
   Light warm-paper datasheet · fixed identity rail · monospace
   ============================================================ */

:root {
  --paper:    #ece8df;   /* warm off-white */
  --paper-2:  #e4dfd3;   /* slightly darker panel */
  --ink:      #17150f;   /* near-black */
  --ink-2:    #45413a;   /* body */
  --mute:     #8b867b;   /* muted labels */
  --rule:     #cfc9bb;   /* hairlines */
  --rule-2:   #d8d2c5;
  --sig:      #c1440e;   /* oxide / international orange — signal accent */
  --sig-deep: #9c350a;

  --rail-w:   340px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ---- Dark "black background" theme ---- */
html[data-theme="dark"] {
  --paper:    #0c0c0b;
  --paper-2:  #151412;
  --ink:      #f1eee6;
  --ink-2:    #c4c0b5;
  --mute:     #797569;
  --rule:     #2a2823;
  --rule-2:   #211f1b;
  --sig:      #e2591d;
  --sig-deep: #c5481a;
}
html[data-theme="dark"] body::before { opacity: .42; }
html[data-theme="dark"] .portrait img { filter: saturate(1.02) contrast(1.0) brightness(.97); }
html[data-theme="dark"] ::selection { color: #0c0c0b; }

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink-2);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* smooth theme cross-fade */
body, .rail, .topbar, .block, .menu-btn, .theme-btn,
.bh-num, .portrait img, .led-what h3, .name { transition: background-color .3s ease, color .3s ease, border-color .3s ease; }

/* subtle engineering grid wash */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 100% 100%, 88px 100%;
  opacity: .18;
}

::selection { background: var(--sig); color: #fff7f0; }

a { color: inherit; text-decoration: none; }
b { color: var(--ink); font-weight: 600; }

/* ============ Layout ============ */
.layout { position: relative; z-index: 1; display: grid; grid-template-columns: var(--rail-w) 1fr; }

/* ---- Left identity rail (fixed) ---- */
.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh; width: var(--rail-w);
  border-right: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
}
.rail-scroll { height: 100%; overflow-y: auto; padding: 46px 36px 30px; }
.rail-scroll::-webkit-scrollbar { width: 8px; }
.rail-scroll::-webkit-scrollbar-thumb { background: var(--rule); }

.kicker {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink); margin-bottom: 22px;
}
.kicker .sig { color: var(--sig); font-weight: 600; }

.name {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(2.1rem, 3vw, 2.7rem); line-height: .98;
  letter-spacing: -.02em; color: var(--ink); margin-bottom: 26px;
}

.portrait { width: 100%; margin-bottom: 26px; }
.portrait img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block;
  filter: saturate(1.03) contrast(1.01);
  border: 1px solid var(--rule);
  background: var(--paper-2);
}
.portrait figcaption {
  font-family: var(--mono); font-size: .68rem; color: var(--mute);
  margin-top: 8px; letter-spacing: .02em;
  display: flex; justify-content: space-between;
}
.portrait figcaption::before { content: "FIG.01"; color: var(--sig); }

.spec { font-family: var(--mono); font-size: .76rem; margin-bottom: 30px; border-top: 1px solid var(--rule); }
.spec > div {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--rule);
}
.spec dt { color: var(--mute); text-transform: uppercase; letter-spacing: .05em; }
.spec dd { color: var(--ink); }

.index { display: flex; flex-direction: column; margin-bottom: 28px; }
.index a {
  font-family: var(--mono); font-size: .9rem; color: var(--ink-2);
  padding: 8px 0; border-bottom: 1px solid var(--rule);
  display: flex; gap: 12px; align-items: baseline; transition: color .15s, padding .15s;
}
.index a b { color: var(--mute); font-weight: 500; font-size: .76rem; transition: color .15s; }
.index a:hover, .index a.active { color: var(--sig); padding-left: 8px; }
.index a:hover b, .index a.active b { color: var(--sig); }
.index a.active { font-weight: 600; }

.rail-contact { display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.rail-contact a {
  font-family: var(--mono); font-size: .78rem; color: var(--ink-2);
  border-bottom: 1px dotted transparent; width: fit-content; transition: color .15s, border-color .15s;
}
.rail-contact a:hover { color: var(--sig); border-color: var(--sig); }

.rail-foot { font-family: var(--mono); font-size: .64rem; color: var(--mute); line-height: 1.5; }

.rail-top { display: flex; justify-content: flex-end; margin-bottom: 18px; }

/* ---- Theme toggle button ---- */
.theme-btn {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .07em;
  text-transform: uppercase; cursor: pointer; background: transparent;
  color: var(--ink-2); border: 1px solid var(--rule); padding: 6px 12px;
  display: inline-flex; align-items: center; gap: 8px;
}
.theme-btn:hover { color: var(--sig); border-color: var(--sig); }
.theme-btn .tdot {
  width: 11px; height: 11px; border-radius: 50%;
  background: linear-gradient(90deg, var(--ink) 0 50%, transparent 50%);
  border: 1.5px solid var(--ink); box-sizing: border-box;
}
.theme-btn:hover .tdot { background: linear-gradient(90deg, var(--sig) 0 50%, transparent 50%); border-color: var(--sig); }

/* ---- Mobile top bar (hidden on desktop) ---- */
.topbar { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ============ Main content ============ */
.content { min-width: 0; padding: 0 0 60px; }

.block { padding: 64px clamp(28px, 5vw, 76px); border-bottom: 1px solid var(--rule); max-width: 1000px; }
.block:first-child { padding-top: 72px; }

.block-head {
  display: flex; align-items: baseline; gap: 16px; margin-bottom: 38px;
  padding-bottom: 16px; border-bottom: 2px solid var(--ink);
}
.bh-num {
  font-family: var(--mono); font-size: .82rem; font-weight: 600;
  color: var(--paper); background: var(--sig); padding: 3px 8px; line-height: 1.4;
}
.block-head h2 {
  font-family: var(--sans); font-weight: 700; letter-spacing: -.02em;
  font-size: clamp(1.5rem, 3vw, 2rem); color: var(--ink); flex: 1;
}
.bh-meta { font-family: var(--mono); font-size: .74rem; color: var(--mute); }

/* ---- 01 Profile ---- */
.lead-line {
  font-family: var(--sans); font-weight: 500;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem); line-height: 1.42;
  color: var(--ink); margin-bottom: 32px; max-width: 24ch;
  border-left: 3px solid var(--sig); padding-left: 20px;
}
.lead-line b { font-weight: 700; }
.prose-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.prose-cols p { font-size: .98rem; color: var(--ink-2); }

/* ---- 02 Experience : ruled ledger ---- */
.ledger { border-top: 1px solid var(--rule); }
.led {
  display: grid; grid-template-columns: 132px 1fr; gap: 28px;
  padding: 26px 0; border-bottom: 1px solid var(--rule);
  transition: background .15s;
}
.led:hover { background: rgba(193,68,14,.035); }
.led-when { font-family: var(--mono); font-size: .82rem; padding-top: 4px; }
.led-when .y { display: block; font-size: 1.5rem; font-weight: 600; color: var(--ink); line-height: 1; }
.led-when .to { display: block; color: var(--sig); margin-top: 4px; letter-spacing: .03em; }
.led-what h3 { font-family: var(--sans); font-weight: 600; font-size: 1.18rem; color: var(--ink); letter-spacing: -.01em; }
.led-what .org { font-family: var(--mono); font-size: .8rem; color: var(--mute); margin: 5px 0 14px; }
.led-what .org i { color: var(--sig); font-style: normal; }
.led-what ul { list-style: none; display: grid; gap: 8px; margin-bottom: 14px; }
.led-what li { position: relative; padding-left: 22px; font-size: .94rem; color: var(--ink-2); }
.led-what li::before {
  content: "—"; position: absolute; left: 0; color: var(--sig); font-family: var(--mono);
}
.led-what .summary { font-size: .94rem; color: var(--ink-2); }
.led-what .tags { font-family: var(--mono); font-size: .76rem; color: var(--mute); letter-spacing: .01em; }

/* ---- 03 Competencies : spec sheet ---- */
.spec-sheet { border-top: 1px solid var(--rule); }
.srow {
  display: grid; grid-template-columns: 220px 1fr; gap: 28px;
  padding: 20px 0; border-bottom: 1px solid var(--rule); align-items: baseline;
}
.skey {
  font-family: var(--mono); font-size: .82rem; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: .03em; position: relative; padding-left: 16px;
}
.skey::before { content: ""; position: absolute; left: 0; top: .45em; width: 7px; height: 7px; background: var(--sig); }
.sval { font-size: .98rem; color: var(--ink-2); }

/* ---- 04 Credentials : manifest ---- */
.manifest { border-top: 1px solid var(--rule); }
.man-group { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.man-issuer {
  font-family: var(--mono); font-size: .78rem; font-weight: 600; color: var(--ink);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
  display: flex; justify-content: space-between;
}
.man-issuer span { color: var(--sig); }
.man-row {
  display: grid; grid-template-columns: 78px 1fr auto; gap: 16px; align-items: baseline;
  font-family: var(--mono); padding: 7px 0; transition: color .15s;
}
.man-row:hover { color: var(--sig); }
.m-date { font-size: .8rem; color: var(--sig); }
.m-name { font-family: var(--sans); font-size: .96rem; color: var(--ink); font-weight: 500; }
.man-row:hover .m-name { color: var(--sig); }
a.m-name { text-decoration: none; border-bottom: 1px solid transparent; width: fit-content; }
a.m-name::after { content: " ↗"; color: var(--sig); font-family: var(--mono); font-size: .74rem; }
a.m-name:hover { color: var(--sig); border-bottom-color: var(--sig); }
.m-id { font-size: .72rem; color: var(--mute); letter-spacing: .02em; }
.man-row a.m-name + .m-id { color: var(--sig); }   /* "verify" tag highlighted for linked rows */

/* ---- 05 Contact ---- */
.contact-intro { font-size: 1.1rem; color: var(--ink); max-width: 48ch; margin-bottom: 28px; }
.channels { border-top: 1px solid var(--rule); margin-bottom: 26px; }
.chan {
  display: grid; grid-template-columns: 120px 1fr 28px; gap: 16px; align-items: center;
  padding: 18px 0; border-bottom: 1px solid var(--rule);
  transition: padding .18s, background .15s;
}
.chan:not(.static):hover { padding-left: 12px; background: rgba(193,68,14,.04); }
.ck { font-family: var(--mono); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.cv { font-family: var(--sans); font-size: 1.1rem; color: var(--ink); font-weight: 500; word-break: break-word; }
.cx { font-family: var(--mono); color: var(--sig); text-align: right; }
.totop { font-family: var(--mono); font-size: .78rem; color: var(--mute); }
.totop:hover { color: var(--sig); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  /* slim sticky bar: brand + persistent theme toggle (no menu — nav is inline) */
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 40;
    align-items: center; justify-content: space-between;
    padding: 12px 22px; background: var(--paper);
    border-bottom: 1px solid var(--ink);
    font-family: var(--mono);
  }
  .topbar-id { font-size: .9rem; font-weight: 600; color: var(--ink); }
  .menu-btn { display: none; }

  /* identity rail flows inline at the top — fully visible, no drawer */
  .rail {
    position: static; width: 100%; height: auto;
    border-right: 0; border-bottom: 1px solid var(--ink); transform: none;
  }
  .rail .rail-scroll { height: auto; overflow: visible; padding: 28px 22px 36px; }
  .rail-top { display: none; }          /* avoid duplicate theme toggle */
  .portrait { max-width: 280px; }
  .name { font-size: 2.4rem; }
  .block { padding: 48px 22px; }
  .prose-cols { grid-template-columns: 1fr; gap: 16px; }
  .led { grid-template-columns: 1fr; gap: 10px; }
  .led-when { display: flex; gap: 10px; align-items: baseline; padding-top: 0; }
  .led-when .y { font-size: 1.1rem; }
  .led-when .to::before { content: "→ "; }
  .srow { grid-template-columns: 1fr; gap: 8px; }
  .man-row { grid-template-columns: 70px 1fr; }
  .m-id { grid-column: 2; }
  .chan { grid-template-columns: 1fr auto; }
  .ck { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
