:root {
  /* One line of text. The clock reels step by exactly this much, and
     script.js reads it — keep them in sync by changing it only here. */
  --line: 20px;

  --bg: rgb(253, 253, 252);
  --text: rgb(17, 17, 17);
  --muted: rgba(0, 0, 0, 0.4);
  --hairline: rgb(242, 242, 242);
  --underline: rgb(217, 217, 217);
  --underline-hover: rgb(102, 102, 102);
  --accent: #ff6702;
  --focus-color: #0060df;
}

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

html { background: var(--bg); }

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: var(--line);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 80px 16px 40px;
}

h1 {
  font-size: 14px;
  font-weight: 500;
}

.updated {
  display: block;
  color: var(--muted);
}

/* Underline drawn as a pseudo-element hairline */
.basic-link {
  position: relative;
  color: inherit;
  text-decoration: none;
}
.basic-link::before {
  content: "";
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  border-radius: 2px;
  background: var(--underline);
  transition: background 0.2s;
}
.basic-link:hover::before { background: var(--underline-hover); }
.basic-link:focus-visible {
  border-radius: 2px;
  padding: 0 2px;
  margin: 0 -2px;
  outline: 2px solid var(--focus-color);
}

footer {
  margin-top: 88px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px 0;
}

/* Keep CV actions in a left-side rail on wide screens. Their top edge
   aligns with the reading column; on narrower viewports they return to
   the footer. */
@media screen and (min-width: 900px) {
  .cv-actions {
    position: fixed;
    left: max(16px, 5vw);
    top: 80px;
    z-index: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin: 0;
    padding: 0;
  }
}

.not-found-message { margin-top: 20px; }

.not-found-page h1 { color: var(--muted); }

.not-found-footer { margin-top: 20px; }

/* CV layout */
.cv-role {
  margin-top: 20px;
  max-width: 540px;
}

.cv-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 20px;
}

.cv-section { margin-top: 64px; }

.cv-section > h2 {
  color: var(--muted);
  font-size: 14px;
  font-weight: 460;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}

.cv-section > p { margin-top: 20px; }

.cv-entries,
.cv-groups { border-bottom: 0; }

.cv-entry,
.cv-group {
  padding: 20px 0;
  border-bottom: 1px solid var(--hairline);
}

.cv-entry:last-child,
.cv-group:last-child { border-bottom: 0; }

.cv-entry-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.cv-entry h3,
.cv-group h3 {
  font-size: 14px;
  font-weight: 500;
}

.cv-title,
.cv-period,
.cv-context { color: var(--muted); }

.cv-title {
  flex-shrink: 0;
  text-align: right;
}

.cv-period { margin-top: 2px; }

.cv-context {
  margin-top: 2px;
  font-style: italic;
}

.cv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-left: 17px;
}

.cv-list li { padding-left: 3px; }
.cv-list li::marker { color: var(--muted); }

.cv-group p { margin-top: 8px; }

.cv-education {
  padding-bottom: 0;
  border-bottom: 0;
}

.index-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.index-link svg {
  flex: none;
  width: 14px;
  height: 14px;
}

.index-link:hover { color: var(--underline-hover); }

.download-link { cursor: pointer; }

.index-link:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Homepage portfolio — an editorial layout with neutral work fields */

.portfolio-hero { margin-top: 40px; }

.portfolio-hero > p {
  max-width: 560px;
  margin-top: 20px;
}

.portfolio-hero > p:first-child { margin-top: 0; }

.portfolio-signature {
  display: block;
  width: auto;
  height: 32px;
  margin-top: 40px;
}

.portfolio-signature-path {
  animation: drawSignature 2s cubic-bezier(.44, 0, .56, 1) both;
  stroke-dasharray: 219.59437561035156 219.59437561035156;
  stroke-dashoffset: 0;
}

@keyframes drawSignature {
  from { stroke-dashoffset: 219.59437561035156; }
  to { stroke-dashoffset: 0; }
}

.portfolio-work { margin-top: 64px; }

.portfolio-work > h2 {
  color: var(--muted);
  font-size: 14px;
  font-weight: 460;
  padding-bottom: 8px;
}

.portfolio-project { padding-top: 16px; }

.portfolio-project-image {
  display: block;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
}

.portfolio-project-placeholder,
.portfolio-project-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
}

.portfolio-project-placeholder {
  background: rgb(0 0 0 / 5%);
}

.portfolio-project-cover {
  height: auto;
  object-fit: cover;
  transform-origin: center;
  transition: transform 0.8s cubic-bezier(.2, .7, .2, 1);
}

@media (hover: hover) and (pointer: fine) {
  .portfolio-project-image:hover .portfolio-project-cover {
    transform: scale(1.05);
  }
}

.portfolio-project-image:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 3px;
}

.portfolio-project-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 10px 0 28px;
}

.portfolio-project-year { color: var(--muted); }

.portfolio-project-name {
  color: inherit;
  font-weight: 500;
  text-decoration: none;
}

a.portfolio-project-name:hover { text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 2px; }

.portfolio-project-name:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

.portfolio-latest {
  margin-left: 8px;
  color: var(--accent);
  font-weight: 400;
}

.home-page footer { margin-top: 64px; }

@media screen and (max-width: 640px) {
  .home-page main { padding-top: 48px; }
}

@media screen and (max-width: 899px) {
  .cv-page main { padding-top: 48px; }
}

@media screen and (max-width: 520px) {
  .cv-entry-heading {
    display: block;
  }

  .cv-title {
    display: block;
    margin-top: 2px;
    text-align: left;
  }
}

/* Rolling clock digits: each digit is a masked column of 0-9 that
   slides vertically when the time changes */
.clock { display: inline-flex; vertical-align: bottom; }
.clock .digit {
  display: inline-block;
  height: var(--line);
  overflow: hidden;
}
.clock .reel {
  display: block;
  transition: transform 0.75s cubic-bezier(0.25, 1, 0.25, 1);
}
.clock .reel span {
  display: block;
  height: var(--line);
}

/* Blink by squishing the eye glyphs with a transform — the characters
   never change, so the face keeps the exact same width. The night
   state holds the same squish while z's drift up beside the face. */
.face { display: inline-block; }
.face .eye {
  display: inline-block;
  transition: transform 0.1s ease;
}
.face.blink .eye,
.face.asleep .eye { transform: scaleY(0.12); }

.zzz {
  display: inline-block;
  position: relative;
  width: 18px;
  height: var(--line);
  vertical-align: bottom;
}
/* Needed because the display above would otherwise beat the hidden attribute */
.zzz[hidden] { display: none; }
.zzz span {
  position: absolute;
  bottom: 4px;
  left: 2px;
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  animation: zFloat 3.6s linear infinite;
}
.zzz span:nth-child(2) { left: 7px; font-size: 12px; animation-delay: 1.2s; }
.zzz span:nth-child(3) { left: 12px; animation-delay: 2.4s; }
@keyframes zFloat {
  0%   { transform: translateY(0); opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translateY(-12px); opacity: 0; }
}

/* Page-load appearance: each block fades in and rises 8px, staggered
   top to bottom in 0.05s steps. */
@keyframes staggerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

header,
.cv-section,
.portfolio-hero,
.portfolio-work,
footer {
  animation: staggerIn 0.5s ease both;
}
.cv-section:nth-of-type(1) { animation-delay: 0.05s; }
.cv-section:nth-of-type(2) { animation-delay: 0.1s; }
.cv-section:nth-of-type(3) { animation-delay: 0.15s; }
.cv-section:nth-of-type(4) { animation-delay: 0.2s; }
.cv-section:nth-of-type(5) { animation-delay: 0.25s; }
.portfolio-hero { animation-delay: 0.05s; }
.portfolio-work { animation-delay: 0.12s; }
footer { animation-delay: 0.55s; }

@media (prefers-reduced-motion: reduce) {
  header, .cv-section, .portfolio-hero, .portfolio-work, footer { animation: none; }
  .portfolio-signature-path { animation: none; stroke-dashoffset: 0; }
  .portfolio-project-cover { transition: none; transform: none; }
  .clock .reel { transition: none; }
  .face .eye { transition: none; }
  .zzz span { animation: none; opacity: 0.8; transform: none; }
}
