@import url("https://fonts.googleapis.com/css2?family=UnifrakturCook:wght@700&family=VT323&family=IM+Fell+English:ital@0;1&display=swap");

:root{
  --bg0:#040206;
  --bg1:#0a0610;
  --bg2:#1a1022;

  --frame:#0b0705;
  --frame2:#2a1b12;

  --gold:#d6b46b;
  --gold2:#a98039;

  --paper:#efe0c2;
  --paper2:#e5d2ad;
  --ink: rgba(25,16,8,0.92);

  --link:#f0cf86;
  --link2:#ffe6b2;

  --ui: "VT323", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: "IM Fell English", Georgia, "Times New Roman", serif;
  --title: "UnifrakturCook", "IM Fell English", Georgia, serif;

  --pad: 22px;
  --gap: 18px;
  --rail: 220px;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; min-height:100%; }

body{
  color: var(--paper);
  font-family: var(--serif);
  text-align: left;
  overflow-x: hidden;

  background:
    radial-gradient(circle at 50% 10%, rgba(120,72,180,0.22), rgba(0,0,0,0) 58%),
    radial-gradient(circle at 50% 110%, rgba(255,208,130,0.10), rgba(0,0,0,0) 62%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.028) 0px, rgba(255,255,255,0.028) 1px, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 10px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.028) 0px, rgba(255,255,255,0.028) 1px, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 10px),
    radial-gradient(circle at 50% 50%, var(--bg2) 0%, var(--bg1) 55%, var(--bg0) 100%);
}

body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.11;
  mix-blend-mode: soft-light;
  background-image: url("/images/noise.jpg");
  background-size: 240px 240px;
  background-repeat: repeat;
}

.magic-dust{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.magic-dust span{
  position:absolute;
  width:10px;
  height:10px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,235,190,1), rgba(255,235,190,0));
  filter: drop-shadow(0 0 10px rgba(255,210,130,0.35));
  animation: drift 18s linear infinite;
  opacity: 0;
}
@keyframes drift{
  0%   { transform: translateY(90px) translateX(-30px); opacity: 0; }
  15%  { opacity: 0.75; }
  85%  { opacity: 0.75; }
  100% { transform: translateY(-260px) translateX(70px); opacity: 0; }
}

main{
  position: relative;
  z-index: 2;

  width: min(1040px, calc(100% - 42px));
  margin: 24px auto 44px auto;
  padding: var(--pad);

  background: linear-gradient(180deg, rgba(30,18,12,0.92), rgba(10,6,4,0.94));
  border: 2px solid var(--gold);
  box-shadow:
    0 0 0 3px rgba(0,0,0,0.86),
    0 0 0 6px rgba(214,180,107,0.16),
    0 18px 44px rgba(0,0,0,0.78);

  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail);
  grid-template-areas:
    "header header header"
    "nav    divider rail"
    "nav    intro   rail"
    "nav    feat    rail"
    "nav    nugs    rail"
    ".      footer  .";
  gap: 14px var(--gap);
}

header{
  grid-area: header;
  text-align:center;
  padding-top: 4px;
}
header h1{
  margin:0;
  font-family: var(--title);
  font-weight: 700;

  font-size: clamp(44px, 5.0vw, 72px);
  letter-spacing: 0.03em;
  color: var(--paper2);
  text-shadow:
    0 2px 0 rgba(0,0,0,0.85),
    0 0 18px rgba(214,180,107,0.16);

  max-width: 100%;
  overflow-wrap: anywhere;
}

.tagline{
  margin: 8px 0 0 0;
  font-family: var(--ui);
  font-size: 22px;
  color: rgba(240,207,134,0.95);
  letter-spacing: 0.08em;
}

nav{
  grid-area: nav;

  align-self: start;
  padding: 14px 12px 16px 12px;

  border: 1px solid rgba(214,180,107,0.55);
  background:
    linear-gradient(180deg, rgba(10,6,4,0.92), rgba(25,16,10,0.88)),
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,0.04) 0px,
      rgba(255,255,255,0.04) 1px,
      rgba(0,0,0,0) 1px,
      rgba(0,0,0,0) 12px
    );

  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 8px 18px rgba(0,0,0,0.55);

  display:flex;
  flex-direction:column;
  gap: 8px;

  font-family: var(--ui);
}

nav::before{
  content:"navigation";
  display:block;
  font-size: 26px;
  color: var(--paper2);
  letter-spacing: 0.06em;
  margin: 0 0 6px 0;
}

nav a{
  display:block;
  text-decoration:none;
  color: var(--link);

  padding: 9px 10px;
  border: 1px solid rgba(214,180,107,0.32);
  background: rgba(0,0,0,0.36);

  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  font-size: 22px;
  line-height: 1;
}
nav a:hover{
  color: var(--link2);
  border-color: rgba(214,180,107,0.78);
  background: rgba(214,180,107,0.12);
}
nav a.active{
  color: #130b06;
  background: linear-gradient(180deg, rgba(240,207,134,0.96), rgba(214,180,107,0.90));
  border-color: rgba(0,0,0,0.65);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 0 14px rgba(214,180,107,0.22);
}

.right-rail{
  grid-area: rail;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rail-box{
  border: 1px solid rgba(214,180,107,0.55);
  background:
    radial-gradient(circle at 50% 12%, rgba(255,255,255,0.07), rgba(0,0,0,0) 55%),
    linear-gradient(180deg, rgba(10,6,4,0.92), rgba(25,16,10,0.88));
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 8px 18px rgba(0,0,0,0.55);
  padding: 12px;
}

.rail-title{
  margin: 0 0 10px 0;
  font-family: var(--ui);
  font-size: 24px;
  letter-spacing: 0.06em;
  color: var(--paper2);
  text-transform: lowercase;
}

.rail-note{
  margin: 10px 0 0 0;
  font-family: var(--ui);
  font-size: 18px;
  color: rgba(229,210,173,0.86);
  line-height: 1.25;
}

.rail-list{
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.rail-list a{
  font-family: var(--ui);
  font-size: 20px;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(214,180,107,0.28);
  padding-bottom: 2px;
}
.rail-list a:hover{
  color: var(--link2);
  border-bottom-color: rgba(214,180,107,0.8);
}

.divider{
  grid-area: divider;
  height: 2px;
  width: 100%;
  margin: 0;
  background: linear-gradient(to right, rgba(0,0,0,0), rgba(214,180,107,0.85), rgba(0,0,0,0));
  position: relative;
}
.divider::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(214,180,107,0.9);
  background: rgba(10,6,4,0.9);
  box-shadow: 0 0 10px rgba(214,180,107,0.22);
}

.home-intro{ grid-area: intro; }
.home-featured{ grid-area: feat; }
.home-fragments{ grid-area: nugs; }

.home-intro,
.home-featured,
.home-fragments{
  background:
    radial-gradient(circle at 30% 10%, rgba(255,255,255,0.22), rgba(0,0,0,0) 55%),
    repeating-linear-gradient(
      to bottom,
      rgba(120, 85, 45, 0.08) 0px,
      rgba(120, 85, 45, 0.08) 1px,
      rgba(0,0,0,0) 1px,
      rgba(0,0,0,0) 16px
    ),
    linear-gradient(180deg, rgba(239,224,194,0.98), rgba(229,210,173,0.98));
  color: var(--ink);

  border: 1px solid rgba(0,0,0,0.22);
  box-shadow: 0 16px 34px rgba(0,0,0,0.35);
  padding: 18px 22px;
  margin: 0;
}

h2, h3{
  font-family: var(--serif);
  letter-spacing: 0.03em;
}

/* Home bits */
.home-welcome-title{
  margin: 0 0 10px 0;
  font-size: 32px;
  text-align: center;
  color: rgba(25,16,8,0.95);
}
.home-welcome-text{
  margin: 10px 0 0 0;
  font-size: 19px;
  line-height: 1.65;
}

.home-featured-title{
  margin: 0;
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-featured-subtitle{
  margin: 8px 0 0 0;
  text-align: center;
  font-size: 18px;
  opacity: 0.9;
}

.home-featured-grid{
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.featured-item{
  text-decoration: none;
  color: inherit;
  width: 160px;
}

.featured-cover-wrap{
  padding: 10px;
  background: rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.featured-cover{
  width: 100%;
  height: auto;
  display: block;
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.75),
    0 10px 18px rgba(0,0,0,0.35);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.featured-item:hover .featured-cover{
  transform: translateY(-2px);
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.75),
    0 14px 22px rgba(0,0,0,0.40);
}
.featured-item:hover .featured-cover-wrap{
  border-color: rgba(214,180,107,0.65);
  box-shadow:
    0 0 0 2px rgba(214,180,107,0.20),
    inset 0 0 0 1px rgba(255,255,255,0.12);
}

.home-subheading{
  margin: 0 0 12px 0;
  text-align: center;
  font-size: 28px;
}

.fragment-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.fragment-link{
  text-decoration: none;
  color: inherit;
  display: block;
}

.fragment{
  height: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(0,0,0,0.22);
  background:
    radial-gradient(circle at 50% 10%, rgba(0,0,0,0.05), rgba(0,0,0,0) 55%),
    rgba(255,255,255,0.20);
  box-shadow: 0 10px 18px rgba(0,0,0,0.18);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.fragment:hover{
  border-color: rgba(214,180,107,0.75);
  box-shadow: 0 12px 22px rgba(0,0,0,0.22);
  transform: translateY(-2px);
}

.fragment-text{
  margin: 0 0 10px 0;
  font-size: 18px;
  line-height: 1.6;
}

.fragment-note{
  margin: 0;
  font-family: var(--ui);
  font-size: 18px;
  opacity: 0.85;
}

footer{
  grid-area: footer;
  text-align: center;
  padding-top: 6px;
}
footer p{
  margin: 0;
  font-family: var(--ui);
  font-size: 20px;
  color: rgba(240,207,134,0.90);
  letter-spacing: 0.06em;
}
.footer-icon{
  height: 2.2em;
  vertical-align: middle;
  margin: 0 0.35rem;
  filter: drop-shadow(0 0 6px rgba(214,180,107,0.25));
}

.curio-card{
  border: 1px solid rgba(214,180,107,0.32);
  background: rgba(0,0,0,0.38);
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.curio-label{
  font-family: var(--ui);
  font-size: 18px;
  letter-spacing: 0.12em;
  color: rgba(240,207,134,0.95);
  margin-bottom: 6px;
}

.curio-link{
  display: inline-block;
  font-family: var(--ui);
  font-size: 20px;
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid rgba(214,180,107,0.35);
  padding-bottom: 2px;
}

.curio-link:hover{
  color: var(--link2);
  border-bottom-color: rgba(214,180,107,0.85);
}

.curio-text{
  margin: 8px 0 0 0;
  font-size: 18px;
  line-height: 1.3;
  color: rgba(229,210,173,0.88);
}

/* Library page content */
.library-intro{
  margin: 0 0 14px 0;
  text-align: center;
  font-size: 19px;
  line-height: 1.55;
}

.bookshelves{
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.shelf-row{
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;

  padding: 14px 12px 26px 12px;
  position: relative;
}

.shelf-row::after{
  content:"";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  height: 12px;

  background:
    linear-gradient(180deg, rgba(120,85,45,0.80), rgba(70,45,22,0.85));
  border: 1px solid rgba(0,0,0,0.28);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 6px 10px rgba(0,0,0,0.22);
}

.book{
  display: block;
  width: 140px;
  text-decoration: none;
}

.book img{
  width: 100%;
  height: auto;
  display: block;

  border: 1px solid rgba(0,0,0,0.35);
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.70),
    0 10px 16px rgba(0,0,0,0.28);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.book:hover img{
  transform: translateY(-3px);
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.70),
    0 14px 22px rgba(0,0,0,0.38);
  filter: saturate(1.05);
}

.shelf-row:has(.book:nth-child(1)):not(:has(.book:nth-child(2))){
  justify-content: flex-start;
}
.shelf-row:has(.book:nth-child(1)):not(:has(.book:nth-child(2))) .book{
  width: 160px;
}

/* Left-nav subnav (nested under active nav item only) */
nav .subnav{
  margin: 4px 0;
  padding: 0 0 0 14px;
  border: 0;
  background: transparent;
  box-shadow: none;

  display: flex;
  flex-direction: column;
  gap: 6px;

  opacity: 0.98;
}

nav .subnav a{
  position: relative;
  display: block;

  font-size: 20px;
  line-height: 1;
  padding: 8px 10px 8px 30px;
  margin: 0;

  background: rgba(0,0,0,0.14);
  border: 1px solid rgba(214,180,107,0.16);
  color: rgba(240,207,134,0.92);
  text-decoration: none;

  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.012);
}

nav .subnav a::before{
  content: "↳";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(229,210,173,0.70);
}

nav .subnav a:hover{
  background: rgba(214,180,107,0.08);
  border-color: rgba(214,180,107,0.55);
  color: var(--link2);
}

nav .subnav a.active{
  background: rgba(214,180,107,0.10);
  border-color: rgba(214,180,107,0.85);
  color: var(--link2);
  box-shadow:
    inset 0 0 0 1px rgba(240,207,134,0.20),
    0 0 8px rgba(214,180,107,0.08);
}

nav a.active + .subnav{
  margin-top: 4px;
  margin-bottom: 4px;
}

/* Gallery page layout + top tabs subnav
   IMPORTANT: uses > .subnav so it doesn't affect nav .subnav */
main:has(.gallery-lobby){
  grid-template-columns: var(--rail) minmax(0, 1fr) var(--rail);
  grid-template-areas:
    "header header header"
    "nav    subnav  rail"
    "nav    divider rail"
    "nav    content rail"
    ".      footer  .";
}

main:has(.gallery-lobby) > .subnav{
  grid-area: subnav;
  align-self: start;
  justify-self: start;

  display: flex;
  flex-wrap: wrap;
  gap: 12px;

  margin: 2px 0 0 0;
  padding: 0;

  font-family: var(--ui);
}

main:has(.gallery-lobby) > .subnav a{
  display: inline-block;

  font-size: 20px;
  line-height: 1;
  padding: 10px 14px;

  color: var(--link);
  text-decoration: none;

  border: 1px solid rgba(214,180,107,0.34);
  background: rgba(0,0,0,0.30);

  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

main:has(.gallery-lobby) > .subnav a:visited{
  color: var(--link);
}

main:has(.gallery-lobby) > .subnav a:hover{
  color: var(--link2);
  border-color: rgba(214,180,107,0.78);
  background: rgba(214,180,107,0.12);
}

main:has(.gallery-lobby) > .subnav a.active{
  color: #130b06;
  background: linear-gradient(180deg, rgba(240,207,134,0.96), rgba(214,180,107,0.90));
  border-color: rgba(0,0,0,0.65);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    0 0 14px rgba(214,180,107,0.22);
}

main:has(.gallery-lobby) .divider{ grid-area: divider; }
main:has(.gallery-lobby) .gallery-lobby{ grid-area: content; }

/* Gallery lobby content */
.gallery-intro{
  margin: 0 0 16px 0;
  font-size: 20px;
  line-height: 1.6;
  color: rgba(229,210,173,0.92);
}

.lobby-grid{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0 22px 0;
}

.lobby-card{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  padding: 18px 14px;
  text-decoration: none;

  border: 1px solid rgba(214,180,107,0.28);
  background: rgba(255,255,255,0.04);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.03),
    0 12px 26px rgba(0,0,0,0.35);

  border-radius: 18px;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.lobby-card,
.lobby-card:visited{
  color: inherit;
}

.lobby-card:hover{
  transform: translateY(-2px);
  border-color: rgba(214,180,107,0.65);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.04),
    0 16px 34px rgba(0,0,0,0.42);
}

.lobby-icon{
  font-size: 30px;
  line-height: 1;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 10px rgba(214,180,107,0.18));
}

.lobby-card h2{
  margin: 0 0 8px 0;
  font-size: 22px;
  color: rgba(239,224,194,0.96);
}

.lobby-card p{
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.45;
  color: rgba(229,210,173,0.80);
}

.featured-photo{
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.featured-image{
  position: relative;
  width: min(760px, 100%);
  margin: 0;

  border-radius: 18px;
  overflow: hidden;

  border: 1px solid rgba(214,180,107,0.30);
  box-shadow: 0 18px 44px rgba(0,0,0,0.55);
  background: rgba(0,0,0,0.25);
}

.featured-image a{ display: block; }

.featured-image img{
  display: block;
  width: 100%;
  height: auto;
}

.featured-label{
  position: absolute;
  top: 12px;
  left: 12px;

  font-family: var(--ui);
  font-size: 18px;
  letter-spacing: 0.08em;

  color: rgba(25,16,8,0.92);
  background: rgba(214,180,107,0.92);
  border: 1px solid rgba(0,0,0,0.55);

  padding: 6px 10px;
  border-radius: 999px;

  box-shadow: 0 10px 18px rgba(0,0,0,0.35);
}

.featured-caption{
  margin: 0;
  padding: 12px 14px;

  font-size: 16px;
  line-height: 1.35;

  color: rgba(239,224,194,0.92);
  background: rgba(0,0,0,0.45);

  border-top: 1px solid rgba(214,180,107,0.20);
}

@media (max-width: 980px){
  main{
    grid-template-columns: 200px minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "nav    divider"
      "nav    intro"
      "nav    feat"
      "nav    nugs"
      ".      footer";
  }
  .right-rail{ display:none; }

  main:has(.gallery-lobby){
    grid-template-columns: 200px minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "nav    subnav"
      "nav    divider"
      "nav    content"
      ".      footer";
  }

  .lobby-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px){
  main{
    width: min(900px, calc(100% - 26px));
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "nav"
      "divider"
      "intro"
      "feat"
      "nugs"
      "footer";
  }

  nav{
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 10px;
  }
  nav::before{ display:none; }

  nav a{
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 20px;
    padding: 10px 12px;
  }

  .fragment-grid{
    grid-template-columns: 1fr;
  }

  main:has(.gallery-lobby){
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "nav"
      "subnav"
      "divider"
      "content"
      "footer";
  }

  main:has(.gallery-lobby) > .subnav{
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .lobby-grid{
    grid-template-columns: 1fr;
  }

  .book{ width: 150px; }
  .shelf-row{ padding-bottom: 28px; }
}