/*
Theme Name: Hello Sugar
Author: Pedro Estarque
Author URI: https://pedro.estarque.com.br
Description: Tema Hello Sugar
Version: 8
*/

:root {
  --hs-magenta: #ff00ff;
}

html, body {
  height: 100%;
  width: 100%;
}

* {
  border: 0px;
  margin: 0px;
  padding: 0px;
  vertical-align: baseline;
  outline-color: gray;
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}

@font-face {
  font-family: "PixelRetro";
  src: url("font/Ac437_EpsonMGA_Mono.ttf") format("truetype");
  font-display: swap;
}

body {
  font: 14px / 1.35 "PixelRetro", "Courier New", monospace;
  background: black;
  color: var(--hs-magenta);
}

body.administrator .content {
  margin-top: 32px;
  position: relative;
  width: 100%;
  height: 100%;
}

body.home {
  background-image: url(images/bg.png);
  background-repeat: no-repeat;
  background-position: top center;
  background-size: contain;
  /* background-size: min(100%, 1200px) auto; */
}

.hidden {
  display: none!important;
}

.win {
  --mag:     #ff00ff;
  --mag-hi:  #ff8cff;
  --mag-mid: #b000b0;
  --mag-lo:  #5c005c;
  --ink:     #000;
  --bar:  32px;
  --px:   2px;
  --tile: calc(var(--px) * 2);
  --dither-a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2' shape-rendering='crispEdges'%3E%3Crect width='2' height='2' fill='%235c005c'/%3E%3Cpath d='M0 0h1v1H0zM1 1h1v1H1z' fill='%23ff00ff'/%3E%3C/svg%3E");
  --dither-b: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2' shape-rendering='crispEdges'%3E%3Crect width='2' height='2' fill='%235c005c'/%3E%3Cpath d='M0 0h1v1H0zM1 1h1v1H1z' fill='%23b000b0'/%3E%3C/svg%3E");
  --arrow-up:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 4' shape-rendering='crispEdges'%3E%3Cpath d='M3 0h1v1h1v1h1v1h1v1H0V3h1V2h1V1h1z'/%3E%3C/svg%3E");
  --arrow-down:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 4' shape-rendering='crispEdges'%3E%3Cpath d='M0 0h7v1h-1v1h-1v1h-1v1H3V3H2V2H1V1H0z'/%3E%3C/svg%3E");
  --arrow-left:  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 7' shape-rendering='crispEdges'%3E%3Cpath d='M0 3h1V2h1V1h1V0h1v7H3V6H2V5H1V4H0z'/%3E%3C/svg%3E");
  --arrow-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 7' shape-rendering='crispEdges'%3E%3Cpath d='M4 3H3V2H2V1H1V0H0v7h1V6h1V5h1V4h1z'/%3E%3C/svg%3E");
  --ico-min:     url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M1 5h6v2H1z'/%3E%3C/svg%3E");
  --ico-max:     url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath fill-rule='evenodd' d='M0 0h8v8H0zM1 2h6v5H1z'/%3E%3C/svg%3E");
  --ico-close:   url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' shape-rendering='crispEdges'%3E%3Cpath d='M1 1l6 6M7 1L1 7' stroke='black' stroke-width='1.4' fill='none'/%3E%3C/svg%3E");
  position: absolute;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 683px;
  max-width: 100%;
  height: 880px;
  min-width: 260px;
  min-height: 220px;
  max-height: 90vh;
  overflow: hidden;
  resize: both;
  background: var(--ink);
  border: 2px solid var(--mag);
  color: var(--mag);
  font-size: 24px;
}

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

.win header {
  cursor: grab;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: none;
}

.win header:active {
  cursor: grabbing;
}

.win header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 0;
}

.win header h3 {
  margin: 0;
  overflow: hidden;
  font: inherit;
  line-height: var(--bar);
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.win header h3::after { content: "_"; }

/* the dithered strip under the title; it stretches with the window */
.win header::after {
  content: "";
  grid-column: 1 / -1;
  height: 28px;
  background: var(--dither-a) 0 0 / var(--tile) var(--tile);
  image-rendering: pixelated;
}

.win .controls { display: flex; gap: 4px; }

.win .controls button {
  width: var(--bar);
  height: var(--bar);
  padding: 0;
  border: 2px solid;
  border-color: var(--mag-hi) var(--mag-lo) var(--mag-lo) var(--mag-hi);
  background-color: var(--mag-mid);
  background-repeat: no-repeat, repeat;
  background-position: center, 0 0;
  background-size: 16px 16px, var(--tile) var(--tile);
  image-rendering: pixelated;
  cursor: pointer;
}
.win .controls .min   { background-image: var(--ico-min),   var(--dither-a); }
.win .controls .max   { background-image: var(--ico-max),   var(--dither-a); }
.win .controls .close { background-image: var(--ico-close), var(--dither-a); }

.win .controls button:active { border-color: var(--mag-lo) var(--mag-hi) var(--mag-hi) var(--mag-lo); }
.win .controls button:focus-visible { outline: 2px solid var(--mag-hi); outline-offset: 2px; }

/* ---------- content area (the scroller) ---------- */

.win article {
  min-height: 0;                 /* lets the grid row shrink so overflow kicks in */
  margin: 8px;
  padding: 50px;
  overflow: scroll;              /* always show both bars, like the screenshot */
  overscroll-behavior: contain;
  background: var(--ink);
  border: 2px solid var(--mag);
  outline: 1px solid var(--mag-mid);
  outline-offset: 3px;
  /* text-align: justify; */
  /* text-justify: inter-word; */
  hyphens: none;
}
.win article:focus-visible { outline: 2px solid var(--mag-hi); outline-offset: 3px; }

.win article p {margin: 0 0 10px;}
.win article > section {margin-bottom: 0;}

/* blinking cursor after the last block (wrap your content in <p> for this to apply) */
.win article > section::after {
  content: "_";
  animation: win-blink 1s steps(1) infinite;
}
@keyframes win-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .win article > section::after { animation: none; }
}

.win ::selection { background: var(--mag); color: var(--ink); }

/* ---------- scrollbars: Chrome / Edge / Safari ---------- */

.win article::-webkit-scrollbar {
  width: var(--bar);
  height: var(--bar);
  background: var(--ink);
}

.win article::-webkit-scrollbar-track {
  background: var(--dither-b) 0 0 / var(--tile) var(--tile);
  border: 2px solid var(--mag-lo);
}

.win article::-webkit-scrollbar-thumb {
  background: var(--dither-a) 0 0 / var(--tile) var(--tile);
  border: 2px solid;
  border-color: var(--mag-hi) var(--mag-lo) var(--mag-lo) var(--mag-hi);
  min-height: var(--bar);        /* never let the thumb shrink below a button */
  min-width: var(--bar);
}
.win article::-webkit-scrollbar-thumb:active {
  border-color: var(--mag-lo) var(--mag-hi) var(--mag-hi) var(--mag-lo);
}

/* the square where the two bars meet; the browser's native resize grip sits on top of it */
.win article::-webkit-scrollbar-corner {
  background: var(--dither-a) 0 0 / var(--tile) var(--tile);
  border: 2px solid;
  border-color: var(--mag-hi) var(--mag-lo) var(--mag-lo) var(--mag-hi);
}

/* arrow buttons: without display:block Chrome hides them entirely */
.win article::-webkit-scrollbar-button:single-button {
  display: block;
  width: var(--bar);
  height: var(--bar);
  border: 2px solid;
  border-color: var(--mag-hi) var(--mag-lo) var(--mag-lo) var(--mag-hi);
  background-color: var(--mag-mid);
  background-repeat: no-repeat, repeat;
  background-position: center, 0 0;
}
.win article::-webkit-scrollbar-button:single-button:active {
  border-color: var(--mag-lo) var(--mag-hi) var(--mag-hi) var(--mag-lo);
}

.win article::-webkit-scrollbar-button:vertical:start:decrement {
  background-image: var(--arrow-up), var(--dither-a);
  background-size: 14px 8px, var(--tile) var(--tile);
}
.win article::-webkit-scrollbar-button:vertical:end:increment {
  background-image: var(--arrow-down), var(--dither-a);
  background-size: 14px 8px, var(--tile) var(--tile);
}
.win article::-webkit-scrollbar-button:horizontal:start:decrement {
  background-image: var(--arrow-left), var(--dither-a);
  background-size: 8px 14px, var(--tile) var(--tile);
}
.win article::-webkit-scrollbar-button:horizontal:end:increment {
  background-image: var(--arrow-right), var(--dither-a);
  background-size: 8px 14px, var(--tile) var(--tile);
}

/* ---------- scrollbars: Firefox ----------
   Firefox only supports colour and width. Newer Chrome also honours
   scrollbar-color and would then IGNORE all the ::-webkit-scrollbar rules above,
   so this block is gated to browsers that lack them. */
@supports not selector(::-webkit-scrollbar) {
  .win article {
    scrollbar-color: var(--mag) var(--ink);
    scrollbar-width: auto;
  }
}

a { color: var(--hs-magenta) }

.win.frontMost { z-index: 999; }

.win.min {
  height: auto!important;
  min-height: auto;
}
.win.min.max {
  height: auto!important;
  max-height: none !important;
}

.win.min article {
  display: none;
}

.win.max {
  left: 0!important;
  top: 0!important;
  width: 100vw!important;
  height: 100vh!important;
  max-width: 100vw!important;
  max-height: 100vh!important;
}

.win {
  --offset: 40px;
}

.win:nth-child(1 of .win:not(.hidden)) {
  top: calc(var(--offset) * 1);
  left: calc(var(--offset) * 1);
}

.win:nth-child(2 of .win:not(.hidden)) {
  top: calc(var(--offset) * 2);
  left: calc(var(--offset) * 2);
}

.win:nth-child(3 of .win:not(.hidden)) {
  top: calc(var(--offset) * 3);
  left: calc(var(--offset) * 3);
}

.win:nth-child(4 of .win:not(.hidden)) {
  top: calc(var(--offset) * 4);
  left: calc(var(--offset) * 4);
}

#hello.win {
  width: 500px;
  height: 400px;
}

.hs-menu {
    position: absolute;
    bottom: 50px;
    left: 50px;
    font-size: 28px;
}

.hs-menu .menu {
  list-style-type: none;
}

.hs-menu a.selected {
  text-decoration: underline line-through;;
}

.hs-menu a:before {
  content: "<";
}

.hs-menu a:after {
  content: ">";
}

.hs-menu:before {
  content: "";
  position: absolute;
  top: -100px;
  height: 50px;
  width: 50px;
  background-image: url(images/logo.png);
  background-repeat: no-repeat;
}

.win.works {
  width: 1200px;
  height: 960px;
}

.win.works video {
  max-width: 100%;
  height: auto;
  max-height: 500px;
  min-height: 500px;
  margin: auto;
  display: block;
}

.win.works h2:before {
  content: ">> ";
}

.win.works h2:after {
  content: "_";
}

.win.works .prevNext {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.win.works .prevNext button {
  font-family: "PixelRetro";
  background: transparent;
  color: var(--hs-magenta);
  font-size: 50px;
  cursor: pointer;
}

.win.works .prevNext .prev::before {
  display: inline-block;
  content: "<";
}

.win.works .prevNext .next::before {
  display: inline-block;
  content: ">";
}

.win.works .prevNext .prev:hover::before {
  transform: translateX(-10px);
}

.win.works .prevNext .next:hover::before {
  transform: translateX(10px);
}

@media (max-width: 1000px) {

  body.home {
    background-size: 200%;
    background-position: left top;
  }

  .hs-menu {
    left: 20px;
    bottom: 20px;
  }

  .win,
  #hello.win,
  .win.works {
    --offset: 20px;
    width: calc(100vw - 40px);
    max-height: 70vh;
  }

  .win article {
    padding: 25px;
  }

  .win.works video {
    min-height: 250px;
  }

}
