:root {
  color-scheme: light;
  --ink: #243a44;
  --ink-soft: #526873;
  --paper: #fbf7eb;
  --paper-deep: #eee4cc;
  --desk: #dce8e3;
  --desk-dark: #aac3ba;
  --coral: #d75d4b;
  --coral-dark: #a93d31;
  --yellow: #efc65b;
  --white: #fffdf7;
  --line: #a9b7b2;
  --shadow: 0 18px 45px rgba(34, 58, 68, 0.14);
  font-family:
    "Yu Gothic UI",
    "Yu Gothic",
    BIZ UDPGothic,
    Meiryo,
    system-ui,
    sans-serif;
  line-height: 1.65;
  color: var(--ink);
  background: #f2f6f3;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f2f6f3;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--ink);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  z-index: 100;
  left: 1rem;
  top: -5rem;
  padding: 0.65rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 0.3rem;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
.site-footer,
main {
  width: min(76rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.6rem;
  border-bottom: 1px solid rgba(36, 58, 68, 0.18);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.mini-paper {
  position: relative;
  display: block;
  width: 2rem;
  height: 1.7rem;
}

.mini-paper i {
  position: absolute;
  display: block;
  width: 1.45rem;
  height: 1.25rem;
  border: 2px solid var(--ink);
  background: var(--paper);
  border-radius: 0.12rem;
}

.mini-paper i:first-child {
  left: 0;
  bottom: 0;
  transform: rotate(-7deg);
}

.mini-paper i:last-child {
  right: 0;
  top: 0;
  transform: rotate(6deg);
}

.site-header nav,
.site-footer span:last-child {
  display: flex;
  gap: 1.1rem;
}

.site-header nav a,
.site-footer a {
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
}

.home {
  padding-block: 2rem 5rem;
}

.research-desk {
  position: relative;
  display: grid;
  grid-template-columns: minmax(17rem, 0.8fr) minmax(18rem, 0.72fr);
  grid-template-areas:
    "heading scene"
    "form form";
  gap: 1.5rem 3rem;
  overflow: hidden;
  padding: clamp(1.3rem, 3vw, 2.6rem);
  border: 1px solid var(--desk-dark);
  border-radius: 1rem 1rem 0.35rem 0.35rem;
  background: var(--desk);
  box-shadow: var(--shadow);
}

.research-desk::before {
  content: "";
  position: absolute;
  width: 9rem;
  height: 9rem;
  right: 34%;
  top: -6rem;
  border: 1.7rem solid rgba(215, 93, 75, 0.15);
  border-radius: 50%;
}

.product-heading {
  position: relative;
  z-index: 2;
  grid-area: heading;
  align-self: center;
}

.eyebrow,
.section-heading p,
.saved-tray header p,
.content-heading p {
  margin: 0 0 0.35rem;
  color: var(--coral-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.product-heading h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  line-height: 1.28;
  letter-spacing: 0.02em;
}

.product-heading > p:last-child {
  max-width: 32rem;
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-weight: 600;
}

.paper-trail-scene {
  position: relative;
  grid-area: scene;
  align-self: center;
  min-height: 14rem;
}

.journal-stack {
  position: absolute;
  left: 0;
  bottom: 1.3rem;
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
}

.journal-stack span {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 9.4rem;
  padding: 0.5rem;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid #172930;
  border-radius: 0.2rem 0.2rem 0.05rem 0.05rem;
  font-family: "Yu Mincho", YuMincho, serif;
  font-weight: 700;
  writing-mode: vertical-rl;
  box-shadow: 0.3rem 0.45rem 0 rgba(36, 58, 68, 0.16);
}

.journal-stack span:nth-child(2) {
  height: 8.2rem;
  color: var(--ink);
  background: var(--yellow);
}

.journal-stack span:nth-child(3) {
  height: 10.2rem;
  background: #48766d;
}

.paper-sheet {
  position: absolute;
  width: min(15.5rem, 64%);
  height: 10.6rem;
  right: 1rem;
  top: 1.2rem;
  padding: 1.2rem;
  border: 1px solid #c7baa0;
  background: var(--paper);
  box-shadow: 0.45rem 0.55rem 0 rgba(36, 58, 68, 0.12);
}

.sheet-back {
  transform: rotate(-7deg) translate(-1.5rem, 0.6rem);
  background: #f1ead8;
}

.sheet-front {
  transform: rotate(3deg);
}

.paper-sheet b {
  display: inline-grid;
  place-items: center;
  width: 3.1rem;
  height: 1.7rem;
  color: white;
  background: var(--coral);
  border-radius: 50%;
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.paper-sheet i {
  display: block;
  width: 88%;
  height: 0.34rem;
  margin-top: 1rem;
  background: #b9c7c1;
  border-radius: 1rem;
}

.paper-sheet i:nth-of-type(2) {
  width: 72%;
}

.paper-sheet i:nth-of-type(3) {
  width: 55%;
}

.paperclip {
  position: absolute;
  right: 1rem;
  top: -0.75rem;
  width: 1.4rem;
  height: 3rem;
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 1rem 1rem 0 0;
  transform: rotate(9deg);
}

.citation-slip {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.45rem;
  width: 9.5rem;
  padding: 0.65rem;
  border: 1px dashed var(--coral-dark);
  background: var(--white);
  transform: rotate(-4deg);
}

.citation-slip span {
  color: var(--coral-dark);
  font-size: 0.65rem;
  font-weight: 800;
}

.citation-slip i {
  align-self: center;
  height: 1px;
  background: var(--line);
}

.search-form {
  position: relative;
  z-index: 4;
  grid-area: form;
  padding: clamp(1rem, 2.5vw, 1.6rem);
  border: 1px solid rgba(36, 58, 68, 0.28);
  border-radius: 0.55rem;
  background: rgba(255, 253, 247, 0.94);
}

.query-line > label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.query-slot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  border: 2px solid var(--ink);
  border-radius: 0.45rem;
  overflow: hidden;
  background: white;
}

.search-mark {
  display: grid;
  place-items: center;
  width: 3.25rem;
  color: white;
  background: var(--ink);
  font-family: "Yu Mincho", YuMincho, serif;
  font-weight: 800;
}

.query-slot input {
  width: 100%;
  min-width: 0;
  padding: 0.9rem 0.8rem;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: white;
}

.query-slot input:focus {
  box-shadow: inset 0 0 0 3px rgba(239, 198, 91, 0.55);
}

.query-slot button,
.page-cta {
  display: inline-grid;
  place-items: center;
  padding: 0.75rem 1.25rem;
  border: 0;
  color: white;
  background: var(--coral);
  font-weight: 800;
  text-decoration: none;
}

.query-slot button:hover,
.page-cta:hover {
  background: var(--coral-dark);
}

.query-slot button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.refine-panel {
  margin-top: 0.85rem;
  border-top: 1px solid var(--paper-deep);
}

.refine-panel summary {
  width: fit-content;
  padding: 0.7rem 0.2rem 0.2rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.refine-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 0.65fr 0.65fr 0.9fr;
  align-items: end;
  gap: 0.7rem;
  padding-top: 0.8rem;
}

.refine-grid label {
  display: grid;
  gap: 0.25rem;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
}

.refine-grid input,
.refine-grid select {
  width: 100%;
  min-width: 0;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.3rem;
  color: var(--ink);
  background: white;
}

.refine-grid .check-line {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: fit-content;
}

.check-line input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--coral);
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.examples > span {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
}

.examples button {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  color: var(--ink);
  background: #f6f1e4;
  font-size: 0.72rem;
  font-weight: 700;
}

.examples button:hover {
  border-color: var(--coral);
  background: white;
}

.search-status {
  margin: 0.7rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.search-form.is-loading .search-mark {
  animation: stamp 0.8s ease-in-out infinite alternate;
}

@keyframes stamp {
  to {
    color: var(--yellow);
  }
}

.source-ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.8rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 0 0 0.45rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
}

.source-ribbon span::before {
  content: "●";
  margin-right: 0.45rem;
  color: var(--yellow);
}

.source-ribbon a {
  margin-left: auto;
  color: white;
}

.work-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  gap: 1.5rem;
  align-items: start;
  margin-top: 2rem;
}

.results,
.saved-tray {
  min-width: 0;
}

.section-heading,
.saved-tray header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-heading h2,
.saved-tray h2 {
  margin: 0;
  font-size: 1.25rem;
}

.section-heading > span {
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.result-list {
  display: grid;
  gap: 0.8rem;
}

.paper-card {
  position: relative;
  overflow: hidden;
  padding: 1.15rem 1.1rem 1.1rem 4.6rem;
  border: 1px solid #cabfa8;
  border-radius: 0.35rem;
  background: var(--white);
  box-shadow: 0.22rem 0.25rem 0 rgba(36, 58, 68, 0.08);
}

.paper-card::after {
  content: "";
  position: absolute;
  left: 4rem;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(215, 93, 75, 0.38);
}

.paper-edge {
  position: absolute;
  z-index: 1;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 4rem;
  height: 100%;
  color: var(--ink);
  background: #eee5ce;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  writing-mode: vertical-rl;
}

.paper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.doi-mark {
  display: inline-grid;
  place-items: center;
  min-width: 2.8rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--coral);
  border-radius: 50%;
  color: var(--coral-dark);
  font-family: ui-monospace, monospace;
  font-size: 0.64rem;
}

.paper-card h3 {
  margin: 0.6rem 0 0.35rem;
  font-family: "Yu Mincho", YuMincho, serif;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  line-height: 1.55;
}

.paper-authors {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
}

.update-notice {
  margin: 0.7rem 0 0;
  padding: 0.45rem 0.6rem;
  border-left: 3px solid var(--coral);
  color: #74342d;
  background: #fae5df;
  font-size: 0.74rem;
  font-weight: 700;
}

.paper-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.7rem;
  margin: 0.8rem 0;
  padding-top: 0.7rem;
  border-top: 1px dashed #c7baa0;
  font-size: 0.74rem;
}

.paper-meta dt {
  color: var(--ink-soft);
  font-weight: 800;
}

.paper-meta dd {
  margin: 0;
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.paper-actions a,
.paper-actions button {
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 0.28rem;
  color: var(--ink);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
}

.paper-actions a {
  color: white;
  background: var(--ink);
}

.paper-actions button:hover,
.paper-actions button.is-saved,
.paper-actions button.is-done {
  border-color: var(--coral);
  color: var(--coral-dark);
  background: #fae5df;
}

.saved-tray {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  border: 1px solid #9baea7;
  border-top: 0.55rem solid var(--ink);
  border-radius: 0.25rem;
  background: #d6e4df;
  box-shadow: 0.35rem 0.4rem 0 rgba(36, 58, 68, 0.1);
}

.tray-tab {
  width: fit-content;
  margin: -1.55rem auto 0.75rem;
  padding: 0.25rem 1.2rem;
  color: white;
  background: var(--ink);
  border-radius: 0.25rem 0.25rem 0 0;
  font-size: 0.7rem;
  font-weight: 800;
}

.saved-tray header strong {
  display: grid;
  place-items: center;
  min-width: 2.2rem;
  height: 2.2rem;
  border: 2px solid var(--coral);
  border-radius: 50%;
  color: var(--coral-dark);
  background: var(--paper);
  font-family: ui-monospace, monospace;
}

.saved-stack {
  display: grid;
  gap: 0.55rem;
  max-height: 64vh;
  overflow: auto;
}

.empty-saved {
  margin: 0;
  padding: 1rem;
  border: 1px dashed var(--line);
  color: var(--ink-soft);
  background: rgba(255, 253, 247, 0.65);
  font-size: 0.78rem;
}

.saved-slip {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.2rem 0.55rem;
  align-items: center;
  padding: 0.65rem;
  border: 1px solid #c7baa0;
  background: var(--paper);
  transform: rotate(-0.4deg);
}

.saved-slip:nth-child(even) {
  transform: rotate(0.5deg);
}

.saved-slip > span {
  grid-row: 1 / 3;
  color: var(--coral-dark);
  font-family: ui-monospace, monospace;
  font-size: 0.64rem;
  font-weight: 800;
}

.saved-slip a {
  overflow: hidden;
  font-family: "Yu Mincho", YuMincho, serif;
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-slip small {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-saved {
  grid-row: 1 / 3;
  grid-column: 3;
  padding: 0.25rem;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.65rem;
}

.clear-button {
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 700;
}

.empty-result,
.no-result {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 9rem;
  padding: 1.3rem;
  border: 1px dashed var(--line);
  border-radius: 0.35rem;
  background: rgba(255, 253, 247, 0.72);
}

.empty-seal,
.no-result > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 3.5rem;
  height: 3.5rem;
  border: 2px solid var(--coral);
  border-radius: 50%;
  color: var(--coral-dark);
  font-family: "Yu Mincho", YuMincho, serif;
  font-size: 1.25rem;
  font-weight: 800;
}

.empty-result h3,
.no-result h3 {
  margin: 0;
  font-size: 1rem;
}

.empty-result p,
.no-result p {
  margin: 0.25rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.content-page {
  padding-block: 3rem 6rem;
}

.content-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--ink);
}

.page-index {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 2px solid var(--coral);
  border-radius: 50%;
  color: var(--coral-dark);
  background: var(--paper);
  font-family: "Yu Mincho", YuMincho, serif;
  font-size: 1.35rem;
  font-weight: 800;
}

.content-heading h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.35;
}

.instruction-grid,
.source-grid,
.privacy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.instruction-grid section,
.source-ledger,
.privacy-grid section,
.notice-box {
  padding: 1.25rem;
  border: 1px solid #c7baa0;
  border-radius: 0.35rem;
  background: var(--white);
  box-shadow: 0.2rem 0.22rem 0 rgba(36, 58, 68, 0.08);
}

.instruction-grid b {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: white;
  background: var(--ink);
}

.instruction-grid h2,
.source-ledger h2,
.privacy-grid h2 {
  margin: 0.75rem 0 0.5rem;
  font-size: 1rem;
}

.instruction-grid p,
.source-ledger p,
.privacy-grid p,
.notice-box p {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.notice-box {
  margin-top: 1rem;
  border-left: 0.4rem solid var(--coral);
}

.page-cta {
  width: fit-content;
  margin-top: 1.5rem;
  border-radius: 0.3rem;
}

.not-found {
  display: grid;
  place-items: center;
  min-height: 65vh;
  align-content: center;
  text-align: center;
}

.not-found > span {
  color: var(--coral);
  font-family: ui-monospace, monospace;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.not-found h1 {
  margin: 0.6rem 0;
  font-size: 1.8rem;
}

.not-found p {
  color: var(--ink-soft);
}

.not-found a {
  padding: 0.55rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 0.25rem;
  font-weight: 800;
  text-decoration: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid rgba(36, 58, 68, 0.18);
  color: var(--ink-soft);
  font-size: 0.72rem;
}

@media (max-width: 900px) {
  .refine-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .work-area {
    grid-template-columns: 1fr;
  }

  .saved-tray {
    position: static;
  }
}

@media (max-width: 720px) {
  .site-header,
  .site-footer,
  main {
    width: min(100% - 1rem, 76rem);
  }

  .site-header {
    min-height: 4rem;
  }

  .site-header nav {
    gap: 0.65rem;
  }

  .site-header nav a {
    font-size: 0.72rem;
  }

  .research-desk {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "scene"
      "form";
    gap: 1rem;
  }

  .paper-trail-scene {
    min-height: 11rem;
  }

  .journal-stack span {
    height: 7.2rem;
  }

  .journal-stack span:nth-child(2) {
    height: 6.3rem;
  }

  .journal-stack span:nth-child(3) {
    height: 7.8rem;
  }

  .paper-sheet {
    height: 8.5rem;
  }

  .query-slot {
    grid-template-columns: auto 1fr;
  }

  .query-slot button {
    grid-column: 1 / -1;
  }

  .refine-grid,
  .instruction-grid,
  .source-grid,
  .privacy-grid {
    grid-template-columns: 1fr;
  }

  .paper-card {
    padding-left: 1rem;
    padding-top: 3.2rem;
  }

  .paper-card::after {
    display: none;
  }

  .paper-edge {
    width: auto;
    height: 2.4rem;
    padding-inline: 0.8rem;
    writing-mode: horizontal-tb;
  }

  .source-ribbon a {
    margin-left: 0;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
