@font-face {
  font-family: "IGBTMono";
  src: url("/assets/fonts/igbt/BIZUDGothic-Regular-strip.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "IGBTMono";
  src: url("/assets/fonts/igbt/BIZUDGothic-Bold-strip.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: block;
}

@font-face {
  font-family: "IGBTMono";
  src: url("/assets/fonts/igbt/GenYoGothic2-JP-R-kanji.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: block;
  unicode-range:
    U+2E80-2EFF,
    U+3000-303F,
    U+31C0-31EF,
    U+3400-4DBF,
    U+4E00-9FFF,
    U+F900-FAFF,
    U+FF00-FFEF,
    U+20000-2A6DF,
    U+2A700-2B73F,
    U+2B740-2B81F,
    U+2B820-2CEAF,
    U+2CEB0-2EBEF,
    U+30000-3134F;
}

@font-face {
  font-family: "IGBTMono";
  src: url("/assets/fonts/igbt/GenYoGothic2-JP-R-kanji.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: block;
  unicode-range:
    U+2E80-2EFF,
    U+3000-303F,
    U+31C0-31EF,
    U+3400-4DBF,
    U+4E00-9FFF,
    U+F900-FAFF,
    U+FF00-FFEF,
    U+20000-2A6DF,
    U+2A700-2B73F,
    U+2B740-2B81F,
    U+2B820-2CEAF,
    U+2CEB0-2EBEF,
    U+30000-3134F;
}

.feed-shell {
  --fg: #080808;
  --bg: #fdfdfd;
  --panel: #ffffff;
  --soft: #f0f0f0;
  --line: #cccccc;
  --dim: #666666;
  --active: #e8e8e8;
  --danger: #aa0000;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  overflow: auto;
  background: var(--bg);
  color: var(--fg);
  font-family: "IGBTMono", monospace;
  font-synthesis: none;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0;
}

.feed-shell *,
.feed-shell *::before,
.feed-shell *::after {
  box-sizing: border-box;
  border-radius: 0;
  letter-spacing: 0;
  scrollbar-width: thin;
  scrollbar-color: #000000 #f0f0f0;
}

.feed-shell *::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  display: block;
}

.feed-shell *::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-left: 1px solid var(--line);
}

.feed-shell *::-webkit-scrollbar-thumb {
  background: #000000;
}

.feed-shell button,
.feed-shell input,
.feed-shell a {
  font: inherit;
}

.feed-app,
.feed-boot {
  height: 100dvh;
  min-height: 100dvh;
}

.feed-app {
  --feed-sidebar-width: 220px;
  --feed-stream-width: 560px;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  background: var(--bg);
}

.feed-boot {
  display: grid;
  place-items: center;
  color: var(--fg);
  font-size: 12px;
  text-transform: uppercase;
}

.feed-toolbar {
  min-width: 0;
  display: grid;
  grid-template-columns: 220px minmax(160px, 1fr) auto;
  border-bottom: 1px solid var(--fg);
  background: var(--panel);
}

.feed-path,
.feed-search-wrap,
.feed-toolbar-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  border-right: 1px solid var(--line);
}

.feed-path {
  gap: 8px;
  padding: 0 10px;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  background: var(--panel);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.feed-pixel {
  width: 12px;
  height: 12px;
  display: inline-block;
  background:
    linear-gradient(90deg, #000 50%, transparent 0) 0 0 / 4px 4px,
    linear-gradient(#000 50%, transparent 0) 0 0 / 4px 4px;
  border: 1px solid var(--fg);
  image-rendering: pixelated;
}

.feed-search-wrap {
  padding: 0;
}

.feed-search {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--fg);
}

.feed-search:focus {
  background: var(--soft);
}

.feed-search::placeholder {
  color: var(--dim);
  opacity: 1;
}

.feed-toolbar-actions {
  border-right: 0;
}

.feed-tool {
  min-width: 58px;
  height: 43px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
}

.feed-tool:hover,
.feed-tool:focus-visible,
.feed-source:hover,
.feed-source:focus-visible,
.feed-item:hover,
.feed-item:focus-visible,
.feed-reader-back:hover,
.feed-reader-back:focus-visible {
  background: var(--soft);
  outline: 0;
}

.feed-tool.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

.feed-grid {
  height: calc(100dvh - 44px);
  min-height: 0;
  display: grid;
  grid-template-columns: var(--feed-sidebar-width) minmax(320px, var(--feed-stream-width)) 7px minmax(360px, 1fr);
}

.feed-sources,
.feed-stream,
.feed-reader-panel {
  min-width: 0;
  height: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-right: 1px solid var(--fg);
}

.feed-reader-panel {
  border-right: 0;
}

.feed-resizer {
  width: 7px;
  min-width: 7px;
  height: 100%;
  border-right: 1px solid var(--fg);
  background:
    repeating-linear-gradient(
      to bottom,
      #ffffff 0,
      #ffffff 5px,
      #cccccc 5px,
      #cccccc 6px
    );
  cursor: col-resize;
}

.feed-resizer:hover,
.feed-resizer:focus-visible {
  background: #000000;
  outline: 0;
}

body.feed-resizing {
  cursor: col-resize;
  user-select: none;
}

.feed-status,
.feed-stream-head,
.feed-reader-bar,
.feed-item-top,
.feed-reader-meta {
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.feed-status,
.feed-stream-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.feed-source-list,
.feed-items {
  display: grid;
}

.feed-source,
.feed-item {
  width: 100%;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.feed-source {
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}

.feed-source span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-source.is-active,
.feed-item.is-active {
  background: #000000;
  color: #ffffff;
}

.feed-source.is-error:not(.is-active) {
  color: var(--danger);
}

.feed-item {
  min-height: 118px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-content: start;
  padding: 12px;
}

.feed-item:has(.feed-item-image) {
  grid-template-columns: 88px minmax(0, 1fr);
}

.feed-item-image {
  grid-row: 1 / span 3;
  grid-column: 1;
  width: 88px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid currentColor;
  background: var(--soft);
}

.feed-item-image img,
.feed-reader-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  image-rendering: auto;
}

.feed-item-top,
.feed-item-title,
.feed-item-summary {
  min-width: 0;
}

.feed-item:has(.feed-item-image) .feed-item-top,
.feed-item:has(.feed-item-image) .feed-item-title,
.feed-item:has(.feed-item-image) .feed-item-summary {
  grid-column: 2;
}

.feed-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.feed-item-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.feed-item-summary {
  display: -webkit-box;
  overflow: hidden;
  color: inherit;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.feed-reader {
  min-height: 100%;
  display: grid;
  grid-template-rows: 34px minmax(0, 1fr);
  background: var(--bg);
}

.feed-reader-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.feed-reader-bar span {
  min-width: 0;
  overflow: hidden;
  padding: 0 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-reader-back {
  height: 33px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  color: var(--fg);
  cursor: pointer;
}

.feed-reader-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.feed-reader-head {
  padding: 24px clamp(18px, 5vw, 56px) 18px;
  border-bottom: 1px solid var(--line);
}

.feed-reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.feed-reader-image {
  max-width: min(100%, 720px);
  margin: 0 0 18px;
  border: 1px solid var(--fg);
  background: var(--soft);
}

.feed-reader-image img {
  max-height: 44vh;
  object-fit: cover;
}

.feed-reader h1 {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 1.35;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.feed-reader-body {
  width: min(100% - 36px, 42em);
  max-width: 42em;
  padding: 24px 0 64px;
  margin: 0 clamp(18px, 5vw, 56px);
}

.feed-reader-body p {
  margin: 0 0 1.2em;
  font-size: 16px;
  line-height: 1.85;
  text-align: justify;
  text-justify: inter-ideograph;
  overflow-wrap: break-word;
  hyphens: auto;
}

.feed-reader-inline-image {
  width: 100%;
  margin: 24px 0;
  border: 1px solid var(--fg);
  background: var(--soft);
}

.feed-reader-inline-image img {
  width: 100%;
  max-height: 68vh;
  display: block;
  object-fit: contain;
  image-rendering: auto;
}

.feed-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.feed-empty-reader {
  min-height: 100%;
}

.feed-app.is-reader-mode .feed-toolbar {
  grid-template-columns: 220px minmax(160px, 1fr) auto;
}

.feed-app.is-reader-mode .feed-grid {
  grid-template-columns: 0 0 0 minmax(0, 1fr);
}

.feed-app.is-reader-mode .feed-sources,
.feed-app.is-reader-mode .feed-stream,
.feed-app.is-reader-mode .feed-resizer {
  overflow: hidden;
  border-right: 0;
  visibility: hidden;
}

.feed-app.is-sidebar-hidden {
  --feed-sidebar-width: 0px;
}

.feed-app.is-sidebar-hidden .feed-sources {
  overflow: hidden;
  border-right: 0;
  visibility: hidden;
}

.feed-app.is-reader-mode .feed-reader-panel {
  border-left: 0;
}

.feed-app.is-reader-mode .feed-reader h1 {
  font-size: clamp(30px, 4.2vw, 56px);
}

.feed-app.is-loading .feed-pixel {
  animation: feed-blink 0.8s steps(2, end) infinite;
}

@keyframes feed-blink {
  50% {
    opacity: 0.25;
  }
}

@media (max-width: 860px) {
  .feed-shell {
    overflow: auto;
  }

  .feed-app {
    min-height: 100dvh;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .feed-toolbar {
    grid-template-columns: 1fr auto;
  }

  .feed-search-wrap {
    grid-column: 1 / -1;
    height: 42px;
    order: 3;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .feed-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 34dvh 52dvh minmax(74dvh, auto);
    height: auto;
    overflow: visible;
  }

  .feed-sources,
  .feed-stream,
  .feed-reader-panel {
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--fg);
  }

  .feed-sources {
    height: 34dvh;
    max-height: none;
    overflow: auto;
  }

  .feed-stream {
    height: 52dvh;
    max-height: none;
    overflow: auto;
  }

  .feed-reader-panel {
    min-height: 72dvh;
  }

  .feed-resizer {
    display: none;
  }

  .feed-reader-body {
    width: auto;
    max-width: none;
    padding: 18px 16px 56px;
    margin: 0;
  }

  .feed-reader-head {
    padding: 20px 16px 16px;
  }

  .feed-app.is-reader-mode {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .feed-app.is-reader-mode .feed-grid {
    min-height: 100%;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }

  .feed-app.is-reader-mode .feed-sources,
  .feed-app.is-reader-mode .feed-stream,
  .feed-app.is-reader-mode .feed-resizer {
    display: none;
  }

  .feed-app.is-reader-mode .feed-reader-panel {
    min-height: calc(100dvh - 87px);
    overflow: auto;
  }
}

@media (max-width: 520px) {
  .feed-toolbar {
    grid-template-columns: 1fr;
  }

  .feed-path {
    min-height: 42px;
    border-right: 0;
  }

  .feed-toolbar-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--line);
  }

  .feed-tool {
    min-width: 0;
    width: 100%;
    height: 38px;
  }

  .feed-source {
    min-height: 36px;
  }

  .feed-item {
    min-height: 104px;
    padding: 10px;
  }

  .feed-item:has(.feed-item-image) {
    min-height: 112px;
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .feed-item-image {
    width: 72px;
  }
}
