/* brackenmoor.org, in the game's own look: parchment pinned in oak frames
   with iron corners, brass plaques, carved buttons, and lettering in IM Fell
   English. The colours are the game's (crates/client/src/ui/paint.rs). At
   dusk the page darkens with the pictures, and the boards stay candlelit. */

@font-face {
  font-family: "IM Fell English";
  src: url("fonts/IMFeENrm28P.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "IM Fell English";
  font-style: italic;
  src: url("fonts/IMFeENit28P.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #3b2a1c;
  --soft-ink: #6a4a2c;
  --cream: #f3e7cb;
  --oak-light: #7a5431;
  --oak-dark: #4c321d;
  --oak-edge: #24160c;
  --brass-top: #ecc86a;
  --brass-foot: #b4842c;
  --rule: rgba(138, 100, 56, 0.7);
  --serif: "IM Fell English", Georgia, "Times New Roman", serif;
  --hang: clamp(2.6rem, 9vh, 5.5rem);

  /* By day. */
  --page-top: #ecdcb8;
  --page: #e2cfa6;
  --page-foot: #d3bb8c;
  --page-ink: var(--ink);
  --parchment-top: #f4e8cc;
  --parchment-foot: #e8d5ae;
  --moon: block;
  --sun: none;
}

/* At dusk: the visitor's choice, or their system's when they haven't chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-time="day"]) {
    color-scheme: dark;
    --page-top: #3d2b3f;
    --page: #2a1f2d;
    --page-foot: #18121b;
    --page-ink: var(--cream);
    --parchment-top: #ecdcb8;
    --parchment-foot: #d8c095;
    --moon: none;
    --sun: block;
  }
}

:root[data-time="dusk"] {
  color-scheme: dark;
  --page-top: #3d2b3f;
  --page: #2a1f2d;
  --page-foot: #18121b;
  --page-ink: var(--cream);
  --parchment-top: #ecdcb8;
  --parchment-foot: #d8c095;
  --moon: none;
  --sun: block;
}

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

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

body {
  margin: 0;
  background: linear-gradient(var(--page-top), var(--page) 35%, var(--page-foot)) var(--page);
  color: var(--page-ink);
  font: 1.25rem/1.55 var(--serif);
  transition: background-color 0.6s;
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: normal;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.9rem, 4vw, 2.4rem);
  text-align: center;
}

h3 {
  font-size: 1.45rem;
}

p {
  margin: 0.9em 0 0;
}

/* Oak, lit from above, with a grain running along it. */
.oak {
  background:
    repeating-linear-gradient(179.4deg, rgba(41, 26, 13, 0.13) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(180.5deg, rgba(41, 26, 13, 0.09) 0 1px, transparent 1px 11px),
    linear-gradient(var(--oak-light), var(--oak-dark));
  border: 2px solid var(--oak-edge);
  box-shadow: inset 0 0 0 2px rgba(165, 124, 79, 0.55), 5px 8px 18px rgba(20, 12, 5, 0.32);
}

/* A board: parchment pinned in an oak frame, with an iron bracket over each corner. */
.board {
  position: relative;
  padding: 17px;
  border-radius: 12px;
  color: var(--ink);
}

.board::before,
.board::after {
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  height: 40px;
  pointer-events: none;
}

.board::before {
  top: -2px;
  background: url("art/corner-nw.svg") left top / 40px no-repeat, url("art/corner-ne.svg") right top / 40px no-repeat;
}

.board::after {
  bottom: -2px;
  background: url("art/corner-sw.svg") left bottom / 40px no-repeat, url("art/corner-se.svg") right bottom / 40px no-repeat;
}

/* The parchment, a shade darker toward its foot, with a burnt edge and the frame's lip shading its top. */
.sheet {
  height: 100%;
  padding: 1.6rem clamp(1.2rem, 4vw, 2.4rem) 1.9rem;
  border: 1px solid rgba(58, 38, 22, 0.8);
  border-radius: 4px;
  background: linear-gradient(var(--parchment-top), var(--parchment-foot));
  box-shadow:
    inset 0 3px 0 rgba(51, 31, 13, 0.18),
    inset 0 0 3px 2px rgba(140, 97, 46, 0.16),
    inset 0 0 12px 4px rgba(140, 97, 46, 0.1);
}

/* A thin ruled line with a diamond at its middle, under a heading. */
.rule {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.1rem auto 0;
  max-width: 22rem;
}

.rule::before,
.rule::after {
  content: "";
  flex: 1;
  height: 1.5px;
  border-radius: 1px;
  background: var(--rule);
}

.rule span {
  width: 9px;
  height: 9px;
  transform: rotate(45deg);
  background: var(--rule);
}

/* A brass plaque. */
.plaque {
  display: table;
  padding: 0.45rem 1.4rem 0.5rem;
  border: 2px solid var(--oak-edge);
  border-radius: 9px;
  background: linear-gradient(var(--brass-top), var(--brass-foot));
  box-shadow: inset 0 0 0 1px rgba(255, 242, 204, 0.35), 3px 5px 10px rgba(20, 12, 5, 0.3);
  color: var(--ink);
  font-size: 1.15rem;
  text-align: center;
}

/* Iron chain, hanging. */
.chained::before,
.chained::after {
  content: "";
  position: absolute;
  top: calc(-1 * var(--chain));
  width: 12px;
  height: calc(var(--chain) + 10px);
  background: url("art/chain.svg") center bottom / 12px 24px repeat-y;
}

.chained::before {
  left: 18%;
}

.chained::after {
  right: 18%;
}

/* The opening picture, and the sign hung over it. */
.hero {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: max(34rem, 94svh);
  overflow: hidden;
  border-bottom: 3px solid var(--oak-edge);
}

.hero-picture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 68% 50%;
}

.sign {
  --chain: var(--hang);
  position: relative;
  width: min(44rem, calc(100% - 32px));
  margin-top: var(--hang);
  transform-origin: 50% calc(-1 * var(--hang));
  animation: sway 9s ease-in-out infinite alternate;
}

.sign .sheet {
  padding: 1.3rem clamp(1rem, 5vw, 3.2rem) 1.5rem;
  text-align: center;
}

.sign h1 {
  font-size: clamp(3rem, 10vw, 6.2rem);
  letter-spacing: 0.01em;
}

.tagline {
  margin: 0.4rem auto 0;
  max-width: 30rem;
  color: var(--soft-ink);
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  font-style: italic;
  line-height: 1.35;
}

.sign .plaque {
  --chain: 26px;
  position: relative;
  margin: 26px auto 0;
}

@keyframes sway {
  from {
    transform: rotate(-0.45deg);
  }

  to {
    transform: rotate(0.45deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sign {
    animation: none;
  }
}

/* The switch between day and dusk: a round carved button, always to hand. */
.time {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1.6px solid var(--oak-edge);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #a67c4c, #5a3d24);
  box-shadow: 0 2px 0 rgba(20, 12, 5, 0.3), 2px 4px 10px rgba(20, 12, 5, 0.35);
  color: var(--cream);
  cursor: pointer;
}

.time:hover {
  background: radial-gradient(circle at 32% 30%, #c29560, #6c4a2c);
  box-shadow: 0 0 0 3px rgba(255, 241, 196, 0.75);
}

.time:active {
  background: radial-gradient(circle at 32% 30%, #7a5634, #3e281a);
}

.time svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.time .moon {
  display: var(--moon);
  stroke: none;
}

.time .sun {
  display: var(--sun);
}

:focus-visible {
  outline: 3px solid #e2b23c;
  outline-offset: 3px;
}

/* The page below. */
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

main > section {
  margin-top: clamp(3.5rem, 8vw, 6rem);
}

.narrow {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
}

.intro .sheet {
  text-align: center;
}

/* The first skills, each a picture of it being done. */
.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 2rem;
  margin: 1.8rem 0 0;
  padding: 0;
  list-style: none;
}

.skills .sheet {
  padding: 12px 12px 1.4rem;
}

/* Whole, with the game's own boards and chat at the edges, as a player sees it. */
.skills img {
  width: 100%;
  border: 1px solid var(--oak-edge);
  border-radius: 2px;
}

.skills h3 {
  margin: 1rem 0.6rem 0;
}

.skills p {
  margin: 0.4rem 0.6rem 0;
  color: var(--soft-ink);
}

/* Two by two, or one above another where it's narrow. */
.promises {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: 1.6rem 2.6rem;
  margin-top: 1.4rem;
}

.promises p {
  margin-top: 0.45em;
  color: var(--soft-ink);
}

/* Pictures of the world, each in a slim oak frame, like paintings. */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 2rem 1.8rem;
  margin: 1.8rem 0 0;
  padding: 0;
  list-style: none;
}

.gallery figure {
  margin: 0;
}

.gallery a {
  display: block;
  padding: 9px;
  border-radius: 6px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--oak-edge);
  border-radius: 2px;
}

.gallery figcaption {
  margin-top: 0.55rem;
  font-style: italic;
  text-align: center;
}

.zoom {
  cursor: zoom-in;
}

.zoom img {
  transition: filter 0.2s;
}

.zoom:hover img {
  filter: brightness(1.06) saturate(1.05);
}

footer.oak {
  margin-top: clamp(4rem, 9vw, 6.5rem);
  padding: 1.6rem 16px 2.2rem;
  border-width: 2px 0 0;
  color: var(--cream);
  font-size: 1.05rem;
  text-align: center;
}

footer p {
  margin: 0.2rem 0 0;
  opacity: 0.85;
}

/* A picture opened large, on the dark. */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cream);
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox::backdrop {
  background: rgba(14, 9, 5, 0.88);
}

.lightbox figure {
  margin: 0;
  padding: 0 16px;
}

.lightbox img {
  width: auto;
  max-width: min(100%, 1920px);
  max-height: 82vh;
  border: 8px solid var(--oak-dark);
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--oak-edge), 0 12px 40px rgba(0, 0, 0, 0.6);
}

.lightbox figcaption {
  margin-top: 0.7rem;
  font-size: 1.3rem;
  font-style: italic;
  text-align: center;
}

.lightbox button {
  position: fixed;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0 0 0.25rem;
  border: 1.6px solid var(--oak-edge);
  border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #a67c4c, #5a3d24);
  color: var(--cream);
  font: 2rem/1 var(--serif);
  cursor: pointer;
}

.lightbox button:hover {
  background: radial-gradient(circle at 32% 30%, #c29560, #6c4a2c);
}

.lightbox .close {
  top: 14px;
  right: 14px;
}

.lightbox .step {
  top: calc(50% - 1.5rem);
}

.lightbox .back {
  left: 14px;
}

.lightbox .on {
  right: 14px;
}

/* The page for a path that isn't there. */
.lost {
  min-height: 100svh;
  border: 0;
}

.plaque a {
  text-decoration: none;
}
