/* ============================================================
   Veresa Eybl — site styles
   Layout logic translated from the Tumblr theme: fixed header,
   slide-out menu with labelled columns, floating index, grid
   overview pages.

   Fonts, sizes and colours are NOT set here — they come from
   src/_data/theme.json (see the <style> block in each page).
   ============================================================ */

:root {
  --rule: var(--ink);
  /* lines & borders — set in theme.json → "lines" */
  --line: var(--line-w, 1px) var(--line-style, solid) var(--line-color, var(--ink));
  --line-faint: var(--line-w, 1px) var(--line-style, solid) color-mix(in srgb, var(--line-color, var(--ink)) 35%, transparent);
  --panel: color-mix(in srgb, var(--bg) 92%, transparent);   /* was #ffffffdb */
  --faint: color-mix(in srgb, var(--ink) 18%, transparent);
  --side: 10vw;               /* the theme's 80vw column with 10vw margins */
  --header-h: calc(var(--s-name) * 1.1 + var(--s-menu) * 1.5 + 3.4rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: var(--s-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { display: block; max-width: 100%; height: auto; }
picture { display: block; }
h1, h2, h3 { font-family: var(--f-name); }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.meta, .nctitle, .page-kind, .work-facts dt, .news-date,
.a-type, .a-col, .a-mat, .a-av, .site-footer, .work-pager, .caption-meta, .caption-go {
  font-family: var(--f-details);
  font-size: var(--s-details);
}

/* ---------- header (was: header fixed, left:10vw, width:80vw) ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: var(--side);
  width: calc(100vw - 2 * var(--side));
  padding-top: 2.2rem;
  padding-bottom: 1.2rem;
  z-index: 100;
  animation: fade 0.6s ease both;
}
/* a band in the page colour behind the header, full width, fading out at
   its lower edge — works scroll up and disappear behind it */
.site-header::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -2.5rem;
  left: calc(-1 * var(--side));
  right: calc(-1 * var(--side));
  background: linear-gradient(to bottom, var(--bg) calc(100% - 2.5rem), transparent);
  z-index: -1;
  pointer-events: none;
}
.site-name {
  display: inline-block;
  font-family: var(--f-name);
  font-size: var(--s-name);
  font-weight: 700;
  text-transform: var(--name-case);
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.site-name:hover { color: var(--ink); }

.site-nav {
  display: flex;
  align-items: flex-start;
  gap: 1.6em;
  margin-top: 0.7rem;
  font-family: var(--f-menu);
  font-size: var(--s-menu);
  text-transform: var(--menu-case);
}
.site-nav > a, .expand-menu {
  font: inherit;
  color: inherit;
  text-transform: inherit;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.site-nav > a:hover, .expand-menu:hover, .site-nav > a[aria-current] { text-decoration: underline; }
/* the thin chevron from the old theme: › closed, turns down when open */
.expand-menu::after {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-left: 0.45em;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-0.12em) rotate(-45deg);
  transition: transform 0.25s;
}
.expand-menu[aria-expanded="true"]::after { transform: translateY(-0.25em) rotate(45deg); }
.site-nav > a.nav-available { color: var(--accent); }
.nav-available .dot { margin: 0 0.4em 0 0; }
.site-name .logo { display: block; height: var(--s-name); width: auto; }

/* ---------- the slide-out Works panel (was: .navtoggle / .hidemenu) ---------- */

.navtoggle { position: relative; }
.hidemenu {
  position: absolute;
  left: -1rem;
  top: 1.9em;
  display: grid;
  grid-template-rows: 0fr;              /* slid closed */
  transition: grid-template-rows 0.35s ease;
  background: var(--panel);
  white-space: nowrap;
  width: max-content;
}
.navtoggle.open .hidemenu { grid-template-rows: 1fr; }   /* slid open */
.hidemenu-inner {
  overflow: hidden;
  display: flex;
  gap: 2.5em;
  padding: 0 1rem;
}
.navtoggle.open .hidemenu-inner { padding: 1rem 1rem 1.4rem; border: var(--line); }
.navcat ul { list-style: none; margin: 0; padding: 0; }
.navcat li { margin: 0.12em 0; }
.navcat a { text-decoration: none; }
.navcat a:hover { text-decoration: underline; }
.nctitle { margin: 0 0 0.6rem; opacity: 0.6; text-transform: lowercase; }

/* ---------- home: interlocking floating posts ---------- */

#posts {
  width: calc(100vw - 2 * var(--side));
  margin: 0 auto;
  animation: fade 0.6s 0.4s ease both;
}
#posts.floating {
  container-type: inline-size;          /* 100cqw = width of the column */
  margin-top: calc(var(--header-h) + 3rem);
}
.float-field { position: relative; height: calc(var(--h) * 1cqw); }
.floating .post {
  position: absolute;
  left: calc(var(--l) * 1cqw);
  top: calc(var(--t) * 1cqw);
  width: calc(var(--w) * 1cqw);
}
.floating .post img { width: 100%; }
.post-link { display: block; position: relative; text-decoration: none; }

/* title under each image; blue dot = available */
.floating .caption { margin: 0.55em 0 0; line-height: 1.35; }
.post-link:hover .caption-title { text-decoration: underline; }
.dot {
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 0.08em;
  margin-left: 0.15em;
}
.featured .caption-title { font-size: 1.15em; }

/* ---------- overview pages (was: TagPage grid) ---------- */

.page-title {
  width: calc(100vw - 2 * var(--side));
  margin: 0 auto;
  padding-top: calc(var(--header-h) + 2.5rem);
  font-size: calc(var(--s-name) * 0.8);
  font-weight: 700;
  line-height: 1.05;
  border-bottom: var(--line);
  padding-bottom: 0.6rem;
}
.page-kind { display: block; font-weight: 400; text-transform: lowercase; margin-bottom: 0.5rem; }
#posts.grid { display: flex; flex-wrap: wrap; gap: 0 5%; margin-top: 2.5rem; }
.grid .post { width: 30%; padding-bottom: 3rem; }
.grid .post a { text-decoration: none; }
.grid .post img { width: 100%; height: 50vh; object-fit: cover; }
.grid .caption { margin-top: 0.7rem; display: flex; flex-direction: column; gap: 0.25rem; }
.caption-text { opacity: 0.8; }
.price { font-weight: 700; }
.sold { text-transform: lowercase; text-decoration: line-through; opacity: 0.6; }
.work-price.sold { text-decoration: none; }
.grid .post a:hover .caption-title { text-decoration: underline; }
.empty { width: calc(100vw - 2 * var(--side)); margin: 2rem auto; }

/* ---------- single work (was: PermalinkPage) ---------- */

.work {
  width: calc(100vw - 2 * var(--side));
  margin: 0 auto;
  padding-top: calc(var(--header-h) + 2.5rem);
  display: grid;
  grid-template-columns: minmax(0, 58fr) minmax(0, 42fr);
  gap: 4vw;
  align-items: start;
}
.work-images { display: flex; flex-direction: column; gap: 2rem; }
.work-info { position: sticky; top: calc(var(--header-h) + 1rem); }
.work-title { margin: 0 0 1.2rem; font-size: calc(var(--s-name) * 0.65); font-weight: 700; line-height: 1.1; }
.work-facts { display: grid; grid-template-columns: 7.5em 1fr; margin: 0; border-top: var(--line); }
.work-facts dt, .work-facts dd { margin: 0; padding: 0.45rem 0; border-bottom: var(--line); }
.work-facts dt { padding-top: 0.6rem; }
.work-text { margin-top: 1.4rem; max-width: 38em; }
.work-text p { margin: 0 0 0.8em; }
.work-enquire { margin-top: 1.8rem; }
.work-price { font-size: 1.4em; font-weight: 700; margin: 0 0 0.8rem; }
.variants { border-collapse: collapse; margin-bottom: 1rem; width: 100%; }
.variants td { border-bottom: var(--line); padding: 0.35rem 0; }
.variants td:last-child { text-align: right; font-weight: 700; }
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  padding: 0.7rem 1.1rem;
  font-family: var(--f-menu);
  font-weight: 700;
}
.button:hover { background: var(--ink); color: var(--bg); }
.work-pager {
  width: calc(100vw - 2 * var(--side));
  margin: 4rem auto 0;
  padding-top: 0.8rem;
  border-top: var(--line);
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

/* ---------- archive (the hidden #postindex from the theme, made visible) ---------- */

.archive-year { width: calc(100vw - 2 * var(--side)); margin: 2.5rem auto 0; scroll-margin-top: calc(var(--header-h) + 1rem); }
.archive-year h2 { font-size: 1.4em; margin: 0 0 0.4rem; }
.archive-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.archive-table td { border-top: var(--line); padding: 0.4rem 1rem 0.4rem 0; vertical-align: top; }
.archive-table tr:last-child td { border-bottom: var(--line); }
.a-title { width: 34%; font-weight: 700; }
.a-type { width: 12%; } .a-col { width: 20%; } .a-mat { width: 24%; } .a-av { width: 10%; }
.a-type, .a-col, .a-mat, .a-av { padding-top: 0.55rem !important; }
.a-av { color: var(--accent); text-align: right; padding-right: 0 !important; }

/* ---------- news & about ---------- */

.news-list, .news-empty, .about { width: calc(100vw - 2 * var(--side)); margin: 2rem auto 0; }
.news-item { display: grid; grid-template-columns: 14rem 1fr; gap: 2rem; border-top: var(--line); padding: 1rem 0 2rem; }
.news-date { margin: 0; }
.news-body h2 { margin: 0 0 0.5rem; font-size: 1.3em; }
.news-body p { margin: 0 0 0.6em; max-width: 38em; }

.about { max-width: 52rem; margin-left: var(--side); }
.about h2 { font-size: 1.2em; margin: 2.5rem 0 0.6rem; border-bottom: var(--line); padding-bottom: 0.3rem; }
.about table { border-collapse: collapse; width: 100%; }
.about thead { display: none; }
.about td { padding: 0.3rem 1.2rem 0.3rem 0; vertical-align: top; border-bottom: var(--line-faint); }
.about td:first-child { font-family: var(--f-details); font-size: var(--s-details); width: 5rem; padding-top: 0.45rem; }
.about-bio p { font-size: 1.25em; line-height: 1.4; max-width: 32em; }
section[id] { scroll-margin-top: calc(var(--header-h) + 1rem); }

/* ---------- footer & back to top ---------- */

.site-footer {
  width: calc(100vw - 2 * var(--side));
  margin: 6rem auto 0;
  padding: 1rem 0 2rem;
  border-top: var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.site-footer p { margin: 0; }

#scroll-top {
  position: fixed;
  right: 15px;
  bottom: 15px;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font: 700 1.1rem var(--f-menu);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
  z-index: 50;
}
#scroll-top.show { opacity: 1; pointer-events: auto; }
#scroll-top:hover { background: var(--ink); color: var(--bg); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- small screens (was: max-width 750px) ---------- */

@media (max-width: 750px) {
  :root { --side: 16px; --header-h: 0rem; }

  .site-header {
    position: sticky;
    left: 0;
    width: 100%;
    padding: 1rem var(--side) 0.8rem;
    background: var(--bg);
    border-bottom: var(--line);
  }
  .site-header::before { display: none; }
  .site-name { font-size: min(var(--s-name), 9vw); }
  .site-nav { gap: 1.1em; flex-wrap: wrap; }
  .navtoggle { position: static; }
  .hidemenu { position: absolute; left: 0; right: 0; top: 100%; width: auto; }
  .hidemenu-inner { flex-direction: column; gap: 1.2rem; padding: 0 var(--side); white-space: normal; }
  .navtoggle.open .hidemenu-inner { padding: 1rem var(--side) 1.4rem; border: 0; border-bottom: var(--line); }
  .navcat ul { display: flex; flex-wrap: wrap; gap: 0.2em 1.1em; }

  /* phones: one column in the same order, staggered a little */
  #posts.floating { margin-top: 1.5rem; container-type: normal; }
  .float-field { height: auto; }
  .floating .post { position: static; width: 82%; margin: 0 0 2.5rem; }
  .floating .post:nth-child(2n) { margin-left: auto; }
  .floating .post:nth-child(3n), .floating .post.featured { width: 100%; }

  .page-title { padding-top: 2rem; }
  .grid .post { width: 100%; }
  .grid .post img { height: auto; }
  .work { grid-template-columns: 1fr; padding-top: 1.5rem; gap: 2rem; }
  .work-info { position: static; }
  .news-item { grid-template-columns: 1fr; gap: 0.4rem; }
  .about { margin-left: auto; }
  .archive-table, .archive-table tbody, .archive-table tr, .archive-table td { display: block; }
  .archive-table tr { border-top: var(--line); padding: 0.4rem 0; }
  .archive-table td { width: auto !important; border: 0 !important; padding: 0 !important; text-align: left !important; }
  .site-footer { flex-direction: column; }
}
