/* Nick Sevostiyanov portfolio.
   Source Serif 4 headings over Source Sans 3 text; a CV-style grid with dates and
   section names in a left column, and a formal document index for the resume. */

:root {
  --paper: #ffffff;
  --tint: #f6f5f1;
  --sage: #e3e8e4;
  --ink: #1a1e1c;
  --ink-2: #3b433f;
  --muted: #5f6763;
  --forest: #234536;
  --forest-dark: #183127;
  --leaf: #2f8f5b;
  --night: #14231c;
  --on-night: rgba(240, 242, 238, 0.72);
  --mint: #a9cbb8;
  --line: rgba(26, 30, 28, 0.12);
  --line-strong: rgba(26, 30, 28, 0.24);
  --radius: 6px;
  --rail: 260px;
  --bar: 0px;
  --gut: clamp(20px, 5vw, 72px);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.24, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--bar);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4,
p,
figure,
ul,
ol,
dl {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  background: rgba(35, 69, 54, 0.16);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--forest);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1000;
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.22s ease;
}

.skip-link:focus {
  transform: none;
}

/* Shared pieces */
.shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(72px, 9vw, 120px) var(--gut);
}

.section-header {
  margin-bottom: clamp(36px, 4.5vw, 56px);
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-strong);
}

.title {
  margin-bottom: 0;
  font-size: clamp(2.3rem, 4.2vw, 3.5rem);
  line-height: 1.1;
}

.intro {
  max-width: 640px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font: 600 0.98rem/1 var(--sans);
  white-space: nowrap;
  transition:
    background-color 0.3s var(--ease),
    border-color 0.3s var(--ease),
    color 0.3s var(--ease);
}

.button:hover {
  border-color: var(--ink);
}

.button-primary {
  border-color: var(--forest-dark);
  background: var(--forest-dark);
  color: #fff;
}

.button-primary:hover {
  border-color: var(--forest);
  background: var(--forest);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.92rem;
  font-weight: 600;
}

.status::before {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 143, 91, 0.2);
  content: "";
}

/* Sidebar (desktop) / top bar (mobile) */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--rail);
  flex-direction: column;
  overflow-y: auto;
  padding: 44px 30px 28px;
  border-right: 1px solid var(--line);
  background: var(--tint);
}

.sidebar-identity {
  display: grid;
  gap: 4px;
  margin-bottom: 40px;
}

.sidebar-identity strong {
  font: 600 1.45rem/1.15 var(--serif);
  letter-spacing: -0.01em;
}

.sidebar-identity small {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  position: relative;
  display: flex;
  min-height: 38px;
  align-items: center;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.25s ease;
}

.nav-link::before {
  position: absolute;
  top: 50%;
  left: -30px;
  width: 3px;
  height: 0;
  background: var(--forest);
  content: "";
  transform: translateY(-50%);
  transition: height 0.3s var(--ease);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active {
  font-weight: 600;
}

.nav-link:hover::before,
.nav-link.is-active::before {
  height: 22px;
}

.sidebar-foot {
  display: grid;
  gap: 14px;
  margin-top: auto;
  padding-top: 32px;
}

.sidebar-foot .status {
  font-size: 0.86rem;
}

.sidebar-foot small {
  color: var(--muted);
  font-size: 0.8rem;
}

.site-main {
  margin-left: var(--rail);
}

.site-main:focus {
  outline: 0;
}

.site-section {
  position: relative;
  isolation: isolate;
}

/* Home */
.home-hero {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  overflow: hidden;
  background: #d9e1e3;
  isolation: isolate;
}

.home-photo,
.home-scrim {
  position: absolute;
  inset: 0;
}

.home-photo {
  z-index: -2;
}

.home-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right bottom; /* Nick stands bottom-right of the photo */
}

.home-scrim {
  z-index: -1;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.93) 38%, rgba(255, 255, 255, 0.62) 56%, rgba(20, 30, 25, 0.06) 80%);
}

.home-content {
  width: min(70%, 860px);
  padding: 80px var(--gut) 80px clamp(40px, 7vw, 112px);
}

.status-chip {
  margin-bottom: 28px;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--forest-dark);
}

.home-content h1 {
  margin-bottom: 24px;
  font-size: clamp(3.4rem, 7vw, 6.6rem);
  letter-spacing: -0.02em;
  line-height: 1;
}

.home-content h1 span {
  display: block;
}

.home-role {
  margin-bottom: 14px;
  color: var(--forest-dark);
  font-size: clamp(1.08rem, 1.5vw, 1.3rem);
  font-weight: 600;
}

.home-summary {
  max-width: 580px;
  margin-bottom: 34px;
  color: var(--ink-2);
  font-size: clamp(1.05rem, 1.35vw, 1.18rem);
}

/* About: a faculty-style bio, then CV sections on one grid */
.page-about {
  background: var(--paper);
}

.cv-row {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  padding: clamp(40px, 5vw, 60px) 0;
  border-top: 1px solid var(--line);
}

.cv-row.bio {
  grid-template-rows: auto 1fr;
  row-gap: 28px;
  padding-top: 0;
  border-top: 0;
}

.bio-photo {
  grid-row: 1 / span 2;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  margin: 0;
  border-radius: var(--radius);
  background: var(--tint);
}

.bio-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

.bio-lead p {
  max-width: 720px;
  margin: 0;
  font: 500 clamp(1.3rem, 2vw, 1.65rem) / 1.45 var(--serif);
  letter-spacing: -0.005em;
}

/* The two things a recruiter scans for first: what he wants, and what he knows. */
.seeking {
  align-self: start;
  max-width: 720px;
  padding: 24px 28px;
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--forest);
  border-radius: var(--radius);
  background: var(--tint);
}

.seeking h3 {
  margin-bottom: 10px;
  font-size: 1.3rem;
}

.seeking dl {
  margin: 0;
}

.seeking dl > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

.seeking dt {
  color: var(--muted);
  font-weight: 600;
}

.seeking dd {
  margin: 0;
  font-weight: 600;
}

.seeking dd.status {
  display: flex;
  color: var(--ink);
  font-size: inherit;
}

.done {
  display: grid;
  gap: 14px;
  max-width: 760px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.done li {
  position: relative;
  padding-left: 22px;
  color: var(--ink-2);
  font-size: 1.08rem;
}

.done li::before {
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 8px;
  height: 2px;
  background: var(--forest);
  content: "";
}

.done strong {
  color: var(--ink);
  font-weight: 700;
}

.skills {
  margin: 0;
  border-top: 1px solid var(--line-strong);
}

.skills > div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 8px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.skills dt {
  padding-top: 3px;
  font-weight: 700;
}

.skills dd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.skills dd span,
.coursework li {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--tint);
  color: var(--ink-2);
  font-size: 0.92rem;
}

.cv-title {
  position: sticky;
  top: 32px;
  align-self: start;
  margin: 0;
  font-size: 1.6rem;
}

.cv-title h3 {
  margin: 0;
  font-size: 1.6rem;
}

.cv-title p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.cv-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cv-entry {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 4px 28px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.cv-entry:first-child {
  padding-top: 4px;
  border-top: 0;
}

.cv-entry:last-child {
  padding-bottom: 0;
}

.cv-date {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.cv-entry h4 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.cv-entry h4 span {
  display: block;
  margin-top: 3px;
  color: var(--forest);
  font: 600 1rem/1.4 var(--sans);
  letter-spacing: 0;
}

.coursework {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

/* Experience rows with a matching project link down to it; outside sites open in a new tab. */
.cv-entry h4 a {
  display: block;
  transition: color 0.25s ease;
}

.cv-entry h4 a span::after {
  content: " →";
}

.cv-entry h4 a:hover {
  color: var(--forest);
}

.cv-entry h4 a:hover span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.done a,
.project-links a,
.project-links button {
  color: var(--forest);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.25s ease;
}

.done a:hover,
.project-links a:hover,
.project-links button:hover {
  color: var(--ink);
}

/* Work: plain facts per project, no click-to-expand. */
.page-work {
  background: var(--tint);
}

.project-list {
  border-bottom: 1px solid var(--line-strong);
}

.project-card {
  display: grid;
  scroll-margin-top: 28px;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 52px);
  padding: 40px 0;
  border-top: 1px solid var(--line-strong);
}

.project-card:first-child {
  padding-top: 0;
  border-top: 0;
}

.project-visual {
  position: relative;
  display: flex;
  aspect-ratio: 1;
  align-items: center;
  align-self: start;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.peltify-visual {
  background:
    radial-gradient(circle at 50% 45%, rgba(147, 51, 234, 0.2), transparent 60%),
    linear-gradient(145deg, #f6f1fb, #ece4f5);
}

.peltify-icon {
  width: 68px;
  height: 68px;
  border-radius: 16px;
  box-shadow: 0 16px 30px -12px rgba(106, 27, 154, 0.55);
}

.agent-visual {
  background: linear-gradient(145deg, #171918, #090a09);
}

.agent-logo-frame {
  width: 56%;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.bridge-visual {
  background: #e7edf5;
}

.bridge-logo {
  width: 84%;
}

.brand-visual {
  background: #1a1a1a;
}

.brand-visual picture,
.brand-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.metric-visual {
  flex-direction: column;
  background: #faf8f3;
}

.metric-visual strong {
  color: var(--forest);
  font: 600 3.4rem/1 var(--serif);
}

.metric-visual span {
  color: var(--muted);
  font-weight: 600;
}

.server-visual {
  background: linear-gradient(145deg, #1d2a24, #0f1713);
  color: #cfe0d6;
}

.server-visual svg {
  width: 56%;
}

.server-visual .led {
  fill: #6fd39b;
  stroke: none;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 6px;
  color: var(--forest);
  font-size: 0.95rem;
  font-weight: 600;
}

.project-status {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 0.8rem;
}

.project-copy h3 {
  margin-bottom: 8px;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  line-height: 1.15;
}

.project-summary {
  max-width: 720px;
  margin-bottom: 14px;
  font-size: 1.08rem;
}

.project-facts {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.project-facts li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-2);
}

.project-facts li::before {
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 8px;
  height: 2px;
  background: var(--forest);
  content: "";
}

.project-facts strong {
  color: var(--ink);
  font-weight: 700;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.project-tags span {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: 0.85rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 18px 0 0;
}

.project-links button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: 600 1rem var(--sans);
}

/* Resume: an index of the documents beside the page itself, set like a formal filing. */
.page-resume {
  background: var(--paper);
}

.resume-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(32px, 5vw, 64px);
}

.doc-index {
  position: sticky;
  top: 32px;
  border-top: 3px double var(--ink);
}

.doc-index-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-strong);
}

.doc-index-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
}

.resume-updated {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.docs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.doc {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.doc-icon {
  width: 34px;
  height: 41px;
  margin-top: 2px;
  color: var(--forest);
}

.doc-copy {
  display: grid;
  gap: 1px;
}

.doc-copy strong {
  font: 600 1.15rem/1.3 var(--serif);
}

.doc-copy span {
  color: var(--ink-2);
}

.doc-copy small {
  color: var(--muted);
  font-size: 0.88rem;
}

.doc .button {
  grid-column: 2;
  justify-self: start;
  min-height: 42px;
}

.doc-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.resume-share {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.resume-share label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.resume-share div {
  display: flex;
  gap: 8px;
}

.resume-share input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 400 0.92rem var(--sans);
}

.resume-share .button {
  min-height: 42px;
  padding: 0 14px;
}

.resume-paper {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
}

.resume-stack {
  position: relative;
  width: min(100%, 816px);
  margin: 0 auto;
}

/* Page two, squared up behind page one. */
.resume-stack::before {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  background: #fff;
  content: "";
  transform: translate(6px, 6px);
}

.resume-sheet {
  position: relative;
  aspect-ratio: 816 / 1056;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 18px 40px -24px rgba(26, 30, 28, 0.35);
}

/* script.js sets --s so the letter-size page always fits the column. */
.resume-sheet iframe {
  display: block;
  width: 816px;
  height: 1056px;
  border: 0;
  transform: scale(var(--s, 1));
  transform-origin: 0 0;
}

.resume-paper figcaption {
  margin-top: 20px;
  text-align: center;
}

.resume-open {
  color: var(--forest-dark);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Links */
.page-links {
  background: var(--paper);
}

.link-directory {
  border-top: 1px solid var(--line-strong);
}

.directory-link {
  display: grid;
  grid-template-columns: 44px minmax(140px, 0.7fr) minmax(0, 1.2fr) minmax(120px, 0.6fr) 24px;
  align-items: center;
  gap: 22px;
  padding: 20px 12px;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.3s ease;
}

.directory-link:hover {
  background: var(--tint);
}

.directory-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
}

.directory-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.directory-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.directory-icon-linkedin { background: #0a66c2; color: #fff; }
.directory-icon-github { background: #181918; color: #fff; }
.directory-icon-peltify { background: #5b1a86; }
.directory-icon-image { border-radius: 50%; background: #191a19; }
.directory-icon-bandcamp { background: #1da0c3; color: #fff; }
.directory-icon-bandcamp svg { width: 25px; height: 18px; }

.directory-name {
  font: 600 1.15rem/1.3 var(--serif);
}

.directory-description,
.directory-domain {
  color: var(--muted);
}

.directory-domain {
  text-align: right;
}

.directory-arrow {
  color: var(--forest);
  font-weight: 600;
  text-align: right;
  transition: transform 0.3s var(--ease);
}

.directory-link:hover .directory-arrow {
  transform: translate(2px, -2px);
}

/* Contact */
.page-contact {
  background: var(--night);
  color: #f2f3ef;
}

.contact-shell {
  padding-bottom: 40px;
}

.contact-intro {
  max-width: 600px;
  margin: 14px 0 40px;
  color: var(--on-night);
  font-size: 1.15rem;
}

.contact-email-list {
  max-width: 820px;
  margin-bottom: 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.contact-email {
  display: grid;
  gap: 2px;
  padding: 18px 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.contact-email span {
  color: var(--on-night);
  font-size: 0.92rem;
  font-weight: 600;
}

.contact-email strong {
  font: 600 clamp(1.1rem, 4.6vw, 2.2rem) / 1.25 var(--serif);
  overflow-wrap: break-word;
  transition: color 0.3s ease;
}

.contact-email:hover strong {
  color: var(--mint);
}

.page-contact .button {
  border-color: rgba(255, 255, 255, 0.4);
  background: transparent;
  color: #fff;
}

.page-contact .button:hover {
  border-color: #fff;
}

.page-contact .button-primary {
  border-color: #f2f3ef;
  background: #f2f3ef;
  color: var(--night);
}

.page-contact .button-primary:hover {
  border-color: var(--mint);
  background: var(--mint);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: clamp(72px, 10vw, 120px);
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--on-night);
  font-size: 0.9rem;
}

/* Full-size image viewer */
.image-lightbox {
  width: min(94vw, 1440px);
  max-width: none;
  max-height: 94vh;
  margin: auto;
  overflow: visible;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.image-lightbox::backdrop {
  background: rgba(4, 7, 6, 0.88);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.lightbox-frame {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.lightbox-frame img {
  max-width: 100%;
  max-height: calc(94vh - 56px);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.lightbox-frame p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.92rem;
  font-weight: 600;
}

.lightbox-close {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 2;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(10, 13, 12, 0.68);
  color: #fff;
  cursor: pointer;
  font: 400 2rem/1 Arial, sans-serif;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.image-lightbox[open] { animation: lightbox-in 0.42s var(--ease-out) both; }
.image-lightbox[open]::backdrop { animation: backdrop-in 0.42s ease both; }
.image-lightbox.is-closing { animation: lightbox-out 0.24s ease-in both; }
.image-lightbox.is-closing::backdrop { animation: backdrop-in 0.24s ease reverse both; }
@keyframes lightbox-in { from { opacity: 0; transform: translateY(14px) scale(0.965); } to { opacity: 1; transform: none; } }
@keyframes lightbox-out { to { opacity: 0; transform: scale(0.98); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

/* Motion: content settles in once. Off entirely for reduced motion. */
.motion-ready .reveal {
  opacity: 0;
  transform: translateY(12px);
}

.motion-ready .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
}

.motion-ready .reveal-2.is-visible { transition-delay: 70ms; }
.motion-ready .reveal-3.is-visible { transition-delay: 140ms; }
.motion-ready .reveal-4.is-visible { transition-delay: 210ms; }

.motion-ready .photo-settle {
  opacity: 0;
  transform: scale(1.03);
}

.motion-ready .photo-settle.is-visible {
  opacity: 1;
  transform: none;
  transition:
    opacity 1.1s var(--ease),
    transform 2s var(--ease);
}

/* Narrow desktop */
@media (max-width: 1100px) {
  :root {
    --rail: 224px;
  }

  .sidebar {
    padding-right: 24px;
    padding-left: 24px;
  }

  .nav-link::before {
    left: -24px;
  }

  .cv-row {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .cv-entry,
  .skills > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .cv-date {
    margin: 0;
  }

  .project-card {
    grid-template-columns: 128px minmax(0, 1fr);
  }

  .resume-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .doc-index {
    position: static;
  }

  .docs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 32px;
  }

  .directory-link {
    grid-template-columns: 44px minmax(130px, 0.7fr) minmax(0, 1.2fr) 24px;
  }

  .directory-domain {
    display: none;
  }

}

/* Tablet and phone: the rail becomes a slim top bar with the name and the resume. */
@media (max-width: 860px) {
  :root {
    --rail: 0px;
    --bar: 60px;
  }

  .sidebar {
    inset: 0 0 auto;
    width: auto;
    height: calc(var(--bar) + env(safe-area-inset-top));
    flex-direction: row;
    align-items: center;
    gap: 12px;
    overflow: visible;
    padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 245, 241, 0.9);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
  }

  .sidebar-identity {
    min-width: 0;
    gap: 0;
    margin: 0;
  }

  .sidebar-identity strong {
    overflow: hidden;
    font-size: 1.2rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-identity small {
    font-size: 0.82rem;
  }

  .sidebar-nav,
  .sidebar-foot .status,
  .sidebar-foot small {
    display: none;
  }

  .sidebar-foot {
    margin: 0 0 0 auto;
    padding: 0;
  }

  .sidebar-foot .button {
    min-height: 38px;
    padding: 0 16px;
  }

  .home-scrim {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.88) 60%, rgba(20, 30, 25, 0.1) 100%);
  }

  .home-content {
    width: 100%;
    padding: calc(var(--bar) + 44px) var(--gut) 64px;
  }

  .cv-row {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .cv-row.bio {
    grid-template-columns: 110px minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 20px;
  }

  .bio-photo {
    grid-row: auto;
    aspect-ratio: 1;
  }

  .bio-lead {
    align-self: center;
  }

  .bio-lead p {
    font-size: 1.15rem;
  }

  .seeking {
    grid-column: 1 / -1;
  }

  .cv-title {
    position: static;
  }

  .cv-row > span:empty {
    display: none;
  }

  /* Project rows: a small tile beside the name instead of a big square. */
  .project-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 0 16px;
    padding: 30px 0;
  }

  .project-visual {
    grid-row: 1 / span 2;
    align-self: center;
  }

  .project-copy {
    display: contents;
  }

  .project-meta {
    grid-column: 2;
    align-self: end;
    margin-bottom: 2px;
    font-size: 0.88rem;
  }

  .project-copy h3 {
    grid-column: 2;
    align-self: start;
    margin: 0;
    font-size: 1.6rem;
  }

  .project-summary,
  .project-facts,
  .project-tags,
  .project-links {
    grid-column: 1 / -1;
  }

  .project-summary {
    margin-top: 14px;
  }

  .metric-visual span {
    display: none;
  }

  .metric-visual strong {
    font-size: 1.4rem;
  }

  .peltify-icon {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    box-shadow: 0 8px 16px -6px rgba(106, 27, 154, 0.5);
  }

  .agent-logo-frame {
    width: 70%;
    border-radius: 11px;
  }

  .brand-visual picture,
  .brand-visual img {
    object-fit: cover;
  }

  .docs {
    grid-template-columns: 1fr;
  }

  .directory-link {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 0 16px;
    padding: 16px 4px;
  }

  .directory-icon {
    grid-row: 1 / 3;
  }

  .directory-name,
  .directory-description {
    grid-column: 2;
  }

  .directory-arrow {
    grid-column: 3;
    grid-row: 1 / 3;
  }
}

/* Portrait screens: text up top, Nick visible below. */
@media (max-aspect-ratio: 1/1) {
  .home-hero {
    align-items: flex-start;
  }

  .home-scrim {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 48%, rgba(255, 255, 255, 0) 72%);
  }
}

@media (max-width: 560px) {
  .home-content h1 {
    font-size: clamp(2.8rem, 13.5vw, 4.4rem);
  }

  .cv-row.bio {
    grid-template-columns: 1fr;
  }

  .bio-photo {
    width: 140px;
  }

  .seeking {
    padding: 20px;
  }

  .seeking dl > div {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .directory-description {
    font-size: 0.92rem;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
  }
}

@media (max-width: 400px) {
  .sidebar-identity small {
    display: none;
  }
}

/* Touch screens: the scaled page is a preview, not a scroll trap. Tap opens it full size. */
@media (pointer: coarse) {
  .resume-sheet iframe {
    pointer-events: none;
  }

  .resume-open::after {
    position: absolute;
    inset: 0;
    content: "";
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .motion-ready .reveal,
  .motion-ready .photo-settle {
    opacity: 1;
    transform: none;
  }
}
