@import url("./global.css");
@import url("./common.css");

:root {
  background-color: var(--clr-bg);
  color: var(--clr-txt);
  font-family: var(--fnt-sans);
  line-height: 1.45;
}

:where(
  html,
  body
) {
  margin: 0;
  overflow-y: overlay;
  padding: 0;
  width: 100vw;

  & *:where(h1, h2, h3, h4, h5, h6) {
    line-height: 1;
    width: 100%;
  }

  & a {
    color: inherit;
    text-decoration: none;
  }

  & a,
  & button,
  & input[type=checkbox]:not(:disabled),
  & input[type=radio]:not(:disabled),
  & summary {
    cursor: pointer;
  }

  & :where(.ghost-markdown-content) {
    & :where(ul, ol) {
      line-height: 1;
      padding-left: 1.5rem;
    }
  }
}

/* TODO(culi): required by gscan */
/* All Koenig CSS classes I could find:

kg-audio-card
kg-audio-player-container
kg-audio-thumbnail
kg-blockquote-alt
kg-bookmark-card
kg-button-card
kg-callout-card
kg-code-card
kg-embed-card
kg-file-card
kg-gallery-card
kg-gallery-container
kg-gallery-image
kg-gallery-row
kg-header-card
kg-image
kg-image-card
kg-nft-card
kg-product-card
kg-signup-card
kg-toggle-card
kg-video-card
kg-width-full
kg-width-wide

https://docs.ghost.org/themes/content
*/
.kg-width-wide,
.kg-width-full {
  width: 100%;
}

/*** ======================================= */
/** === default.hbs ======================= **/
/* ======================================= ***/

:where(body.adoah-default) {
  --mxw: calc(40vw + 500px); /* maximum width for main content */

  display: flex;
   flex-direction: column;
  position: relative;
  width: 100%;

  & :where(header, main, footer) {
    display: flex;
    flex: 0;
    width: 100%;
  }

  & :where(header, footer) {
    text-align: center;
    flex-direction: column;
  }

  & main {
    flex: 1;
    display: flex;
     justify-content: center;
    padding: 1rem;
    position: relative;
  }

  & .decoration {
    --gutter: calc((100% - var(--mxw)) / 2);
    --size: 3rem;

    pointer-events: none;
    position: absolute;
     top: 0;
     left: 0;
    user-select: none;
    width: var(--size);
    z-index: -1;

    &:nth-of-type(1) {
      top: 3rem;
      left: calc(var(--gutter) - var(--size) - 2%);
      transform: rotate(-15deg);
    }
    &:nth-of-type(2) {
      top: calc(100% - 10rem - 2%);
      left: calc(100% - var(--gutter) + 5px);
      transform: rotate(15deg);
    }
    &:nth-of-type(3) {
      top: calc(100% - 8rem - 1%);
      left: calc(var(--gutter) - var(--size) - 1%);
      transform: rotate(-25deg) scale(0.9);
    }
  }
}

/*** ======================================= */
/** === index.hbs ========================= **/
/* ======================================= ***/

:where(.adoah-index) {
  display: flex;
   flex-wrap: wrap;
   gap: 1rem;
  max-width: var(--mxw);

  & > .pages-column {
    display: flex;
     flex-direction: column;
     gap: 1rem;
    flex: 2;
    min-width: 400px;
  }

  & > .right.scan-column {
    display: flex;
      align-content: flex-start;
      flex-wrap: wrap;
      gap: 1rem;
    flex: 1;
    min-width: 250px;
    max-width: 400px;
  }
}

/*** ======================================= */
/** === post.hbs ========================== **/
/* ======================================= ***/

:where(.adoah-post) {
  width: var(--mxw);
}

:where(.adoah-post, .adoah-post-card).lined-paper {
  --fntsz-s: 16px;
  --fntsz-m: 20px;
  --fntsz-l: 24px;
  --fntsz-xl: 26px;
  --fntsz-2xl: 28px;

  font-size: var(--fntsz-m);

  & .date {
    position: absolute;
     left: calc(var(--left-margin) + 0.5rem);
     top: 0;
    font-size: var(--fntsz-s);
  }

  & .post-title {
    align-content: end;
    height: calc(var(--top-margin) + var(--text-line-height));
  }

  & :where(h2, h3, h4, h5, h6):not(.post-title) {
    align-content: end;
    height: calc(var(--text-line-height));
  }

  & :where(h2, h3, h4, h5, h6):not(.post-title),
  & p + p,
  & hr + * {
    margin-top: var(--text-line-height);
  }

  & hr {
    height: 1px;
    margin-top: calc(var(--text-line-height) - 1px);
  }
}

/*** ======================================= */
/** === partials/header.hbs =============== **/
/* ======================================= ***/

:where(.adoah-header) {
  & .site-title {
    background: var(--clr-accent);
    color: var(--clr-txt-inv);
    display: flex;
     align-items: center;
     flex-wrap: wrap;
     justify-content: center;
    max-height: 143px;
    overflow: hidden;

    & hgroup {
      padding: 1rem;

      & h1 {
        font-size: 2.5rem;
      }

      & .site-subtitle {
        color: var(--clr-secondary);
        font-size: 1.5rem;
      }
    }

    & .mascot {
      max-height: 7em;
      stroke: 1px var(--clr-txt-inv);
    }
  }

  & nav {
    background: var(--clr-nav);
    font-size: 1.5rem;

    & ul {
      display: flex;
       align-items: center;
       flex-wrap: wrap;
       gap: 0 2rem;
       justify-content: center;
      list-style: none;
      min-height: 2rem;
      padding: 0;

      & li {
        transition: color 0.2s;

        &:hover {
          color: var(--clr-txt-inv);
        }
      }
    }
  }
}

/*** ======================================= */
/** === partials/footer.hbs =============== **/
/* ======================================= ***/

:where(.adoah-footer) {
  background: var(--clr-accent);
  color: var(--clr-txt-inv);
  display: flex;
   align-items: center;
   justify-content: center;
  min-height: 2rem;
  padding: 0.25rem 1rem;

  & .footer-content {
    display: flex;
     flex-direction: row;
     flex-wrap: wrap;
     justify-content: space-between;
    width: var(--mxw);
     max-width: 100%;

    & form { color: var(--clr-txt); }

    & > * {
      white-space: nowrap;

      text-align: center;
      &:first-child { text-align: left; }
      &:last-child { text-align: right; }
    }
  }

  & form {
    position: relative;

    & .input-group {
      display: flex;
      flex-direction: row;
      width: 200px;

      & + .subscribe-button {
        position: absolute;
         left: 200px;
         top: 0;
      }

      &:has(input:placeholder-shown) + .subscribe-button {
        display: none;
      }
    }
  }
}

/*** ======================================= */
/** === partials/post-card.hbs ============ **/
/* ======================================= ***/

:where(.adoah-post-card) {
  min-height: 200px;
}

.lined-paper {
  --left-margin: 2.5rem;
  --top-margin: 40px;
  --text-line-height: calc(var(--fntsz-m) * 1.45);

  background-color: var(--color-offwhite);
  background-image:
    linear-gradient(to right, var(--color-salmon) 2px, transparent 2px),
    repeating-linear-gradient(
      var(--color-offwhite),
      var(--color-offwhite) calc(var(--text-line-height) - 1px),
      var(--color-celeste) calc(var(--text-line-height) - 1px),
      var(--color-celeste) calc(var(--text-line-height))
    )
  ;
  background-position: var(--left-margin) 0, 0 var(--top-margin);
  border-radius: 1rem;
  box-shadow: 2px 3px 2px #1111;
  padding: 1rem;
   padding-left: calc(var(--left-margin) + 0.5rem);
   padding-top: 0;
  position: relative;
  z-index: 2;

  & .punched-hole {
    --hole-size: calc(var(--left-margin) * 1.5 / 3);
    --hole-gap: 5rem;

    background-color: var(--clr-bg);
    border-radius: 50%;
    height: var(--hole-size);
     aspect-ratio: 1;
    position: absolute;
     left: calc((var(--left-margin) - var(--hole-size)) / 2);
     top: calc((100% * 1 / 6) - var(--hole-size) / 2);

    &:nth-of-type(2) { top: calc((100% * 3 / 6) - var(--hole-size) / 2); }
    &:nth-of-type(3) { top: calc((100% * 5 / 6) - var(--hole-size) / 2); }
  }
}

.taped {
  &:nth-of-type(odd) { --sign: 1; }
  &:nth-of-type(even) { --sign: -1; }

  transform: rotate(calc(0.4deg * var(--sign)));
  &::before,
  &::after {
    background-color: #fffa;
    height: 20px;
     width: 65px;
    position: absolute;
     right: calc(50% - var(--sign) * 50% + (-15px - 17px + 17px * var(--sign)));
     top: -5px;
    z-index: 3;
    transform: rotate(calc(20deg * var(--sign)));
  }
  &::after { content: ""; }

  &.twice {
    &::before {
      content: "";
      top: calc(100% - 15px);
      left: calc(50% - var(--sign) * 50% + (-15px - 17px + 17px * var(--sign)));
    }
  }
}

/*** ======================================= */
/** === partials/widget-card.hbs ============ **/
/* ======================================= ***/

:where(.adoah-scan-card, .adoah-widget-card) {
  border-radius: 0.15rem;
  box-sizing: border-box;
  filter:
    drop-shadow(0.5px 0.5px 0.1px var(--clr-line))
    drop-shadow(0.5px 0px 0.1px var(--clr-line))
    drop-shadow(0.5px -0.5px 0.1px var(--clr-line))
    drop-shadow(0 0.5px 0.1px var(--clr-line))
    drop-shadow(0 -0.5px 0.1px var(--clr-line))
    drop-shadow(-0.5px 0.5px 0.1px var(--clr-line))
    drop-shadow(-0.5px 0 0.1px var(--clr-line))
    drop-shadow(-0.5px -0.5px 0.1px var(--clr-line))
  ;
  flex-grow: 1;
  padding: 0.5rem;
  position: relative;

  &:nth-of-type(3n) { --bg: var(--clr-quaternary); }
  &:nth-of-type(3n + 1) { --bg: var(--clr-secondary); }
  &:nth-of-type(3n + 2) { --bg: var(--clr-tertiary); }

  background-color: var(--bg);

  &.half {
    max-height: 200px;
     overflow-y: auto;
    max-width: calc(50% - 1rem / 2);
     min-width: 35%;
  }

  &.full {
    --tab-height: 0.75rem;

    margin-top: var(--tab-height);
    min-width: 100%;
    padding-top: calc(1.75rem - var(--tab-height));

    & h2 {
      background-color: var(--bg);
      border-radius: 0.15rem;
      padding: 0.25rem 0.5rem;
       padding-bottom: 0;
      position: absolute;
       left: 0;
       top: calc(-1 * var(--tab-height));
      width: fit-content;
    }
  }

  & img {
    border: 2px solid var(--clr-line);
    border-radius: 0.15rem;
    float: left;
    margin: 0.25rem;
     margin-left: 0;
     margin-bottom: 0;
    max-width: 30%;
    transform: rotate(-2deg);
  }
}
