/* ---------------------------------------------------------------------------
   Rayne portfolio — public site
   Gallery-first: the chrome stays quiet so the work carries the page.
   --------------------------------------------------------------------------- */

:root {
  --accent: #b4633a;

  --paper:      #faf9f7;
  --paper-alt:  #f2efe9;
  --ink:        #1b1a18;
  --ink-soft:   #5f5b54;
  --ink-faint:  #8d887f;
  --rule:       #e2ded6;
  --shadow:     0 1px 2px rgba(27, 26, 24, .05), 0 8px 24px rgba(27, 26, 24, .07);
  --shadow-lift:0 2px 4px rgba(27, 26, 24, .07), 0 18px 44px rgba(27, 26, 24, .14);

  --serif: ui-serif, Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --wrap: 1240px;
  --step: clamp(1rem, .6rem + 1.6vw, 1.75rem);
}

[data-theme="dark"] {
  --paper:     #131211;
  --paper-alt: #1b1a18;
  --ink:       #f0ede8;
  --ink-soft:  #b0aaa1;
  --ink-faint: #7d776e;
  --rule:      #302d29;
  --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .6);
}

@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --paper:     #131211;
    --paper-alt: #1b1a18;
    --ink:       #f0ede8;
    --ink-soft:  #b0aaa1;
    --ink-faint: #7d776e;
    --rule:      #302d29;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, .5), 0 18px 44px rgba(0, 0, 0, .6);
  }
}

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

/* The hidden attribute must beat any display rule a class sets
   (a .btn is display:inline-flex, which otherwise wins over [hidden]). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

/* Clipped rather than pushed off-canvas, which would widen the page. */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  background: var(--ink);
  color: var(--paper);
  padding: .7rem 1.1rem;
  z-index: 100;
}
.skip-link:focus {
  width: auto;
  height: auto;
  clip: auto;
  left: 1rem;
  top: 1rem;
}

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

/* -- Masthead ------------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

/* min-width:0 lets the brand shrink; without it the long tagline sets a
   floor on the flex item's width and pushes the whole page sideways. */
.brand {
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: .75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 1.35rem;
  letter-spacing: .01em;
}

.brand-tagline {
  color: var(--ink-faint);
  font-size: .8rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.masthead-nav { display: flex; gap: 1.5rem; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase; }
.masthead-nav a { text-decoration: none; color: var(--ink-soft); padding-bottom: 2px; border-bottom: 1px solid transparent; }
.masthead-nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* -- Intro ---------------------------------------------------------------- */

/* Left-aligned with the gallery below it, not centred in the page. */
.intro { padding: clamp(3rem, 9vw, 7rem) 0 clamp(1.5rem, 4vw, 3rem); }

.intro h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.75rem);
  line-height: 1.03;
  letter-spacing: -.02em;
  margin: 0;
  max-width: 15ch;
}

.intro-tagline {
  margin: 1.1rem 0 0;
  color: var(--ink-soft);
  font-size: 1.06rem;
  max-width: 42ch;
}

/* -- Category filters ----------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0 0 2.25rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.25rem;
}

.filter {
  font: inherit;
  font-size: .875rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .45rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  transition: color .18s, border-color .18s, background-color .18s;
}
.filter:hover { color: var(--ink); border-color: var(--ink-faint); }
.filter.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}
.filter .count { font-size: .72rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.filter.is-active .count { color: color-mix(in srgb, var(--paper) 65%, transparent); }

/* -- Gallery -------------------------------------------------------------- */

/* Column-flow masonry keeps mixed portrait/landscape work from being cropped. */
.gallery {
  columns: 4 260px;
  column-gap: var(--step);
  padding-bottom: 4rem;
}

.piece {
  margin: 0 0 var(--step);
  break-inside: avoid;
  page-break-inside: avoid;
}

.piece.is-hidden { display: none; }

.piece-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--paper-alt);
  cursor: zoom-in;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .28s ease, transform .28s ease;
}
.piece-btn img { width: 100%; height: auto; transition: opacity .28s ease; }
.piece-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.piece-btn:hover img { opacity: .93; }

figcaption {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .7rem .15rem 0;
}

.piece-title { font-family: var(--serif); font-size: 1rem; }
.piece-meta  { color: var(--ink-faint); font-size: .8rem; }

.no-results {
  text-align: center;
  color: var(--ink-faint);
  padding: 3rem 0 5rem;
  font-style: italic;
}

.empty-state {
  text-align: center;
  padding: clamp(3rem, 10vw, 7rem) 1rem;
  border: 1px dashed var(--rule);
  border-radius: 6px;
  margin-bottom: 4rem;
}
.empty-state h2 { font-family: var(--serif); font-weight: 400; margin: 0 0 .5rem; }
.empty-state p  { color: var(--ink-soft); margin: 0; }
.empty-state a  { color: var(--accent); }

/* -- About ---------------------------------------------------------------- */

.about {
  background: var(--paper-alt);
  border-top: 1px solid var(--rule);
  padding: clamp(3rem, 8vw, 6rem) 0;
}
.about-inner { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 60ch); gap: 2rem; }
.about h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: .35rem 0 0;
}
.bio { font-size: 1.09rem; line-height: 1.75; color: var(--ink-soft); }

@media (max-width: 700px) {
  .about-inner { grid-template-columns: 1fr; gap: .75rem; }
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem 0 3rem;
  font-size: .85rem;
  color: var(--ink-faint);
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }
.admin-link { opacity: .55; }

/* -- Lightbox ------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(14, 13, 12, .93);
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  opacity: 0;
  transition: opacity .22s ease;
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lb-stage {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 100%;
  max-height: 100%;
}

#lb-image {
  max-width: min(1024px, 100%);
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .6);
  background: #0e0d0c;
}

.lb-caption {
  color: #f0ede8;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  max-width: 60ch;
}
.lb-title { font-family: var(--serif); font-size: 1.2rem; }
.lb-meta  { font-size: .82rem; letter-spacing: .07em; text-transform: uppercase; color: #a19b92; }
.lb-description { font-size: .95rem; color: #c9c3ba; line-height: 1.6; }
.lb-caption span:empty { display: none; }

.lb-close, .lb-nav {
  position: absolute;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #f0ede8;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: background-color .18s, border-color .18s;
  line-height: 1;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .34); }

.lb-close {
  top: clamp(.75rem, 3vw, 1.5rem);
  right: clamp(.75rem, 3vw, 1.5rem);
  width: 2.75rem;
  height: 2.75rem;
  font-size: 1.6rem;
}

.lb-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  font-size: 2rem;
  padding-bottom: .22em;
}
.lb-prev { left: clamp(.5rem, 2vw, 1.5rem); }
.lb-next { right: clamp(.5rem, 2vw, 1.5rem); }
.lb-nav[hidden] { display: none; }

@media (max-width: 620px) {
  .lb-nav { width: 2.5rem; height: 2.5rem; font-size: 1.6rem; }
  #lb-image { max-height: 68vh; }
}

/* -- Narrow screens -------------------------------------------------------- */

@media (max-width: 640px) {
  /* The tagline already appears under the artist name in the intro. */
  .brand-tagline { display: none; }
  .masthead-inner { padding: .75rem 0; gap: .75rem; }
  .masthead-nav { gap: 1.1rem; font-size: .8rem; }
  .footer-inner { flex-direction: column; gap: .6rem; }
}

/* A single long word in a title must never widen the page. */
.piece-title, .brand-name, .intro h1, .bio { overflow-wrap: break-word; }

/* -- Artist portrait ------------------------------------------------------- */

/* Label and portrait stack in the narrow column, statement alongside. */
.about-inner.has-portrait {
  align-items: start;
  grid-template-areas:
    "label bio"
    "portrait bio";
  grid-template-rows: auto 1fr;
  row-gap: 1.25rem;
}
.about-inner.has-portrait h2        { grid-area: label; }
.about-inner.has-portrait .portrait { grid-area: portrait; }
.about-inner.has-portrait .bio      { grid-area: bio; }

.portrait {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

@media (max-width: 700px) {
  .about-inner.has-portrait {
    grid-template-areas: "label" "portrait" "bio";
    grid-template-rows: auto auto 1fr;
    row-gap: 1rem;
  }
  .portrait { max-width: 11rem; }
}

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

.contact {
  border-top: 1px solid var(--rule);
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}

/* Same label-plus-content rhythm as the About section. */
.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 60ch);
  gap: 2rem;
  align-items: start;
}

.contact h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: .35rem 0 0;
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .9rem;
}

.contact-list li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
}

.contact-label {
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.contact-list a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  overflow-wrap: anywhere;
  transition: border-color .18s, color .18s;
  justify-self: start;
}
.contact-list a:hover { border-bottom-color: var(--accent); color: var(--accent); }

@media (max-width: 700px) {
  .contact-inner { grid-template-columns: 1fr; gap: 1rem; }
  .contact-list li { grid-template-columns: 1fr; gap: .1rem; }
}
