/* css/styles.css */

html, body {
  overscroll-behavior: none;
  background-color: #ffffff;
  height: 100%;
  width: 100%;
  font-family: 'Rubik', sans-serif;
}

:root {
  --rtcl-teal: #cdfbf1;
}

@font-face {
  font-family: "NanumSquareRound";
  src: url("../assets/fonts/NaverNanumSquareRound/NanumFontSetup_TTF_SQUARE_ROUND/NanumSquareRoundL.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NanumSquareRound";
  src: url("../assets/fonts/NaverNanumSquareRound/NanumFontSetup_TTF_SQUARE_ROUND/NanumSquareRoundR.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NanumSquareRound";
  src: url("../assets/fonts/NaverNanumSquareRound/NanumFontSetup_TTF_SQUARE_ROUND/NanumSquareRoundB.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NanumSquareRound";
  src: url("../assets/fonts/NaverNanumSquareRound/NanumFontSetup_TTF_SQUARE_ROUND/NanumSquareRoundEB.ttf") format("truetype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

[lang="ko"] {
  font-family: "NanumSquareRound", "Rubik", sans-serif;
}

[lang="en"] {
  font-family: "Rubik", sans-serif;
}

[lang="ko"].font-black,
.font-black[lang="ko"] {
  font-weight: 800;
}

[lang="ko"].font-light,
.font-light[lang="ko"] {
  font-weight: 400;
}

[lang="ko"].font-normal,
.font-normal[lang="ko"] {
  font-weight: 500;
}

[lang="ko"].font-medium,
.font-medium[lang="ko"] {
  font-weight: 600;
}

[lang="ko"].font-semibold,
.font-semibold[lang="ko"] {
  font-weight: 700;
}

[lang="ko"].font-bold,
.font-bold[lang="ko"] {
  font-weight: 800;
}

/* Vocab page: English glyph/date weight is language-defined, not system-defined */
#view-vocab [lang="en"].rtcl-vocab-lang-glyph {
  font-weight: 400;
}

#view-vocab .rtcl-vocab-date[lang="en"] {
  font-weight: 500;
}

h1[lang="ko"],
h2[lang="ko"],
h3[lang="ko"],
h4[lang="ko"],
h5[lang="ko"],
h6[lang="ko"],
.text-6xl[lang="ko"],
.text-5xl[lang="ko"],
.text-4xl[lang="ko"],
.text-3xl[lang="ko"] {
  font-weight: 800;
}

[lang="en"].font-semibold,
.font-semibold[lang="en"] {
  font-weight: 500;
}

[lang="en"].font-bold,
.font-bold[lang="en"] {
  font-weight: 600;
}

[lang="en"].font-black,
.font-black[lang="en"] {
  font-weight: 800;
}

.rtcl-nav-active {
  color: var(--rtcl-teal);
}

.rtcl-nav-active:hover {
  color: var(--rtcl-teal);
}

/* Sidebar: align icons slightly higher within square slots */
.rtcl-sidebar-nav .rtcl-sidebar-nav-icon {
  top: calc(50% - 5px);
}

.rtcl-sidebar-nav .active .rtcl-sidebar-nav-icon {
  top: 1rem;
}

.rtcl-sidebar-btn i,
.rtcl-sidebar-btn svg {
  transform: translateY(-5px);
}
/* =========================
   Scrollbars
   ========================= */

/* Default custom scrollbar */
/* Default custom scrollbar (fallback) */
.custom-scrollbar {
  scrollbar-color: #171717 transparent;
  scrollbar-width: auto;
}
.custom-scrollbar::-webkit-scrollbar { width: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #171717;
  border-radius: 4px;
  min-height: 28px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #2a2a2a; }

/* Ensure reader pane uses the custom scrollbar even without the class */
#view-read > div.flex-1 {
  scrollbar-color: transparent transparent;
  scrollbar-width: none;
}
#view-read > div.flex-1::-webkit-scrollbar { width: 0; height: 0; }

/* Hide scrollbar for Dock but allow scrolling */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar {
  -ms-overflow-style: none;   /* IE and Edge */
  scrollbar-width: none;      /* Firefox */
}

/* =========================
   Reader Typography
   ========================= */

#readerBody p {
  margin-bottom: 1.5em;
  line-height: 1.8;
  color: #333;
  font-size: 1.15rem;
  text-align: justify;
}

#readerBody h2 {
  font-size: 1.6em;
  font-weight: 700;
  margin-top: 2em;
  margin-bottom: 0.5em;
  color: #111;
  letter-spacing: -0.01em;
}

#readerBody blockquote {
  border-left: 3px solid #14b8a6;
  padding-left: 1.5rem;
  font-style: italic;
  color: #555;
  margin-bottom: 2em;
}

/* =========================
   Clickable Words (Reader)
   ========================= */

/* Base word chip */
#readerBody .rtcl-word {
  cursor: pointer;
  border-radius: 6px;
  padding: 0 0.14em;
  margin: 0 -0.02em;
  transition: background-color 120ms ease, color 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

/* Hover = light grey (as requested) */
#readerBody .rtcl-word:hover {
  background: rgba(0,0,0,0.06);
}

/* Avoid highlighting inside links */
#readerBody a .rtcl-word {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

:root {
  --rtcl-mint: #cdfbf1;
}

.rtcl-brand-bg {
  background: var(--rtcl-mint);
}

#view-read {
  --rtcl-square: 53px;
  --rtcl-strip-h: 53px;
  --rtcl-mint: #cdfbf1;
  --rtcl-faux-scrollbar-w: 10px;
  --rtcl-vocab-w: 350px;
  --rtcl-header-pad: calc(var(--rtcl-square) - 40px);
  --rtcl-date-gap: 30px;
}

.rtcl-reader-strip {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--rtcl-strip-h);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 calc(24px + var(--rtcl-faux-scrollbar-w)) 0 24px;
  width: 100%;
  isolation: isolate;
}

.rtcl-reader-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--rtcl-mint, #cdfbf1);
  opacity: 1;
  transition: opacity 200ms ease;
  z-index: -1;
}

.rtcl-reader-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: none;
  position: relative;
  z-index: 1;
}

.rtcl-reader-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111111;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  transition: background 200ms ease, box-shadow 200ms ease, color 200ms ease, border-color 200ms ease;
}

#view-read.rtcl-reader-controls-float .rtcl-reader-strip {
  pointer-events: auto;
}

#view-read.rtcl-reader-controls-float .rtcl-reader-strip::before {
  opacity: 0;
}

#view-read.rtcl-reader-controls-float .rtcl-reader-controls {
  position: relative;
  top: 0;
  right: 0;
  z-index: 1;
  opacity: 1;
  pointer-events: auto;
}

#view-read.rtcl-reader-controls-float .rtcl-reader-btn {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

#view-read.rtcl-reader-controls-float .rtcl-reader-controls::before {
  content: "";
  position: absolute;
  inset: -0px -0px;
  background: var(--rtcl-mint, #cdfbf1);
  border-radius: 4px;
  border: none;
  z-index: -1;
}

@media (min-width: 1280px) {
  #view-read.rtcl-reader-controls-float .rtcl-reader-controls {
    right: 0;
  }
}

#readerHeader {
  padding-top: var(--rtcl-header-pad);
  position: relative;
}

#readerDate {
  position: relative;
  top: 0;
  transform: none;
  display: inline-block;
  margin-bottom: var(--rtcl-date-gap);
}

/* =========================
   Seam + Sidebar Padding/Scroll
   ========================= */

/* IMPORTANT:
   - Reader scrollbars should sit *exactly* on the seam between panes.
   - Vocab list scrollbars should sit on the seam between panes.
*/

/* The left reading pane (the scrollable div) */
#view-read > div.flex-1 {
  /* Remove right border so the seam comes from the vocab sidebar border */
  border-right: none !important;

  /* No padding gap; faux scrollbar sits outside the pane */
  padding-right: 0 !important;

  /* Helps keep layout stable when scrollbars appear */
  scrollbar-gutter: stable both-edges;
  overflow-y: scroll;
}

/* Faux scrollbar for reader pane (always visible, starts below strip) */
.rtcl-faux-scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--rtcl-faux-scrollbar-w);
  pointer-events: auto;
  z-index: 60;
}

.rtcl-faux-scrollbar-thumb {
  position: absolute;
  left: 0;
  right: 0;
  background: #171717;
  border-radius: 0px;
  min-height: 28px;
  cursor: grab;
}

.rtcl-faux-scrollbar-thumb:active {
  cursor: grabbing;
}

@media (min-width: 1280px) {
  #view-read .rtcl-faux-scrollbar {
    right: var(--rtcl-vocab-w);
  }
}

/* Vocab page list pane: keep scrollbar on the seam, not inside padding */
#view-vocab .rtcl-vocab-pane {
  padding-right: 0 !important;
  scrollbar-gutter: stable;
  margin-right: -2.5px;
}

#view-vocab .max-w-\[1400px\] {
  padding-right: 3rem;
}

/* The vocab sidebar (right pane) */
#vocabSidebar,
#vocabPageSidebar {
  /* remove bottom padding blank space */
  padding-bottom: 0 !important;
  padding-top: 1.5rem !important;
  position: relative;

  /* move scrollbar to right edge by not reserving inner padding */
  padding-right: 0 !important;

  /* keep seam line */
  border-left: 1px solid rgba(0,0,0,0.06);
}

#vocabSidebar [data-rtcl-i18n="dictionaryHeader"] {
  margin-bottom: 1rem !important;
}

.rtcl-vocab-save-btn {
  position: absolute;
  top: 1rem;
  right: 2rem;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #171717;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
  z-index: 3;
}

.rtcl-vocab-save-btn[data-saved="1"] {
  background: transparent;
  border-color: transparent;
  color: #171717;
}

.rtcl-vocab-save-btn.hidden {
  display: none;
}

.rtcl-vocab-save-btn svg {
  fill: none;
  stroke: #171717;
}

.rtcl-vocab-save-btn[data-saved="1"] svg {
  fill: #171717;
  stroke: #171717;
}

/* Inner scrolling areas inside sidebars:
   keep right padding for content, but allow scrollbar at edge */
#vocabDetail,
#vocabPageDetail {
  padding-right: 0 !important;
  padding-bottom: 0 !important;
  scrollbar-gutter: stable both-edges;
}

/* Subtle top divider appears only after scrolling the dictionary panes */
#vocabDetail,
#vocabPageDetail {
  position: relative;
  scrollbar-width: none;
}

#vocabDetail::-webkit-scrollbar,
#vocabPageDetail::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#vocabDetail .rtcl-scroll-divider,
#vocabPageDetail .rtcl-scroll-divider {
  position: sticky;
  top: 0;
  height: 1px;
  margin-top: -1px;
  background: rgba(0,0,0,0.08);
  opacity: 0;
  z-index: 2;
}

#vocabDetail.rtcl-scrolled .rtcl-scroll-divider,
#vocabPageDetail.rtcl-scrolled .rtcl-scroll-divider {
  opacity: 1;
}

/* Provide content padding without pushing scrollbar inward */
#vocabDetail > *,
#vocabPageDetail > * {
  padding-right: 2rem; /* matches your sidebar spacing vibe */
}

/* Make sure the very last block doesn't create "blank bottom" */
#vocabDetail > :last-child,
#vocabPageDetail > :last-child {
  padding-bottom: 2rem;
}

/* =========================
   Vocab Header Underline (Landing page style)
   ========================= */

#vocabWord,
#vocabPageWord {
  text-decoration-line: underline;
  text-decoration-color: var(--rtcl-teal);
  text-decoration-thickness: 10px; /* "decoration-[10px]" equivalent */
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
}

/* =========================
   Vocab Page Selection Styling
   ========================= */

.rtcl-vocab-item.is-selected {
  box-shadow: 0 0 0 2px var(--rtcl-teal);
}

/* Optional: slightly clearer focus state for keyboard nav */
.rtcl-vocab-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20,184,166,0.25);
}

/* =========================
   Minor polish
   ========================= */

/* Ensure sidebar scrollbars render at the true edge on Windows too */
#vocabSidebar,
#vocabPageSidebar,
#view-read > div.flex-1 {
  scrollbar-width: none;            /* Firefox */
  scrollbar-color: transparent transparent;
}

/* Vocab page selected item border */
.rtcl-vocab-item.is-selected {
  border-color: var(--rtcl-teal) !important;
  border-width: 1px !important;
}
