/* ============================================================
   Tim Tikhomirov — personal site
   Palette is warm neutral; the only colour is an amber pulled
   from the autumn larches in the hero photograph.
   ============================================================ */

:root {
  /* Declares that both schemes are handled here, which also stops Chrome's
     auto dark mode from force-inverting the palette on top of ours. */
  color-scheme: light dark;

  --bg:          #faf8f5;
  --surface:     #f2eee7;
  --text:        #1a1815;
  --muted:       #6a6357;
  --border:      #e4ddd2;
  --accent:      #a15c1c;
  --accent-weak: #efe3d3;

  --font-sans:    'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', ui-serif, Georgia, 'Times New Roman', serif;

  --container: 60rem;   /* 960px */
  --prose:     34rem;   /* comfortable reading measure */
  --radius:    0.75rem;
}

:root[data-theme='light'] { color-scheme: light; }

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg:          #14130f;
  --surface:     #1c1a15;
  --text:        #ebe6dd;
  --muted:       #a09889;
  --border:      #2f2b23;
  --accent:      #e2a765;
  --accent-weak: #2a2318;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg:          #14130f;
    --surface:     #1c1a15;
    --text:        #ebe6dd;
    --muted:       #a09889;
    --border:      #2f2b23;
    --accent:      #e2a765;
    --accent-weak: #2a2318;
  }
}

/* ---------- Reset ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  font-feature-settings: 'cv05' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
p  { margin: 0 0 1.1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}

.skip-link:focus { left: 0; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.9rem 1.75rem;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}

.topbar.is-scrolled { border-bottom-color: var(--border); }

.topbar__name {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.005em;
  text-decoration: none;
  margin-right: auto;
}

.topbar__nav {
  display: flex;
  gap: 1.4rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.topbar__nav a { text-decoration: none; }
.topbar__nav a:hover { color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-weak);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

/* Show the icon for the theme you would switch *to*. */
.theme-toggle__sun  { display: none; }
.theme-toggle__moon { display: block; }

:root[data-theme='dark'] .theme-toggle__sun  { display: block; }
:root[data-theme='dark'] .theme-toggle__moon { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle__sun  { display: block; }
  :root:not([data-theme='light']) .theme-toggle__moon { display: none; }
}

/* ---------- Shared layout ---------- */

main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.75rem;
}

.section { padding: 4.25rem 0 0; }

.section__label {
  margin-bottom: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.lead {
  max-width: var(--prose);
  font-size: 1.075rem;
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.footnote {
  max-width: var(--prose);
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr 19rem;
  align-items: start;
  gap: 3.5rem;
  padding: 3.5rem 0 1rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3rem, 7.5vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin-bottom: 0.6rem;
}

.hero__role {
  margin-bottom: 0.35rem;
  font-size: 1.125rem;
  font-weight: 500;
}

.hero__tagline {
  margin-bottom: 1.75rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero__tagline span { margin: 0 0.15em; opacity: 0.5; }

.hero__lede {
  max-width: 31rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero__figure { margin: 0.5rem 0 0; }

.hero__figure img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 28px -12px rgb(0 0 0 / 0.22);
}

/* ---------- Link row ---------- */

.linkrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.35rem;
  margin-top: 1.9rem;
  font-size: 0.925rem;
  font-weight: 500;
}

.linkrow li { position: relative; }

.linkrow li + li::before {
  content: '';
  position: absolute;
  left: -0.72rem;
  top: 50%;
  width: 3px;
  height: 3px;
  margin-top: -1.5px;
  background: var(--border);
  border-radius: 50%;
}

/* ---------- What I do ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem 3rem;
  margin-top: 2.5rem;
}

.grid h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Pull quote ---------- */

.quote {
  max-width: 42rem;
  margin: 0;
  padding-left: 1.6rem;
  border-left: 2px solid var(--accent);
}

.quote blockquote {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  font-style: italic;
  line-height: 1.28;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

.quote figcaption {
  max-width: var(--prose);
  color: var(--muted);
  font-size: 0.925rem;
}

.quote__link {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
}

/* ---------- Quoted post ---------- */

/* Rebuilt in the site's own type rather than embedded, so it follows the
   theme instantly and costs no third-party script. */

.post__lead {
  max-width: var(--prose);
  margin: 2.75rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.post {
  position: relative;
  max-width: 32rem;
  margin: 1rem 0 0;
  padding: 1.4rem 1.6rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.post__source {
  position: absolute;
  top: 1.45rem;
  right: 1.5rem;
  color: var(--muted);
  transition: color 0.18s ease;
}

.post__source:hover { color: var(--text); }

.post__logo {
  display: block;
  width: 0.95rem;
  height: 0.95rem;
  fill: currentColor;
}

.post__text {
  margin: 0 2.25rem 0.85rem 0;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.post__meta a {
  color: inherit;
  border-bottom: 1px solid var(--border);
}

.post__meta a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- Experience ---------- */

.roles { display: grid; gap: 3rem; }

.role {
  display: grid;
  grid-template-columns: 10.5rem 1fr;
  gap: 2rem;
}

.role__meta { padding-top: 0.28rem; }

.role__dates,
.role__place {
  margin: 0;
  color: var(--muted);
  font-size: 0.825rem;
  font-variant-numeric: tabular-nums;
}

.role__place { opacity: 0.75; }

.role__body h3 {
  margin: 0;
  flex: 1;
  font-size: 1.0625rem;
  transition: color 0.18s ease;
}

/* The one role without a disclosure keeps its own heading spacing. */
.role__body > h3 { margin-bottom: 0.9rem; }

/* Older roles collapse; the current one ships open. */
.role__body > summary {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  list-style: none;
  cursor: pointer;
}

.role__body > summary::-webkit-details-marker { display: none; }

.role__body[open] > summary { margin-bottom: 0.9rem; }

.role__more {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  transition: color 0.18s ease;
}

.role__more::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  margin-top: -0.2rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.22s ease;
}

.role__body[open] .role__more::after {
  margin-top: 0.12rem;
  transform: rotate(-135deg);
}

.role__body > summary:hover h3,
.role__body > summary:hover .role__more {
  color: var(--accent);
}

.role__org {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.95rem;
}

.role__body > p {
  max-width: var(--prose);
  margin-bottom: 0.95rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.role__body ul {
  display: grid;
  gap: 0.55rem;
  max-width: 36rem;
  font-size: 0.9375rem;
}

.role__body li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--muted);
}

.role__body li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 4px;
  height: 1px;
  background: var(--accent);
  opacity: 0.65;
}

.role__body strong {
  color: var(--text);
  font-weight: 600;
}

.role--compact .role__body > p { margin-bottom: 0; }

/* Education sits outside the roles list but keeps the same columns and
   bullet styling, so it reads as one more entry rather than a footnote. */
.role--edu { margin-top: 3rem; }

.role--edu .role__meta { padding-top: 0; }

/* ---------- Project card ---------- */

.card {
  max-width: 38rem;
  padding: 1.75rem 1.85rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h3 {
  margin-bottom: 0.7rem;
  font-size: 1.0625rem;
}

.card h3 a { text-decoration: none; }
.card h3 a:hover { color: var(--accent); }

.card p {
  color: var(--muted);
  font-size: 0.95rem;
}

.card p:last-of-type { margin-bottom: 1.35rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags li {
  padding: 0.2rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--muted);
  font-size: 0.775rem;
  font-weight: 500;
}

/* ---------- Off the clock ---------- */

.personal {
  display: grid;
  grid-template-columns: 17.5rem 1fr;
  align-items: stretch;
  gap: 2.75rem;
}

.personal__figure { margin: 0; }

/* The photo matches the height of the text beside it rather than sitting as a
   fixed square, which is what made the two columns look mismatched. */
.personal__figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 35%;
  border-radius: var(--radius);
  filter: grayscale(1) contrast(1.04);
}

.personal__text {
  max-width: var(--prose);
  color: var(--muted);
  font-size: 0.975rem;
}

.personal__text .footnote { margin: 1.5rem 0 0; font-size: 0.825rem; }

/* ---------- Recordings ---------- */

.tracks {
  display: grid;
  gap: 1.15rem;
  margin: 1.4rem 0 1.6rem;
}

.tracks__title {
  margin: 0 0 0.45rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Native controls, which inherit the page's colour-scheme automatically. */
.tracks audio {
  width: 100%;
  max-width: 21rem;
  height: 2.25rem;
}

/* ---------- Contact ---------- */

.section--contact { padding-bottom: 1rem; }

.contact__email {
  margin: 1.6rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.4vw, 1.85rem);
}

.contact__email a { text-decoration-thickness: 1px; }

.email-reveal {
  padding: 0.5rem 1.1rem;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.email-reveal:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-weak);
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1.5rem;
  max-width: var(--container);
  margin: 4.5rem auto 0;
  padding: 1.75rem 1.75rem 2.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.825rem;
}

.footer p { margin: 0; }

/* ---------- Scroll reveal (opt-in, so no-JS still shows content) ---------- */

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 56rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2.5rem;
    padding-top: 2.5rem;
  }

  .hero__figure {
    order: -1;
    width: min(15rem, 55%);
  }

  .hero__lede, .hero__tagline { max-width: none; }

  .role { grid-template-columns: 1fr; gap: 0.75rem; }
  .role__meta { display: flex; gap: 0.4rem; padding-top: 0; }
  .role__place::before { content: '· '; }

  .personal { grid-template-columns: 1fr; gap: 1.75rem; }
  .personal__figure { width: min(15rem, 55%); }

  /* Stacked, there is no neighbouring column to match, so go back to a crop
     with its own fixed shape. */
  .personal__figure img { height: auto; aspect-ratio: 4 / 5; }
}

@media (max-width: 40rem) {
  main, .topbar, .footer { padding-left: 1.25rem; padding-right: 1.25rem; }

  .topbar__nav { display: none; }

  .section { padding-top: 3.25rem; }

  .grid { grid-template-columns: 1fr; gap: 1.75rem; }

  .quote { padding-left: 1.1rem; }

  .card { padding: 1.4rem 1.4rem 1.2rem; }

  .role__body ul { max-width: none; }
}

/* ---------- Motion & print ---------- */

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

  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .js-reveal .reveal { opacity: 1; transform: none; }
}

@media print {
  .topbar, .theme-toggle, .skip-link, .hero__figure, .personal__figure,
  .role__more, .email-reveal, .tracks { display: none; }

  body { background: #fff; color: #000; font-size: 10.5pt; }
  .section { padding-top: 1.5rem; break-inside: avoid; }
  .role { break-inside: avoid; }
  a { text-decoration: none; }
}
