/* ** Reset from https://www.joshwcomeau.com/css/custom-css-reset/ */
/* 1. Use a more-intuitive box-sizing model */
*, *::before, *::after { box-sizing: border-box; }
/* 2. Remove default margin */
*:not(dialog) { margin: 0; }
/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) { html { interpolate-size: allow-keywords; } }
/* 4. Add accessible line-height */
body { line-height: 1.5; }
/* 5. Improve text rendering (only for high dpi...?) */
/*body { -webkit-font-smoothing: antialiased; }*/
/* 6. Improve media defaults */
img, picture, video, canvas, svg { display: block; max-width: 100%; }
/* 7. Inherit fonts for form controls */
input, button, textarea, select { font: inherit; }
/* 8. Avoid text overflows */
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
/* 9. Improve line wrapping */
p { text-wrap: pretty; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
/* 10. Create a root stacking context */
#root, #__next { isolation: isolate; }

/* my own stuff */
html { overscroll-behavior-y: none; scrollbar-gutter: stable; background: #FBFBFB; }
p, ul { margin-bottom: 1.5rem; &:last-child { margin-bottom: 0; } }
iframe { border: none; display: block; }

/* https://chrisnager.github.io/ungrid is convenient */
@media (min-width: 30em) {
  .row { width: 100%; display: table; table-layout: fixed; border-spacing: 10px 0; }
  .col { display: table-cell; }
}

body {
  max-width: 720px;
  padding: 0 1rem;
  margin: 0 auto;
  font-family: sans-serif;
  font-size: 1.125rem;
  line-height: 1.4;
  background: #FBFBFB;

  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: #444;
  &:hover { color: #666; }
  &.link-missing {
    color: #944;
    &:hover { color: #966; }
  }
}

header {
  display: flex;
  /*flex-direction: column;*/
  align-items: baseline;
  margin-top: 10px;
  isolation: isolate; /* keeps z-index:-1 drop shadows above body's background */

  @media (max-width: 980px) {
    flex-direction: column;
    align-items: center;
    nav { margin-left: 0; }
  }

  a {
    text-decoration: none;
  }

  h1 {
    margin-bottom: 0;
    margin-top: 0;
    text-transform: uppercase;
    font-size: 3rem;
    font-family: Arial Rounded MT Bold, Arial, sans-serif;
    font-weight: 800;
    letter-spacing: -1px;
    color: #FFEB3B;
    -webkit-text-stroke: 3px black;
    paint-order: stroke fill;
    position: relative;

    &::after {
      content: 'slipstream';
      text-transform: uppercase;
      position: absolute;
      left: 4px;
      top: 4px;
      z-index: -1;
      background-color: black;
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: black;
      -webkit-text-stroke: 1px black;
      paint-order: stroke fill;
    }
  }
  p { margin: 0; }
  nav {
    margin-left: 26px;
    color: #AAA;

    a {
      color: black;
      background: white;
      padding: 4px 8px;
      border-radius: 3px;
      border: 1px solid black;
      font-size: 0.8rem;
      position: relative;

      &:hover {
        background: #FFEB3B;
        color: #333;
      }

      &::after {
        position: absolute;
        box-sizing: content-box;
        content: ' ';
        left: 1px;
        top: 1px;
        z-index: -1;
        background-color: black;
        border-radius: 3px;
        border: 1px solid black;
        width: 100%;
        height: 100%;
      }
    }
    p {
      margin-bottom: 0;
    }
  }
}

main {
  padding: 2rem 2px;
  margin-bottom: 5rem;
  isolation: isolate; /* keeps z-index:-1 drop shadows above body's background */

  > .title {
    margin: 0;
    margin-bottom: 1.6rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    .story-date {
      font-family: monospace;
      flex-shrink: 0;
      font-size: 0.9rem;
    }
  }

  p {
    margin-top: 0;
  }

  h1 { margin-bottom: 1rem; }
  .story-title > h1 { margin-bottom: 0; }
  h2 { margin-bottom: 0.8rem; }
  h3 { margin-bottom: 0.75rem; }

  .shadow-header {
    font-family: Arial Rounded MT Bold, Arial, sans-serif;
    font-weight: 800;
    letter-spacing: -1px;
    color: #FFEB3B;
    text-transform: uppercase;
    -webkit-text-stroke: 2px black;
    paint-order: stroke fill;
    position: relative;
    text-decoration: none;
    isolation: isolate;

    &::after {
      content: attr(data-shadow);
      text-transform: uppercase;
      position: absolute;
      left: 2px;
      top: 2px;
      z-index: -1;
      background-color: black;
      background-clip: text;
      -webkit-background-clip: text;
      -webkit-text-fill-color: black;
      -webkit-text-stroke: 1px black;
      paint-order: stroke fill;
    }
  }

  mark {
    background-color: #FFEB3B;
  }

  blockquote {
    border-left: 4px solid #E4D233;
    padding: 1.25rem 1.5rem;
    background: #F2F2F2;
  }

  table {
    width: 100%;

    tr {
      border-bottom: 1px solid #EEE;
      th, td {
        padding: 0.5rem 0.25rem;
      }
      th {
        font-family: monospace;
        text-align: left;
        vertical-align: top;
        padding-right: 1rem;
        padding-left: 0;
        color: #444;
      }
      td {
      }
    }
  }
}

.card {
  background: white;
  border: 1px solid black;
  border-radius: 3px;
  position: relative;
  padding: 1.7rem 2rem;
  flex: 1;

  &::after {
    position: absolute;
    box-sizing: content-box;
    content: ' ';
    left: 1px;
    top: 1px;
    z-index: -1;
    background-color: black;
    border-radius: 3px;
    border: 1px solid black;
    width: 100%;
    height: 100%;
  }
}

a.card {
  color: inherit;
  text-decoration: none;
  &:hover {
    color: inherit;
    background: #FDFDFD;
    &::after {
      background-color: #FFEB3B;
    }
  }
}

.muted { color: #AAA; }

ul#story-list {
  padding: unset;
  margin: unset;
  margin-bottom: 1.5rem;
  margin-top: 1rem;

  > li {
    list-style: none;
    column-gap: .375em;
    margin: 0;
    margin-bottom: 0.5rem;
    border: 1px solid black;
    border-radius: 3px;
    background: white;
    position: relative;

    &::after {
      position: absolute;
      content: ' ';
      box-sizing: content-box;
      left: 1px;
      top: 1px;
      z-index: -1;
      background-color: black;
      border-radius: 3px;
      border: 1px solid black;
      width: 100%;
      height: 100%;
    }

    a {
      color: black;
      text-decoration: none;
      font-size: 1.4rem;
      padding: 1rem 1.2rem;
      display: flex;
      justify-content: space-between;
      align-items: baseline;
    }
    .story-date {
      white-space: nowrap;
      font-family: monospace;
      margin-left: 16px;
      color: #666;
      font-size: 0.9rem;
    }
  }
}

footer {
  color: #AAA;
  text-align: center;
  margin-top: auto;
  padding: 6px 0;
  font-size: 0.8rem;

  a {
    color: #999;
    &:hover { color: #BBB; }
  }
}

/* view transitions: hard cut, no motion */
::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 1ms;
  animation-timing-function: steps(1, end);
  mix-blend-mode: normal;
}
::view-transition-old(*) { opacity: 0; }
::view-transition-new(*) { opacity: 1; }
