/* ==========================================================================
   Asta Rossi — element85.rocks
   One stylesheet. Edit the tokens in :root to restyle the whole site.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */

:root {
  /* Warm paper, never stark white */
  --paper:      #f3f0e7;
  --paper-warm: #eae5d8;
  --paper-card: #f7f5ee;

  --ink:        #2c2825;
  --ink-soft:   #5d564d;
  --ink-faint:  #8b8378;

  --rule:       #d9d3c4;
  --moss:       #5c6d50;   /* primary accent  */
  --clay:       #a2664a;   /* secondary accent */

  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --measure: 42rem;   /* reading width for body copy */
  --page:    76rem;   /* max page width              */

  --step: clamp(1rem, 0.85rem + 0.7vw, 1.125rem);

  /* This site is light in every context. Pinning color-scheme keeps
     browser-drawn UI — the audio player, scrollbars, focus rings —
     light too when the reader's OS is set to dark. */
  color-scheme: light;
}

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

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Paper grain — an inline SVG turbulence, so there is no image to load. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { max-width: 100%; height: auto; display: block; }

/* --- Typography --------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: 0.005em;
  margin: 0 0 0.4em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4rem); font-weight: 400; }
h2 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1.15em; max-width: var(--measure); text-wrap: pretty; }

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--clay); }
a:focus-visible { outline: 2px solid var(--moss); outline-offset: 3px; border-radius: 2px; }

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

.lede {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 1.05rem + 0.9vw, 1.6rem);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 44ch;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.4rem;
  font-weight: 500;
}

/* --- Layout ------------------------------------------------------------- */

.wrap {
  position: relative;
  z-index: 1;
  width: min(100% - 3rem, var(--page));
  margin-inline: auto;
}

main { padding-block: clamp(3rem, 8vw, 6rem) 4rem; }

.prose { max-width: var(--measure); }

/* --- Header ------------------------------------------------------------- */

.site-header {
  position: relative;
  z-index: 2;
  padding-block: 1.6rem;
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  align-items: baseline;
  justify-content: space-between;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav { display: flex; gap: 1.6rem; }

.site-nav a {
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.site-nav a:hover { color: var(--ink); border-bottom-color: var(--clay); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--moss); }

/* --- Works dropdown ----------------------------------------------------- */
/* Built by js/site.js from the catalogue in index.html. With JS off none of
   this exists and "Works" stays an ordinary link. */

.nav-works {
  position: relative;
  --menu-gap: 1.65rem;   /* button bottom -> panel top; the bridge below matches */
}

.nav-works-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
}

.nav-works-toggle:hover { color: var(--ink); border-bottom-color: var(--clay); }
.nav-works-toggle[aria-current="page"] { color: var(--ink); border-bottom-color: var(--moss); }
.nav-works-toggle:focus-visible { outline: 2px solid var(--moss); outline-offset: 3px; }

.caret { width: 9px; flex: none; transition: transform 160ms ease; }
[aria-expanded="true"] > .caret { transform: rotate(180deg); }

.nav-menu {
  position: absolute;
  top: calc(100% + var(--menu-gap));   /* clears the header's padding and rule */
  right: 0;
  z-index: 20;
  min-width: 17rem;
  max-width: min(23rem, calc(100vw - 3rem));
  padding: 0.5rem;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 5px;
  box-shadow: 0 14px 34px rgba(44, 40, 37, 0.11);
  text-align: left;
}

/* Explicit, so the panel is never left visible-but-positioned. */
.nav-menu[hidden] { display: none; }

/* An invisible bridge across the gap, so moving the cursor down from
   "Works" into the panel never leaves the hover area. */
.nav-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: var(--menu-gap);
}

.nav-menu-all {
  display: block;
  padding: 0.5rem 0.7rem 0.7rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-decoration: none;
}

.nav-menu-all:hover { color: var(--ink); }

.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  appearance: none;
  background: none;
  border: 0;
  border-radius: 3px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.73rem;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}

.nav-group-toggle:hover { background: var(--paper-warm); color: var(--ink); }
.nav-group-toggle:focus-visible { outline: 2px solid var(--moss); outline-offset: -2px; }
.nav-group-toggle > span:first-child { flex: 1; }

.nav-count {
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.nav-group-list {
  list-style: none;
  margin: 0 0 0.35rem;
  padding: 0 0 0.2rem 0.7rem;
}

.nav-group-list a {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.42rem 0.7rem;
  border-radius: 3px;
  text-decoration: none;
  color: var(--ink);
}

.nav-group-list a:hover { background: var(--paper-warm); }
.nav-group-list a:focus-visible { outline: 2px solid var(--moss); outline-offset: -2px; }

.nav-group-list a[aria-current="page"] { background: var(--paper-warm); }
.nav-group-list a[aria-current="page"] em { color: var(--moss); }

.nav-group-list em {
  flex: 1;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.25;
}

.nav-year {
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* On narrow screens the nav wraps, so anchor the panel to the header
   instead of to the button, which may sit anywhere on the row. */
@media (max-width: 40rem) {
  .nav-works { position: static; }
  .nav-menu { left: 0; right: 0; min-width: 0; max-width: none; }
}

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

.hero {
  position: relative;
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(2rem, 5vw, 3.5rem);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;

  /* The box is deliberately off-centre and taller than the hero, but
     'closest-side' makes the ellipse touch all four edges, so the wash is
     fully transparent everywhere the box ends. Without that the gradient
     gets cut off mid-fade and you see the box as a hard edge. Keeping
     right:0 also stops it bleeding past the column into a scrollbar. */
  top: -45%;
  right: 0;
  width: 82%;
  height: 190%;
  background: radial-gradient(ellipse closest-side, var(--paper-warm), transparent);
}

.hero h1 { max-width: 16ch; }

/* Decorative botanical mark, hidden from assistive tech. */
.sprig {
  position: absolute;
  top: clamp(1rem, 4vw, 3rem);
  right: 0;
  width: clamp(90px, 16vw, 170px);
  color: var(--moss);
  opacity: 0.4;
  pointer-events: none;
}

@media (max-width: 34rem) { .sprig { opacity: 0.22; width: 90px; } }

/* --- Rules & dividers --------------------------------------------------- */

.divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 3.5rem 0 2rem;
  color: var(--rule);
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
}

.divider svg { width: 18px; color: var(--moss); opacity: 0.65; flex: none; }

/* --- Works list --------------------------------------------------------- */

.works-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem 1.25rem;
  margin-bottom: 2.5rem;
}

.works-toolbar .label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.segmented { display: flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0.4rem 0.95rem;
  cursor: pointer;
}

.segmented button + button { border-left: 1px solid var(--rule); }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--moss); color: var(--paper); }

.work-group { margin-bottom: 3rem; }

.work-group > h2 {
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 0.6rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--rule);
}

.work-list { list-style: none; margin: 0; padding: 0; }

.work-list > li { border-bottom: 1px solid var(--rule); }

.work-list a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 2.5rem;
  align-items: baseline;
  padding: 1.15rem 0.6rem 1.15rem 0;
  text-decoration: none;
  transition: background-color 140ms ease, padding-left 140ms ease;
}

.work-list a:hover,
.work-list a:focus-visible {
  background: var(--paper-warm);
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.work-title { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.2; }
.work-title em { font-style: italic; }

.work-year {
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  color: var(--ink-faint);
  grid-row: 1;
  grid-column: 2;
}

.work-scoring {
  grid-column: 1 / -1;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

/* --- Work page ---------------------------------------------------------- */

.work-header { margin-bottom: 2.5rem; }
.work-header h1 { font-style: italic; margin-bottom: 0.35rem; }

.work-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.6rem 3rem;
  margin: 0 0 3rem;
  padding: 1.6rem 0;
  border-block: 1px solid var(--rule);
}

.work-meta dt {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}

.work-meta dd { margin: 0; font-size: 1.05rem; }

.media { margin: 2.75rem 0; max-width: var(--measure); }
.media h2 { font-size: 1.1rem; font-family: var(--font-body); font-weight: 500; letter-spacing: 0.02em; }
.media audio { width: 100%; border-radius: 999px; }
.media .score { margin: 1.9rem 0 0; }

.media-note {
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0.55rem 0 0;
}

.media-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--paper-warm);
  padding: 0.12em 0.38em;
  border-radius: 3px;
}

.btn {
  display: inline-block;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.6rem 1.35rem;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.btn:hover { border-color: var(--moss); background: var(--paper-warm); }

.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}

.pagination a { text-decoration: none; color: var(--ink-soft); }
.pagination a:hover { color: var(--ink); }

/* --- About: biography beside the portrait ------------------------------- */

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, var(--measure)) minmax(0, 20rem);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.portrait { margin: 0.4rem 0 0; }

.portrait img {
  width: 100%;
  /* Any photo is cropped to a portrait rather than distorted, so it does
     not matter what proportions the file you drop in happens to have. */
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--paper-warm);
}

.portrait figcaption {
  margin-top: 0.7rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-faint);
}

/* One column below the point where two would squeeze the text, with the
   portrait moved up under the heading rather than stranded at the bottom. */
@media (max-width: 56rem) {
  .about-layout { grid-template-columns: minmax(0, 1fr); }
  .portrait { order: -1; max-width: 17rem; margin-bottom: 1rem; }
}

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

.contact-card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: var(--measure);
}

.email {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  word-break: break-word;
}

.email:hover { border-bottom-color: var(--clay); }

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

.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink-soft); }

/* --- Utility ------------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 10;
  background: var(--moss);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  transition: top 140ms ease;
}

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