/* ===================== kaia online — layout ===================== */

/* EDIT ME: font paths */
@font-face { font-family: "Basiic"; src: url("/assets/fonts/basiic.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "BigShot"; src: url("/assets/fonts/big-shot.ttf") format("truetype"); font-display: swap; }

/* ---------- palette: 6 colors, nothing else ----------
   paper  = page background
   card   = inside the frame
   line   = borders + dividers
   soft   = quiet text (labels, dates, notes)
   ink    = main text
   accent = links + headings
*/
:root {
  /* dusk, pulled from the cliff sunset gif */
  --paper:  #14131f;   /* night sky / deep shadow */
  --card:   #222034;   /* dusk mountain */
  --card-alt:   #222034de;   /* dusk mountain trans */
  --line:   #5a3650;   /* cliff */
  --soft:   #d8784a;   /* ember */
  --ink:    #f7d9a8;   /* sun glow */
  --accent: #f7a638;   /* sun */

  --font: "Basiic", "Courier Prime", monospace;
  --logo-font: "Basiic", "Courier Prime", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  padding: 40px 16px 24px;
  color: var(--ink);
  background:
  linear-gradient(to bottom, var(--card-alt), transparent 220px),
  var(--paper) url("/assets/imgs/sunset.gif") center / cover no-repeat fixed;
  image-rendering: pixelated;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: none;
}

a { color: var(--accent); text-decoration-style: dotted; text-underline-offset: 3px; }
a:hover { text-decoration-style: solid; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--card); padding: 4px 8px; }
.skip-link:focus { left: 8px; }
#main-content:focus { outline: none; }

/* ---------- header: logo + nav on the page itself ---------- */
.site-header { max-width: 820px; margin: 0 auto 22px; text-align: center; }
.wordmark {
  font-family: var(--logo-font);
  font-size: 44px;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
}
.tagline { color: var(--soft); font-size: 13px; margin: 8px 0 14px; }
.clock:not(:empty)::before { content: "· "; }

/* nav row */
.menu { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; }
.menu-button {
  font: inherit;
  color: var(--soft);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-decoration: none;
}
.menu-button:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
.menu-button.active { color: var(--ink); text-decoration: underline solid; text-underline-offset: 3px; }
.menu-item { position: relative; }

/* dropdown: fades + slides down */
.dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 10;
  padding-top: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -6px);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.menu-item.open .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}
.dropdown-inner {
  min-width: 120px;
  padding: 6px 0;
  background: var(--card);
  border: 1px solid var(--line);
}
.dropdown a {
  display: block;
  padding: 3px 14px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ink);
}
.dropdown a[aria-current="page"] { color: var(--accent); }

.menu-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  .dropdown { transition: none; }
}

/* ---------- content card ---------- */
.frame {
  max-width: 820px;
  margin: 0 auto;
  background: var(--card);

  /* floral pixel border: 12px corners in the image, shown at 3x */
  border: 36px solid transparent;
  border-image: url("/assets/imgs/border.gif") 12 round;
  background-clip: padding-box;
  image-rendering: pixelated;
}

/* status strip */
.topline {
  padding: 10px 20px;
  border-bottom: 1px dashed var(--line);
  text-align: center;
  font-size: 13px;
  min-height: 38px;
}
#statuscafe-content { font-style: italic; }
#statuscafe-content p { display: inline; margin: 0; }
#statuscafe-username { color: var(--soft); margin-left: 6px; font-size: 12px; }
#statuscafe-username a { color: var(--soft); text-decoration: none; }

/* ---------- main area ---------- */
#main-content { padding: 24px 28px 28px; min-width: 0; }

h1, h2 { font-weight: normal; color: var(--accent); }
h1 { font-size: 21px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 0 0 10px; }
p { margin: 0 0 13px; }
b { font-weight: normal; color: var(--soft); }

.cover {
  aspect-ratio: 4 / 1;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: repeating-linear-gradient(45deg, var(--card) 0 6px, var(--line) 6px 12px);
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; image-rendering: pixelated; }

/* homepage: main content + embed column */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 200px;   /* 180px of room for embeds + 20px padding */
  gap: 24px;
  align-items: start;
}
.home { min-width: 0; }
.embeds {
  border-left: 1px dashed var(--line);
  padding-left: 20px;
  text-align: center;
  font-size: 13px;
}
.embed { margin-bottom: 20px; overflow: hidden; }
.embed:last-child { margin-bottom: 0; }
.embed + .embed { padding-top: 18px; border-top: 1px dashed var(--line); }
.embed img, .embed iframe { max-width: 100%; image-rendering: pixelated; }

/* boxes on the homepage */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);   /* minmax(0,…) lets long lines cut off with "..." instead of stretching the box */
  gap: 16px;
  margin-top: 20px;
}
.row-narrow { grid-template-columns: 150px minmax(0, 1fr); }
.box { border: 1px dashed var(--line); padding: 12px; min-width: 0; }

.plain { list-style: none; padding: 0; margin: 0; }
.plain li { margin-bottom: 5px; }
.updates li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box-foot { font-size: 12px; color: var(--soft); margin: 10px 0 0; }
.update-entry {
  padding: 0 0 12px;
  margin: 0 0 12px;
  border-bottom: 1px dashed var(--line);
  overflow-wrap: anywhere;
}
.update-entry:last-child { border-bottom: none; }
.update-date { color: var(--soft); font-size: 13px; margin-bottom: 2px; }
.update-entry:target .update-date { color: var(--accent); }

/* EDIT ME: how many lines each update shows before it's cut off with "..." */
.update-body {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
/* the one you clicked from the homepage shows in full */
.update-entry:target .update-body { display: block; -webkit-line-clamp: unset; line-clamp: none; }   /* the one you clicked from the homepage */

.linkme { text-align: center; }
.my-button { display: block; margin: 0 auto 8px; image-rendering: pixelated; }
textarea {
  width: 100%;
  height: 52px;
  font: 10px/1.1 monospace;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  resize: vertical;
  display: block;
}
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.buttons img { image-rendering: pixelated; }

/* ---------- blog ---------- */
.blog {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
}
.blog-side {
  font-size: 13px;
  padding-right: 24px;
  border-right: 1px dashed var(--line);
}
.blog-side h2 { font-size: 19px; margin: 0 0 10px; }
.blog-side h2 + p { margin-bottom: 22px; }

.blog-side details summary { cursor: pointer; list-style: none; }
.blog-side details summary::-webkit-details-marker { display: none; }
.arch-year > summary { color: var(--ink); font-size: 14px; margin: 6px 0; }
.arch-month { margin-left: 10px; }
.arch-month > summary { color: var(--soft); margin: 4px 0; }
.arch-year > summary::after, .arch-month > summary::after { content: " +"; color: var(--soft); }
.arch-year[open] > summary::after, .arch-month[open] > summary::after { content: " −"; }
.blog-side ul { list-style: none; padding: 0 0 4px 10px; margin: 0; }
.blog-side li { margin: 3px 0; line-height: 1.25; }
.blog-side li a { text-decoration: none; }
.blog-side li a:hover { text-decoration: underline dotted; }
.blog-side li a[aria-current="page"] { color: var(--ink); }
.post-count {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--soft);
  text-align: center;
  font-size: 12px;
}

.blog-post { min-width: 0; }
.post-date { color: var(--soft); font-size: 13px; margin: 0 0 4px; }
.blog-post h1 { font-size: 24px; margin: 0 0 18px; }
.post-body { overflow-wrap: anywhere; }
.post-body img, .post-body iframe { max-width: 100%; height: auto; }
.post-body iframe[src*="youtube"] { aspect-ratio: 16 / 9; width: 100%; }
.post-body ul { margin: 6px 0 12px; padding-left: 20px; }
.post-body details { margin: 10px 0; }
.post-body details > summary { cursor: pointer; color: var(--accent); }
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 30px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}
.post-nav span:last-child { text-align: right; }

/* ---------- regular pages ---------- */
.single { max-width: 600px; }

/* ---------- site map ---------- */
.map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  align-items: start;
}
.map-group { border: 1px dashed var(--line); padding: 12px; }
.map-group ul { list-style: none; padding: 0; margin: 0; }
.map-group li { margin-bottom: 5px; }
.map .note { display: block; font-size: 12px; color: var(--soft); }

/* ---------- footer ---------- */
footer { text-align: center; margin-top: 28px; font-size: 13px; color: var(--soft); }
footer span { display: block; margin-bottom: 3px; }

/* ---------- mobile ---------- */
@media (max-width: 700px) {
  body { padding: 20px 10px; }
  .wordmark { font-size: 34px; }
  .menu-toggle {
    display: inline-block;
    font: inherit;
    font-size: 13px;
    color: var(--accent);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px 14px;
    cursor: pointer;
  }
  .menu { display: none; flex-direction: column; align-items: center; gap: 2px; margin-top: 10px; }
  .menu.open { display: flex; }

  /* on phones the dropdown pushes things down instead of floating, and grows open */
  .dropdown {
    position: static;
    transform: none;
    padding-top: 0;
    opacity: 1;
    visibility: visible;
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .2s ease;
  }
  .menu-item.open .dropdown { grid-template-rows: 1fr; transform: none; }
  .dropdown-inner { overflow: hidden; min-width: 0; padding: 0; border: none; box-shadow: none; background: none; }
  .dropdown a { padding: 2px 0; font-size: 14px; }

  .frame { border-width: 24px; }   /* 2x on phones */
  #main-content { padding: 16px; }
  .row, .row-narrow { grid-template-columns: 1fr; }
  .home-layout { grid-template-columns: 1fr; }
  .blog { grid-template-columns: 1fr; }
  .blog-side { order: 2; padding: 20px 0 0; border-right: none; border-top: 1px dashed var(--line); }
  .embeds { border-left: none; padding-left: 0; border-top: 1px dashed var(--line); padding-top: 20px; }
  .updates li { white-space: normal; }
}

  /* ---------- photobook ---------- */
  .pb-tabs { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 20px; }
  .pb-tab { font: inherit; color: var(--accent); background: none; border: none; padding: 2px 0; cursor: pointer; }
  .pb-tab:hover { text-decoration: underline dotted; text-underline-offset: 3px; }
  .pb-tab.active { color: var(--ink); text-decoration: underline solid; text-underline-offset: 3px; }
  .pb-count { color: var(--soft); font-size: 12px; }

  .pb-cat { margin-bottom: 26px; }
  .pb-cat[hidden] { display: none; }
  .pb-note { color: var(--soft); font-size: 13px; }

  .pb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .pb-thumb { display: block; aspect-ratio: 1; border: 1px solid var(--line); background: var(--paper); }
  .pb-thumb:hover, .pb-thumb:focus-visible { border-color: var(--accent); }
  .pb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

  .pb-lightbox { max-width: min(92vw, 900px); padding: 12px; color: var(--ink); background: var(--card); border: 1px solid var(--line); text-align: center; }
  .pb-lightbox::backdrop { background: color-mix(in srgb, var(--paper) 88%, transparent); }
  .pb-lightbox img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto 8px; }
  .pb-caption { color: var(--soft); font-size: 13px; margin: 0 0 8px; min-height: 1.35em; }
  .pb-controls { display: flex; justify-content: space-between; }
  .pb-controls button { font: inherit; color: var(--accent); background: none; border: none; cursor: pointer; }
  .pb-controls button:hover { text-decoration: underline dotted; }

  /* ---------- text wrapping around images ---------- */
  .img-left,
  .img-right {
    max-width: 75%;
    height: auto;
    border: 1px solid var(--line);
  }
  .img-left  { float: left;  margin: 4px 16px 8px 0; }
  .img-right { float: right; margin: 4px 0 8px 16px; }

    /* put this on a wrapper so floats don't spill out of it */
  .wrap { display: flow-root; }

  /* little arrow-in-a-square after external links */
  a[href^="http"]:not(:has(img))::after {
    content: "";
    display: inline-block;
    width: .5em;
    height: .5em;
    margin-left: .3em;
    background: currentColor;   /* takes the link's color */
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'%3E%3Cpath d='M4 1H1v8h8V6M6 1h3v3M9 1L4.5 5.5' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10' shape-rendering='crispEdges'%3E%3Cpath d='M4 1H1v8h8V6M6 1h3v3M9 1L4.5 5.5' fill='none' stroke='black' stroke-width='1'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  ul { list-style-type: "- ";}
  li::marker { color: var(--soft)}

  /* ---------- tree page ---------- */
.scene { position: relative; max-width: 640px; margin: 0 auto; background: #000; border: 1px solid var(--line); container-type: inline-size; }
.tree { padding: 16px; }
.tree img { display: block; width: 100%; margin: 0 auto; visibility: hidden; image-rendering: pixelated; }
#ascii-tree {
  visibility: hidden; margin: 0 auto; width: max-content;
  font-family: Consolas, Menlo, "DejaVu Sans Mono", "Courier New", monospace;
  color: #fff; white-space: pre; cursor: text; user-select: text;
}
#ascii-tree::selection, #ascii-tree *::selection { background: var(--accent); color: var(--paper); }

/* dialogue box: sizes scale with the scene (the old one was 640 wide) */
#textbox {
  visibility: hidden; cursor: pointer;
  margin: 0 4cqw 4cqw; min-height: 19cqw; padding: 2.2cqw 2.8cqw;
  background: #000; border: max(2px, .625cqw) solid #fff;
}
#textbox.open { visibility: visible; }
#dialogue-text, .choice-cell {
  font-family: "BigShot", monospace; color: #fff;
  font-size: max(13px, 3.75cqw); letter-spacing: .16cqw; line-height: 1.15;
}
#dialogue-text { white-space: pre-wrap; }
.wide-space { margin-right: .2em; }
#choice-grid { display: none; grid-template-columns: repeat(2, 1fr); column-gap: 3cqw; min-height: 13cqw; align-content: center; }
.choice-cell { position: relative; padding: .17em 0 .33em 1.4em; cursor: pointer; white-space: nowrap; }
.cursor-icon { position: absolute; left: 0; top: 50%; transform: translateY(-60%); scale: 90%; width: .67em; height: .67em; image-rendering: pixelated; }

/* shows only if the browser blocks the music from autoplaying */
#start {
  display: none; position: absolute; inset: 0; width: 100%; border: 0; place-items: center;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
  font-family: "BigShot", monospace; font-size: max(14px, 4cqw);
}
#start.show { display: grid; }

.scene-foot { text-align: center; margin: 8px 0 0; font-size: 13px; }
.scene-btn { font: inherit; color: var(--accent); background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }

/* musicp layer */
.mp {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 50;
  font: inherit;
  font-size: 0.8em;
  color: var(--ink);
}

.mp-bar {
  display: flex;
  flex-direction: column;   /* title on top, controls below */
  gap: 4px;
  padding: 6px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  opacity: 0.7;
  transition: opacity 0.2s;
}
.mp:hover .mp-bar,
.mp:focus-within .mp-bar { opacity: 1; }

.mp-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* song name: sits on its own line, wraps if long */
.mp-title {
  width: 0;            /* stops a long name from stretching the box */
  min-width: 100%;     /* it just matches the controls' width and wraps */
  color: var(--soft);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.mp button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.mp button:hover,
.mp button:focus-visible { color: var(--accent); }
.mp button[aria-pressed="true"] { color: var(--accent); text-decoration: underline; }
.mp .mp-btn { min-width: 2.2em; padding: 4px 2px; text-align: center; }

/* play / pause icon, drawn so it takes the text color */
.mp-ico {
  display: inline-block;
  width: 10px;
  height: 12px;
  vertical-align: middle;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);   /* play */
}
.mp-toggle.is-playing .mp-ico {                /* pause */
  clip-path: none;
  background: linear-gradient(to right, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%);
}

/* song list opens upward */
.mp-list {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 100%;
  max-height: 40vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
}
.mp-list[hidden] { display: none; }
.mp .mp-track { text-align: left; padding: 6px 10px; white-space: nowrap; }
.mp .mp-track.is-current { color: var(--accent); text-decoration: underline; }

/* volume slider */
.mp input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 70px;
  height: 14px;
  background: transparent;
  cursor: pointer;
}
.mp input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--line); }
.mp input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 14px;
  margin-top: -5px;
  background: var(--accent);
  border: 0;
  border-radius: 0;
}
.mp input[type="range"]::-moz-range-track { height: 4px; background: var(--line); }
.mp input[type="range"]::-moz-range-progress { height: 4px; background: var(--soft); }
.mp input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 14px;
  background: var(--accent);
  border: 0;
  border-radius: 0;
}

@media (max-width: 600px) {
  .mp input[type="range"] { display: none; }   /* phones have their own volume buttons */
}

/* effect: sunrise (driven by --fx, 0 to 1) */
html[data-effect="sunrise"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;                
  pointer-events: none;
  opacity: var(--fx, 0);
  background:
    radial-gradient(
      ellipse 95% 75% at 50% calc(125% - var(--fx, 0) * 55%),
      rgba(247, 166, 56, 0.55) 0%,
      rgba(216, 120, 74, 0.30) 35%,
      transparent 70%
    );
}
/* effect: loom (driven by --fx, 0 to 1) */
html[data-effect="loom"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;                 
  pointer-events: none;
  opacity: var(--fx, 0);
  background:
    radial-gradient(
    ellipse 160% 110% at 50% calc(-25% + var(--fx, 0) * 55%),
    rgba(16, 4, 30, 0.95) 0%,
    rgba(0, 0, 0, 0.7) 40%,
    rgba(0, 0, 0, 0.94) 80%,
    transparent 85%
  );
}