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

:root {
  --paper: #f5f2ed;
  --ink: #0a0a0a;
  --gray: #635e58;        /* text: 5.75:1 on paper — passes AA */
  --gray-soft: #8a8580;   /* decoration only: rules, marks, monogram */
  --muted: #3a3632;
  --rule: rgba(10, 10, 10, 0.10);
  --hairline: rgba(10, 10, 10, 0.06);
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Courier Prime', 'Courier New', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Grain overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1000;
}

::selection { background: var(--ink); color: var(--paper); }

/* --- Layout --- */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 12vh 2rem 8vh;
}

/* --- Header --- */
header { margin-bottom: 7rem; }

.site-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(3rem, 8vw, 5rem);
  letter-spacing: -0.02em;
  line-height: 1;
  text-wrap: balance;
  opacity: 0;
  animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.site-subtitle {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 1.5rem;
  opacity: 0;
  animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.header-line {
  width: 40px;
  height: 1px;
  background: var(--gray-soft);
  margin-top: 2rem;
  opacity: 0;
  animation: growLine 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

/* --- Sections --- */
.section {
  margin-bottom: 5rem;
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.section:nth-of-type(1) { animation-delay: 0.6s; }
.section:nth-of-type(2) { animation-delay: 0.75s; }
.section:nth-of-type(3) { animation-delay: 0.9s; }
.section:nth-of-type(4) { animation-delay: 1.05s; }

.section-label {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: 1rem;
  letter-spacing: 0.15em;
  color: var(--gray);
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--hairline);
}

/* --- Prose --- */
.prose {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 540px;
  text-wrap: pretty;
}

.prose p + p { margin-top: 1.5rem; }

.prose em { font-style: italic; font-weight: 600; color: var(--ink); }

/* --- Portrait --- */
.about-layout {
  display: flex;
  align-items: flex-start;
  gap: 3rem;
}

.portrait {
  flex-shrink: 0;
  width: 260px;
  position: relative;
}

/* Offset hairline, sitting behind the frame — editorial register */
.portrait::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--rule);
  z-index: 0;
  pointer-events: none;
}

.portrait-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--rule);
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.05);
}

/* Monogram stand-in, shown until a real portrait is dropped in */
.portrait-monogram {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: 5rem;
  letter-spacing: 0.05em;
  color: var(--gray-soft);
  user-select: none;
}

.portrait-caption {
  position: relative;
  z-index: 1;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--hairline);
  line-height: 1.7;
}

/* --- Section note --- */
.section-note {
  margin-top: 1.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
}

/* --- Dotted-leader list (services / work) --- */
.list { list-style: none; }

.list li { border-bottom: 1px solid rgba(10, 10, 10, 0.045); }

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  text-decoration: none;
  color: var(--ink);
  transition: padding 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

a.row::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 50%;
  width: 0;
  height: 1px;
  background: var(--ink);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

a.row:hover { padding-left: 1rem; }
a.row:hover::before { width: 0.75rem; }
a.row:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.row-key {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.row-val {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-style: italic;
  font-size: 1.18rem;
  color: var(--muted);
  transition: color 0.4s ease;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row:hover .row-val { color: var(--ink); }

.row-dot {
  flex: 1;
  border-bottom: 1px dotted rgba(10, 10, 10, 0.16);
  min-width: 2rem;
  position: relative;
  top: -0.3em;
}

/* --- Marker (echoes the moon glyph) --- */
.mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--gray-soft);
  margin-right: 0.6rem;
  position: relative;
  top: -1px;
}

.mark.full { background: var(--gray-soft); }
.mark.half { background: linear-gradient(90deg, var(--gray-soft) 50%, transparent 50%); }
.mark.waning { background: linear-gradient(270deg, var(--gray-soft) 50%, transparent 50%); }
.mark.new { background: transparent; }

/* --- Contact --- */
.contact-line {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.75;
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 540px;
  text-wrap: pretty;
}

.email-link {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 300;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.15em;
  transition: border-color 0.4s ease, opacity 0.4s ease;
}

.email-link:hover { border-color: var(--ink); }
.email-link:focus-visible { outline: 1px solid var(--ink); outline-offset: 6px; }

.elsewhere {
  margin-top: 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
}

.elsewhere a {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray);
  text-decoration: none;
  transition: color 0.3s ease;
}

.elsewhere a:hover { color: var(--ink); }
.elsewhere a:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* --- Footer --- */
footer {
  margin-top: 8rem;
  padding-top: 2rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) 1.2s forwards;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes growLine {
  from { opacity: 0; width: 0; }
  to   { opacity: 1; width: 40px; }
}

/* Scroll-driven reveals where supported; the timed stagger above is the
   fallback. Sections now animate when they actually enter view rather than
   finishing on a fixed clock before you scroll to them. */
@supports (animation-timeline: view()) {
  .section {
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-timeline: view();
    animation-range: entry 5% cover 25%;
    animation-delay: 0s;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  .site-title, .site-subtitle, .header-line, .section, footer { opacity: 1; }
  .section { animation-timeline: auto; animation-range: normal; }
}

/* --- Responsive --- */
@media (max-width: 560px) {
  .container { padding: 8vh 1.5rem 6vh; }
  header { margin-bottom: 4.5rem; }
  .about-layout { flex-direction: column; gap: 2.5rem; }
  .portrait { width: 100%; max-width: 300px; }
  .row { flex-wrap: wrap; gap: 0.25rem; }
  .row-dot { display: none; }
  .row-val { text-align: left; white-space: normal; width: 100%; }
}

@media (max-width: 760px) and (min-width: 561px) {
  .about-layout { gap: 2rem; }
  .portrait { width: 200px; }
}

@media (min-width: 1024px) {
  .portrait {
    width: 300px;
    margin-left: -150px;
  }
}

/* --- Print --- */
@media print {
  body::after { display: none; }
  .container { padding: 0; max-width: none; }
  .section, header, footer { opacity: 1; animation: none; }
}

/* --- Markdown body for standalone pages authored in admin --- */
.page-body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: 1.3rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 540px;
  text-wrap: pretty;
}

.page-body p + p,
.page-body ul, .page-body ol, .page-body blockquote { margin-top: 1.5rem; }

.page-body h2, .page-body h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  color: var(--ink);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

.page-body h2 { font-size: 1.9rem; }
.page-body h3 { font-size: 1.45rem; }
.page-body em { font-style: italic; font-weight: 600; color: var(--ink); }
.page-body strong { font-weight: 600; color: var(--ink); }

.page-body a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color 0.4s ease;
}

.page-body a:hover { border-color: var(--ink); }
.page-body a:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.page-body ul, .page-body ol { padding-left: 1.25rem; }
.page-body li + li { margin-top: 0.4rem; }

.page-body blockquote {
  border-left: 1px solid var(--rule);
  padding-left: 1.25rem;
  font-style: italic;
}

.page-body img { max-width: 100%; height: auto; filter: grayscale(1) contrast(1.05); }

.page-body code {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.85em;
  background: rgba(10, 10, 10, 0.04);
  padding: 0.1em 0.35em;
}

.page-body pre {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(10, 10, 10, 0.04);
  overflow-x: auto;
}

.page-body pre code { background: none; padding: 0; }

/* Back link on interior pages */
.back-link {
  display: inline-block;
  margin-top: 4rem;
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gray);
  text-decoration: none;
  transition: color 0.3s ease;
}

.back-link:hover { color: var(--ink); }
.back-link:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* Interior pages have no hero header, so give the title room */
.page-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
  margin-bottom: 2.5rem;
}
