/* ==========================================================================
   Andrei Cojocaru — personal site
   Monochrome, hairline rules, drafting grid. Saira for display, Inter for text.
   Palette: E2E2E2 · 929290 · 4B4A45 · 424240 · 282828 over a #0F0F0F ground.
   ========================================================================== */

:root {
  --bg: #0f0f0f;            /* also the graded backdrop of the portrait */
  --bg-raise: #151515;
  --ink: #e2e2e2;
  --ink-soft: #b9b9b6;
  --muted: #929290;
  --dim: #6c6b66;
  --stone: #4b4a45;
  --line: rgba(226, 226, 226, .10);
  --line-strong: rgba(226, 226, 226, .24);
  --grid: rgba(226, 226, 226, .045);

  --display: "Saira", "Helvetica Neue", Arial, sans-serif;
  --text: "Inter", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 72px);
  --maxw: 1560px;
  --header-h: 76px;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --pad: clamp(16px, 2vw, 32px);   /* text inset from a grid line */
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 300 1rem/1.7 var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* when zoomed far out the page is shorter than the window: centre it */
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
}

.page {
  position: relative;
  overflow-x: clip;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, dl, dd { margin: 0; }
button { font: inherit; color: inherit; }

::selection { background: var(--ink); color: var(--bg); }

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--maxw));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  font: 500 .75rem/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.skip:focus { top: 16px; }

/* Small tracked capitals used for every label on the page */
.eyebrow,
.nav a,
.hero__meta dt,
.hero__coords,
.scroll-cue span,
.tab__num,
.sheet__idx,
.sheet__status,
.specs dt,
.site-footer__row {
  font-family: var(--display);
  font-weight: 400;
  font-size: .6875rem;
  line-height: 1.4;
  letter-spacing: .24em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------------------
   Drafting grid
   -------------------------------------------------------------------------- */
.grid-lines {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: min(100% - 2 * var(--gutter), var(--maxw));
  margin-inline: auto;
  pointer-events: none;
}
.grid-lines i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--grid);
}
/* Only the rail line: the copy spans the columns to its right, and lines never cross text */
.grid-lines i { left: calc(100% / 6); }

main,
.site-footer { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  margin-bottom: calc(-1 * var(--header-h));   /* float over the hero */
  border-bottom: 1px solid transparent;
  transition: background-color .5s var(--ease), border-color .5s var(--ease);
}
.site-header.is-scrolled {
  background: rgba(15, 15, 15, .82);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.mark {
  display: flex;
  gap: 0 .65em;
  font: 400 .75rem/1.3 var(--display);
  letter-spacing: .3em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color .4s var(--ease);
}
.mark:hover { color: var(--muted); }

.nav { display: flex; gap: clamp(20px, 3.4vw, 48px); }
.nav a {
  position: relative;
  padding-block: 6px;
  color: var(--ink-soft);
  transition: color .4s var(--ease);
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: .24em;
  bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .5s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { transform: scaleX(1); transform-origin: left; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  /* not a full-screen wall: the tab row peeks in below */
  --hero-h: clamp(560px, 82svh, 860px);
  min-height: var(--hero-h);
  padding: calc(var(--header-h) + 5vh) 0 clamp(40px, 8vh, 96px);
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);   /* the drafting grid starts at the tab row, not behind the hero */
}

.hero__photo {
  --frame: min(100%, var(--maxw) + 2 * var(--gutter));
  position: absolute;
  top: 0;
  right: calc((100% - var(--frame)) / 2);
  bottom: 0;
  z-index: -1;
  width: min(var(--hero-h) * .924, var(--frame) * .64);
  background: var(--bg);
}
.hero__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 24%;
}
/* The portrait's backdrop is graded to --bg, so these fades are seamless */
.hero__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, var(--bg) 0%, rgba(15, 15, 15, .72) 16%, rgba(15, 15, 15, 0) 46%),
    linear-gradient(to top, var(--bg) 0%, rgba(15, 15, 15, 0) 30%),
    linear-gradient(to bottom, rgba(15, 15, 15, .55) 0%, rgba(15, 15, 15, 0) 16%);
}

.hero__inner { position: relative; }

.name {
  margin-right: -.44em;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.05rem, min(6.1vw, var(--hero-h) * .11), 6.5rem);   /* scales with the photo */
  line-height: 1.04;
  letter-spacing: .44em;       /* from the wordmark spec: 442 / 1000 em */
  text-transform: uppercase;
}
.name .line {
  display: block;
  overflow: hidden;
  padding-bottom: .04em;
}
.name .line > span { display: inline-block; }

.hero__rule {
  position: relative;
  width: min(440px, 56%);
  height: 1px;
  margin: clamp(26px, 4.4vh, 44px) 0 clamp(20px, 3.4vh, 32px);
  background: var(--line-strong);
  transform-origin: left;
}
/* a single pad at the end of the rule */
.hero__rule::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -3px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--ink);
  background: var(--bg);
}

.hero__roles {
  display: grid;
  gap: 6px;
  font: 400 clamp(.8rem, 1.05vw, .95rem)/1.5 var(--display);
  letter-spacing: .3em;
  text-transform: uppercase;
}
.hero__roles span + span { color: var(--muted); }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 0;
  margin-top: clamp(28px, 5vh, 52px);
}
.hero__meta > div {
  min-width: 200px;
  padding: 2px 36px 2px 18px;
  border-left: 1px solid var(--line-strong);
}
.hero__meta dt { color: var(--dim); margin-bottom: 6px; }
.hero__meta dd { font-size: .95rem; letter-spacing: .01em; }
.hero__meta a {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .6s var(--ease);
}
.hero__meta a:hover { background-size: 100% 1px; }

.hero__coords {
  position: absolute;
  right: calc(max(var(--gutter), (100% - var(--maxw)) / 2) - var(--gutter) * .5 - .7em);
  top: 50%;
  color: var(--muted);
  writing-mode: vertical-rl;
  transform: translateY(-50%);
  white-space: nowrap;
}

.scroll-cue {
  position: absolute;
  right: max(var(--gutter), (100% - var(--maxw)) / 2);
  bottom: clamp(40px, 8vh, 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--ink-soft);
}
.scroll-cue span { writing-mode: vertical-rl; letter-spacing: .3em; }
.scroll-cue i {
  position: relative;
  width: 1px;
  height: 64px;
  overflow: hidden;
  background: var(--line-strong);
}
.scroll-cue i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  transform: translateY(-100%);
  animation: cue 2.6s var(--ease) infinite;
}
@keyframes cue {
  0%   { transform: translateY(-100%); }
  55%  { transform: translateY(0); }
  100% { transform: translateY(100%); }
}

/* Entrance */
@media (prefers-reduced-motion: no-preference) {
  .hero__photo img { animation: photo-in 2.2s var(--ease) both; }
  .name .line > span { animation: rise 1.3s var(--ease) both; }
  .name .line:nth-child(1) > span { animation-delay: .25s; }
  .name .line:nth-child(2) > span { animation-delay: .38s; }
  .hero__rule { animation: draw 1.4s var(--ease) .7s both; }
  .hero__roles,
  .hero__meta,
  .hero__coords,
  .scroll-cue { animation: fade 1.4s var(--ease) 1s both; }
  .site-header { animation: fade 1.4s var(--ease) .6s both; }
}
@keyframes photo-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes rise     { from { transform: translateY(108%); } to { transform: none; } }
@keyframes draw     { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade     { from { opacity: 0; } to { opacity: 1; } }

/* Wider than the frame: the photo ends inside the window, so fade its right edge too */
@media (min-width: 1720px) {
  .hero__photo::after {
    background:
      linear-gradient(to right, var(--bg) 0%, rgba(15, 15, 15, .72) 16%, rgba(15, 15, 15, 0) 46%),
      linear-gradient(to left, var(--bg) 0%, rgba(15, 15, 15, 0) 14%),
      linear-gradient(to top, var(--bg) 0%, rgba(15, 15, 15, 0) 30%),
      linear-gradient(to bottom, rgba(15, 15, 15, .55) 0%, rgba(15, 15, 15, 0) 16%);
  }
}

/* --------------------------------------------------------------------------
   Profile — tabs
   -------------------------------------------------------------------------- */
.profile {
  --profile-top: clamp(56px, 9vh, 110px);
  padding: var(--profile-top) 0 clamp(64px, 10vh, 120px);
  /* cover the grid above the tabs too, so the lines begin at the tab row's top rule */
  background: linear-gradient(var(--bg), var(--bg)) 0 0 / 100% var(--profile-top) no-repeat;
}

.tabs {
  display: grid;
  grid-template-columns: 8fr 10fr;
  border-bottom: 1px solid var(--line);
  background: var(--bg);   /* the rail line stops at the tab row instead of crossing a label */
}
.tab {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: clamp(12px, 1.6vw, 22px);
  padding: clamp(22px, 3.2vw, 38px) 0 clamp(20px, 2.8vw, 34px);
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--dim);
  text-align: left;
  cursor: pointer;
  transition: color .5s var(--ease);
}
.tab + .tab {
  padding-left: clamp(16px, 2.4vw, 32px);
  border-left: 1px solid var(--line);
}
.tab__label {
  font: 300 clamp(1.05rem, 2.5vw, 2.25rem)/1.15 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
}
.tab__num { transition: color .5s var(--ease); }
.tab:hover { color: var(--ink-soft); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"] .tab__num { color: var(--muted); }
/* active indicator: a bright rule drawn along the top edge */
.tab::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .7s var(--ease);
}
.tab[aria-selected="true"]::before { transform: scaleX(1); }
.tab:focus-visible { outline-offset: -1px; }

.panel { padding-top: clamp(40px, 7vh, 88px); }
.panel:focus-visible { outline: none; }
.js .panel:not(.is-active) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .js .panel.is-active { animation: fade .8s var(--ease) both; }
}

/* --------------------------------------------------------------------------
   Sheets — every Career and Project entry
   rail (1/6) | three columns: copy across two, drawing in the third, specs across all
   -------------------------------------------------------------------------- */
.sheet {
  display: grid;
  grid-template-columns: 1fr 5fr;
  border-top: 1px solid var(--line);
}
.sheet:last-child { border-bottom: 1px solid var(--line); }

.sheet__meta {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 30px var(--pad) 0 0;   /* labels stay clear of the rail line */
}
.sheet__idx { color: var(--ink-soft); }
.sheet__status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.sheet__status i {
  width: 6px;
  height: 6px;
  background: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .sheet__status i { animation: blink 2.4s steps(1) infinite; }
}
@keyframes blink { 50% { opacity: .2; } }

/* body = the three grid columns: copy across two, drawing in the third */
.sheet__body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: auto auto 1fr auto;   /* a tall drawing stretches the text row, not the gaps */
  align-content: start;
  padding: 30px 0 36px;
}
.wordmark,
.sheet__lede,
.sheet__text {
  grid-column: 1 / 3;
  padding-left: var(--pad);
}
.sheet__title,
.more {
  grid-column: 1 / -1;
  padding-left: var(--pad);
}

.traces {
  grid-column: 3;
  grid-row: 2 / span 2;
  align-self: center;
  justify-self: end;
  width: min(80%, 290px);
  height: auto;
  opacity: .6;
  pointer-events: none;
}
.traces__cu path {
  fill: none;
  stroke: var(--stone);
  stroke-width: 1.4;
  stroke-linejoin: miter;
}
.traces__ghost {
  fill: none;
  stroke: var(--stone);
  stroke-width: 1.2;
  stroke-dasharray: 2 4;
}
.traces__via circle,
.traces__chip {
  fill: var(--bg);
  stroke: var(--muted);
  stroke-width: 1.4;
}

.wordmark {
  position: relative;
  margin-right: -.442em;
  font: 400 clamp(1.4rem, 2.4vw, 2.2rem)/1.15 var(--display);   /* same size as .sheet__title */
  letter-spacing: .442em;      /* the brahma wordmark spec */
}

/* entry name without a wordmark of its own */
.sheet__title {
  position: relative;
  margin-right: -.2em;
  font: 300 clamp(1.4rem, 2.4vw, 2.2rem)/1.15 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
}

.sheet__lede {
  position: relative;
  margin-top: clamp(16px, 2.6vh, 24px);
  font: 300 clamp(1.1rem, 1.5vw, 1.4rem)/1.4 var(--display);
  letter-spacing: .02em;
}
.sheet__text {
  position: relative;
  margin-top: 12px;
  color: var(--ink-soft);
}
.sheet__org {
  grid-column: 1 / 3;
  margin-top: 14px;
  padding-left: var(--pad);
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.65;
}

.specs {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: clamp(24px, 3.6vh, 34px);
  border-top: 1px solid var(--line);
}
.specs > div { padding: 18px 20px 0 var(--pad); }
.specs > div + div { border-left: 1px solid var(--line); }
.specs dt { color: var(--dim); margin-bottom: 8px; }
.specs dd { font-size: .875rem; line-height: 1.6; }

.sheet--next .sheet__body { padding-block: 26px 30px; }
.more {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font: 300 clamp(1.05rem, 1.6vw, 1.35rem)/1.2 var(--display);
  letter-spacing: .3em;
  text-transform: uppercase;
}
/* registration cross */
.more i {
  position: relative;
  width: 17px;
  height: 17px;
  flex: none;
}
.more i::before,
.more i::after {
  content: "";
  position: absolute;
  background: var(--muted);
}
.more i::before { left: 8px; top: 0; bottom: 0; width: 1px; }
.more i::after  { top: 8px; left: 0; right: 0; height: 1px; }

/* --------------------------------------------------------------------------
   Footer / contact
   -------------------------------------------------------------------------- */
.site-footer {
  padding: clamp(56px, 9vh, 96px) 0 28px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.site-footer .eyebrow { color: var(--dim); }

.mail {
  display: inline-block;
  margin-top: 14px;
  font: 300 clamp(1.15rem, 1.9vw, 1.6rem)/1.3 var(--display);
  letter-spacing: .08em;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  padding-bottom: .12em;
  transition: background-size .8s var(--ease);
  overflow-wrap: anywhere;
}
.mail:hover { background-size: 100% 1px; }

.site-footer__row {
  display: grid;
  grid-template-columns: 8fr 5fr 5fr;
  margin-top: clamp(40px, 7vh, 72px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--dim);
}
.site-footer__row p:nth-child(2) { padding-left: var(--pad); }
.to-top { justify-self: end; transition: color .4s var(--ease); }
.to-top:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Scroll reveal (only when JS is running)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Tablet
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .hero__photo { width: min(var(--hero-h) * .924, 78%); }
  .hero__photo::after {
    background:
      linear-gradient(to right, var(--bg) 0%, rgba(15, 15, 15, .6) 20%, rgba(15, 15, 15, 0) 50%),
      linear-gradient(to top, var(--bg) 0%, rgba(15, 15, 15, .55) 30%, rgba(15, 15, 15, 0) 55%),
      linear-gradient(to bottom, rgba(15, 15, 15, .55) 0%, rgba(15, 15, 15, 0) 16%);
  }
  .name { font-size: clamp(2.05rem, min(7.4vw, var(--hero-h) * .11), 5rem); }
  .hero__coords { display: none; }

  /* the rail gets too narrow here: stack it on top, drop the drafting lines */
  .grid-lines i { display: none; }
  .tabs { grid-template-columns: 1fr 1fr; }
  .sheet { grid-template-columns: 1fr; }
  .sheet__meta {
    grid-auto-flow: column;
    justify-content: space-between;
    padding: 24px 0 0;
  }
  .sheet__body { padding-top: 20px; }
  .wordmark,
  .sheet__title,
  .sheet__lede,
  .sheet__text,
  .sheet__org,
  .more { padding-left: 0; }
  .specs > div:first-child { padding-left: 0; }
  .site-footer__row { grid-template-columns: 1fr auto auto; gap: 0 clamp(20px, 4vw, 40px); }
  .site-footer__row p:nth-child(2) { padding-left: 0; }
}

/* --------------------------------------------------------------------------
   Phone
   -------------------------------------------------------------------------- */
@media (max-width: 699px) {
  :root { --header-h: 64px; }

  .mark { flex-direction: column; letter-spacing: .26em; font-size: .6875rem; }   /* stacked, to fit beside the nav */
  .nav { gap: 18px; }
  .nav a { letter-spacing: .18em; }

  .hero {
    --hero-h: 100svh;
    align-items: flex-end;
    padding-bottom: 40px;
  }
  .hero__photo {
    left: 0;
    width: 100%;
    bottom: auto;
    height: 78svh;
  }
  .hero__photo img { object-position: 62% 30%; }
  .hero__photo::after {
    background:
      linear-gradient(to top, var(--bg) 0%, rgba(15, 15, 15, .82) 22%, rgba(15, 15, 15, 0) 52%),
      linear-gradient(to bottom, rgba(15, 15, 15, .6) 0%, rgba(15, 15, 15, 0) 18%);
  }
  .name {
    font-size: clamp(1.6rem, 9.2vw, 2.6rem);
    letter-spacing: .34em;
    margin-right: -.34em;
  }
  .hero__rule { width: 64%; }
  .hero__roles { letter-spacing: .22em; font-size: .75rem; }
  .hero__meta { flex-direction: column; margin-top: 26px; }
  .hero__meta > div { min-width: 0; }
  .scroll-cue { display: none; }

  .tab { flex-direction: column; gap: 8px; }
  .tab__label { letter-spacing: .16em; }

  .sheet__body { display: block; padding: 20px 0 32px; }
  .traces { display: none; }

  .specs { grid-template-columns: 1fr; }
  .specs > div,
  .specs > div + div {
    padding: 16px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .site-footer__row { grid-template-columns: 1fr; gap: 10px; }
  .site-footer__row p:nth-child(2) { padding-left: 0; }
  .to-top { justify-self: start; }

}
