/* Dan Baruch — the trees direction.
   Palette sampled from the artwork itself: twilight slate, dawn amber, canopy
   green. The image is the argument; the words stay short. */

:root {
  color-scheme: dark;
  --bg: #0d1420;          /* deep water / pre-dawn sky */
  --bg-2: #131c2b;
  --ink: #f4efe6;         /* warm off-white, like the highlights */
  --ink-2: #c3bdb2;
  --ink-3: #8b8779;
  --line: rgba(244, 239, 230, 0.16);
  --amber: #f0a742;       /* the sun */
  --green: #7cb342;       /* the canopy */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink-2);
  font-family: Inter, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* Keep homepage copy, labels, and links in one warm off-white. */
.home-page {
  --ink-2: var(--ink);
  --ink-3: var(--ink);
}

/* ---------- the artwork ---------- */
.art {
  position: relative;
  margin: 0;
  height: clamp(240px, 42vh, 430px);
  overflow: hidden;
}
.art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 58%;
  display: block;
}
/* fade the image into the page so it doesn't end on a hard line */
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(13, 20, 32, 0.28) 0%, transparent 26%, transparent 62%, var(--bg) 100%);
  pointer-events: none;
}
.art figcaption {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #f6efe2;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.75);
}

/* ---------- the sheet ---------- */
.sheet {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 14px auto 0;
  padding: 0 26px 96px;
}

.who { margin-bottom: 30px; }

h1 {
  margin: 0 0 6px;
  font-family: "Rozha One", Georgia, "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.5rem, 8.4vw, 4rem);
  line-height: 1.02;
  color: var(--ink);
}

.tagline {
  margin: 0;
  font-family: "Rozha One", Georgia, "Times New Roman", serif;
  font-size: clamp(1.12rem, 3.4vw, 1.5rem);
  letter-spacing: 0.02em;
  color: var(--amber);
}

.lede {
  color: var(--ink);
  font-size: 1.08rem;
  margin-bottom: 22px;
}

p { margin: 0 0 20px; max-width: 46ch; }
.quiet { color: var(--ink-3); }
.sep { color: var(--ink-3); margin: 0 9px; }

/* one project per line, emoji as a leading mark */
.item { display: block; margin: 4px 0 0; }
.item:first-of-type { margin-top: 6px; }
.emoji { display: inline-block; width: 1.5em; }

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color 0.16s ease, color 0.16s ease;
}
a:hover { color: var(--amber); border-bottom-color: var(--amber); }
a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 1px; }

.links {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

/* A short reading list follows the projects on the home page. */
.home-writing { margin-top: 28px; }
.home-writing h2 { margin: 0 0 6px; font: inherit; }
.home-writing ul { list-style: none; margin: 0 0 8px; padding: 0; }
.home-writing li { display: block; }
.home-writing li + li { margin-top: 4px; }
.home-writing a { overflow-wrap: anywhere; }
.home-writing .all-writing { font-size: 0.9em; }

/* ---------- footer: a small signature, then the links ---------- */
.foot {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
/* the row already has the rule and the spacing, so the nav drops its own.
   It keeps the portrait in a left column and wraps its own links beside it,
   rather than letting flex-wrap orphan the portrait on a line of its own. */
.foot .links {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.foot-face {
  flex: 0 0 auto;
  display: block;
  border: 0;
  border-radius: 50%;
  overflow: hidden;
  line-height: 0;
}
.foot-face img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid var(--line);
  /* bias the crop up: a 56px circle out of a 672x807 frame lands on the chin
     if it is centred */
  object-fit: cover;
  object-position: 50% 16%;
  transition: border-color 0.16s ease;
}
.foot-face:hover img { border-color: var(--amber); }
.foot-face:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

@media (max-width: 620px) {
  body { font-size: 16px; }
  .art { height: clamp(190px, 32vh, 260px); }
  .art img { object-position: 66% 58%; }
  /* A centered signature and balanced link rows on small screens. */
  .foot { flex-direction: column; gap: 10px; text-align: center; }
  .foot .links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 18px;
    width: 100%;
    max-width: 320px;
  }
  .foot .links .sep { display: none; }
  .foot .links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: 7px 0;
    white-space: nowrap;
  }
  .art-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  image-rendering: pixelated;
  pointer-events: none;
}
.art figcaption { font-size: 10px; letter-spacing: 0.1em; bottom: 22px; }
  .sheet { margin-top: 8px; padding: 0 20px 40px; }
  .sep { margin: 0 7px; }
}

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

/* ---------- closing: the tagline, etched ---------- */
.closing {
  position: relative;
  margin: 60px -14px 0;
  height: clamp(150px, 26vh, 280px);
}
.closing-etch {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 220ms ease;
}
.closing-etch.is-live { opacity: 1; }
/* Keep the words available to assistive technology without a visible
   placeholder before the etching animation is ready. */
.closing-fallback {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Keep the mobile signature compact instead of scaling its empty space
   with the height of the phone screen. */
@media (max-width: 620px) {
  .closing { height: 120px; margin-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .closing { height: 0; margin-top: 0; }
  .closing-etch { display: none; }
}

/* ============================================================
   Motion
   1. Cross-document view transitions — navigating between Home and
      About cross-fades the shared pieces instead of snapping.
   2. Skeleton shimmer while the artwork decodes.
   3. Scroll-reveal for content further down.
   ============================================================ */

@view-transition {
  navigation: auto;
}

/* The artwork is the one thing both pages share and place at the top, so it
   carries the eye across while everything else cross-fades beneath it. */
[data-art] { view-transition-name: artwork; }

/* Short and slightly asymmetric. The default (both pages at 50% for ~250ms)
   double-exposes two different layouts, which reads as a muddle; getting the
   old page out of the way quickly and letting the new one arrive just behind
   it keeps the motion but loses the ghosting. */
::view-transition-old(root) {
  /* out of the way almost immediately: lingering here is what put two sets of
     page text on screen at once */
  animation: 1ms linear both dbv-out;
}
::view-transition-new(root) {
  animation: 300ms cubic-bezier(0.16, 1, 0.3, 1) both dbv-in;
}
@keyframes dbv-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes dbv-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- skeleton for the artwork ---------- */
.art-skeleton {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(100deg,
      transparent 20%,
      rgba(244, 239, 230, 0.10) 42%,
      rgba(244, 239, 230, 0.16) 50%,
      rgba(244, 239, 230, 0.10) 58%,
      transparent 80%),
    linear-gradient(180deg, #16202f, #0f1927 70%, var(--bg));
  background-size: 220% 100%, 100% 100%;
  background-repeat: no-repeat;
  animation: skeleton-sweep 1.5s linear infinite;
  transition: opacity 420ms ease;
}
.art.is-loading .art-skeleton { display: block; }

@keyframes skeleton-sweep {
  from { background-position: 140% 0, 0 0; }
  to   { background-position: -40% 0, 0 0; }
}

/* Static content remains visible; motion.js animates only supported,
   successfully observed elements with the Web Animations API. */
.rise { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
  ::view-transition-new(root) { transform: none; }
  .art-skeleton { animation: none; }
  .rise { opacity: 1; transform: none; transition: none; }
}

/* ---------- about: portrait + opener side by side ---------- */
.intro {
  display: grid;
  /* the portrait reads as small at 168px; 224 is a medium step and still
     leaves the opener a comfortable 46ch beside it */
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 6px;
}
.portrait {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-2);
}
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  /* height:auto is required alongside width/height attributes or the crop breaks */
}
@media (max-width: 560px) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .portrait { max-width: 184px; }
}

/* select projects: a link inside the row label */
.projects-list strong a { border-bottom: 1px solid var(--line); }
.projects-list strong a:hover { color: var(--amber); border-bottom-color: var(--amber); }
