/*
 * YITO - 易投 Application Styles
 * ================================
 *
 * 這個檔案包含 Tailwind 無法覆蓋的自定義樣式
 */

/* ===========================
   Base Styles
   =========================== */

:root {
  --dark-gold: #4A4A4A;
  --moon-white: #E5E5E5;
  --bg-dark: #0F0F0F;
}

/* Disable Turbo default top loading bar */
.turbo-progress-bar {
  display: none !important;
}

@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url("/assets/HarmonyOS_Sans_SC_Light-122c4438.woff2") format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url("/assets/HarmonyOS_Sans_SC_Regular-95a3f204.woff2") format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url("/assets/HarmonyOS_Sans_SC_Medium-9b4c251a.woff2") format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'HarmonyOS Sans SC';
  src: url("/assets/HarmonyOS_Sans_SC_Bold-ad5632b6.woff2") format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'I Ming';
  src: url("/assets/I_Ming-b9810dbc.woff2") format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

.course-card-hover {
  transition: all 0.4s ease;
}

a.course-card-hover:hover,
button.course-card-hover:hover,
.course-card-hover[role="link"]:hover {
  border-color: var(--dark-gold);
  box-shadow: 0 8px 32px rgba(74, 74, 74, 0.15);
  transform: translateY(-4px);
}

/* Serif 字體 */
.serif {
  font-family: 'I Ming', serif;
}

/* Tailwind's font-serif utility */
.font-serif {
  font-family: 'I Ming', serif;
}

/* Mono 字體 */
.mono {
  font-family: 'JetBrains Mono', monospace;
}

/* ===========================
   Rail Navigation Tooltips
   =========================== */

.rail-tooltip {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  background: #292524;
  /* stone-800 */
  color: #e7e5e4;
  /* stone-200 */
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
  z-index: 100;
}

.rail-tooltip::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: #292524;
}

.rail-item:hover .rail-tooltip {
  opacity: 1;
  visibility: visible;
}

/* ===========================
   Custom Scrollbar
   =========================== */

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(15, 15, 15, 0.5);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(74, 74, 74, 0.3);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 74, 74, 0.5);
}

/* ===========================
   Safe Area (iOS)
   =========================== */

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.safe-area-top {
  padding-top: env(safe-area-inset-top, 0);
}

/* ===========================
   Ganzhi Time Display
   =========================== */

.ganzhi-time {
  background: linear-gradient(135deg, rgba(74, 74, 74, 0.1) 0%, rgba(15, 15, 15, 0.5) 100%);
}

/* ===========================
   Theme Toggle Switch
   =========================== */

.theme-toggle-switch {
  background-color: #D1D5DB;
}

.theme-toggle-switch[aria-checked="true"] {
  background-color: #4A4A4A;
}

.theme-toggle-switch .theme-toggle-knob {
  left: 2px;
}

.theme-toggle-switch[aria-checked="true"] .theme-toggle-knob {
  left: calc(100% - 18px);
}

.theme-toggle-rail .icon-sun {
  display: none;
}

.theme-toggle-rail[aria-checked="true"] .icon-sun {
  display: block;
}

.theme-toggle-rail[aria-checked="true"] .icon-moon {
  display: none;
}

/* ===========================
   Bottom Tab Bar
   =========================== */

.bottom-tab-item {
  transition: color 0.2s ease;
}

.bottom-tab-item:hover {
  color: #d6d3d1;
  /* stone-300 */
}

body.hide-bottom-nav .bottom-tab-bar {
  display: none;
}

.divination-main-btn {
  transition: transform 0.25s ease, box-shadow 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

.divination-main-btn:hover {
  background-color: oklch(92.3% 0.003 48.717);

}

.divination-main-core {
  width: 40px;
  height: 40px;
  color: #393939;
  display: block;
  animation: breath 2s ease-in-out infinite;
  transition: color 0.3s ease;
}

.divination-main-btn:hover .divination-main-core {

  animation: breath-hover 1.5s ease-in-out infinite;
}

.divination-main-core .ring-outer,
.divination-main-core .ring-middle,
.divination-main-core .ring-inner {
  fill: none;
  stroke: currentColor;
  transition: opacity 0.3s ease, stroke-width 0.3s ease;
}

.divination-main-core .ring-outer {
  stroke-width: 1;
  opacity: 0.6;
}

.divination-main-core .ring-middle {
  stroke-width: 1.2;
  opacity: 0.8;
}

.divination-main-core .ring-inner {
  stroke-width: 1.4;
  opacity: 1;
}

.divination-main-btn:hover .ring-outer {
  stroke-width: 1.5;
  opacity: 0.8;
}

.divination-main-btn:hover .ring-middle {
  stroke-width: 2;
  opacity: 0.9;
}

.divination-main-btn:hover .ring-inner {
  stroke-width: 2.5;
  opacity: 1;
}

@keyframes breath-hover {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

/* ===========================
   Course Sidebar
   =========================== */

.unit-header {
  cursor: pointer;
  transition: all 0.2s ease;
}

.unit-header:hover {
  background: rgba(74, 74, 74, 0.08);
}

.unit-header.active {
  background: rgba(74, 74, 74, 0.15);
}

.accordion-content {
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.lesson-item {
  transition: all 0.2s ease;
}

/* ===========================
   Markdown Content (課程)
   =========================== */

.trix-content {
  font-family: 'HarmonyOS Sans SC', sans-serif;
  line-height: 2;
}

.trix-content h1,
.trix-content h2,
.trix-content h3,
.trix-content h4,
.trix-content h5,
.trix-content h6 {
  font-family: 'I Ming', serif;
  font-weight: 500;
}

.trix-content p {
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.trix-content ul,
.trix-content ol {
  padding-left: 1.5em;
  margin: 0.5em 0;
}

.trix-content ul {
  list-style: disc;
  list-style-position: outside;
}

.trix-content ol {
  list-style: decimal;
  list-style-position: outside;
}

.trix-content li {
  margin: 0.25em 0;
}

.trix-content strong,
.trix-content b {
  font-weight: 500;
}

.trix-content h1 {
  font-size: 1.3em;
  margin-bottom: 0.7em;
}

.trix-content h2 {
  font-size: 1.15em;
  margin-bottom: 0.6em;
}

.trix-content h3 {
  font-size: 1.05em;
  margin-bottom: 0.5em;
}

.trix-editor,
trix-editor {
  min-height: 18rem;
}

.trix-editor {
  max-height: 80vh;
  overflow-y: auto;
}

.rich-embed {
  display: block;

}

.trix-content .rich-embed {}

.trix-content .rich-embed table {
  padding: 1rem;
  border-collapse: separate;
  border-spacing: 0;

}

.trix-content .rich-embed th,
.trix-content .rich-embed td {
  padding: 1rem 1rem;
}

.trix-content .rich-embed .rounded-2xl {
  padding-top: 2rem;
  padding-right: 3rem;
  padding-bottom: 2rem;
  padding-left: 3rem;
}

.trix-content .rich-embed .space-y-4>*+* {
  margin-top: 0.75rem;
}

.trix-content .rich-embed .space-y-5>*+* {
  margin-top: 1rem;
}

.trix-content .rich-embed .space-y-6>*+* {
  margin-top: 1.25rem;
}

.trix-content .rich-embed h4 {
  margin-bottom: 0.75rem;
}

.trix-content .rich-embed .rounded-xl {
  padding: 0.6rem 0.6rem;
}

.trix-content .rich-embed .rounded-xl>div:first-child {
  margin-bottom: 0.25rem;
}

.markdown-content h1 {
  font-family: 'I Ming', serif;
  font-size: 2rem;
  color: var(--moon-white);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

.markdown-content h2 {
  font-family: 'I Ming', serif;
  font-size: 1.5rem;
  color: var(--moon-white);
  margin: 2rem 0 1rem 0;
}

.markdown-content h3 {
  font-family: 'I Ming', serif;
  font-size: 1.25rem;
  color: var(--dark-gold);
  margin: 1.5rem 0 0.75rem 0;
}

.markdown-content p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: #d1d5db;
  line-height: 1.7;
  margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  color: #d1d5db;
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.markdown-content li {
  margin-bottom: 0.5rem;
}

.markdown-content li::marker {
  color: var(--dark-gold);
}

.markdown-content code {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(34, 34, 34, 0.5);
  color: var(--moon-white);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8rem;
}

.markdown-content pre {
  background: rgba(15, 15, 15, 0.8);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.markdown-content pre code {
  background: none;
  padding: 0;
}

.markdown-content blockquote {
  border-left: 2px solid var(--dark-gold);
  padding-left: 1rem;
  margin: 1rem 0;
  font-style: italic;
  color: #9ca3af;
}

/* ===========================
   Divination Animations
   =========================== */

@keyframes breath {

  0%,
  100% {
    transform: scale(0.95);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.breathing-circle {
  animation: breath 4s ease-in-out infinite;
}

@keyframes ripple {

  0%,
  100% {
    transform: translateX(-50%) scale(1);
    box-shadow: 0 0 0 0 rgba(229, 229, 229, 0.4);
  }

  50% {
    transform: translateX(-50%) scale(1.2);
    box-shadow: 0 0 0 8px rgba(229, 229, 229, 0.1);
  }
}

/* ===========================
   Light Theme Overrides
   =========================== */

html:not(.dark) .ganzhi-time {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(74, 74, 74, 0.2);
}

html:not(.dark) .markdown-content h1,
html:not(.dark) .markdown-content h2 {
  color: #1a202c;
}

html:not(.dark) .markdown-content p,
html:not(.dark) .markdown-content li {
  color: #4a5568;
}

html:not(.dark) .markdown-content code {
  background: rgba(74, 74, 74, 0.1);
  color: #1a202c;
}

/* ===========================
   Form Checkbox Override
   =========================== */

input[type="checkbox"] {
  accent-color: #4A4A4A;
}