/* YKS Program: 3D ders küresi (planner orbit).
   Presentation only. js/yp-orbit.js arranges the planner's own .subject-card
   elements (same DOM nodes, same handlers, same saved state) on a turning
   sphere band. In "Liste" view nothing here applies except the small view
   switch above the cards. */

/* Not inherited: the planner's topic buttons use "transition: all", and an
   inherited registered colour would start a transition on every one of them
   at each turn. The script sets it only where it is used (the backdrop light
   and each card's own glow). */
@property --yp-orbit-accent {
  syntax: '<color>';
  inherits: false;
  initial-value: #8b5cf6;
}

.yp-orbit-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ─── Control strip above the cards ─── */
.yp-orbit-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  margin: 4px 0 16px;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}

.yp-orbit-bar p {
  margin: 0;
}

.yp-orbit-bar[data-view='list'] {
  grid-template-columns: minmax(0, 1fr) auto;
}

.yp-orbit-bar[data-view='list'] .yp-orbit-count,
.yp-orbit-bar[data-view='list'] .yp-orbit-nav {
  display: none;
}

.yp-orbit-count {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.yp-orbit-count b {
  color: #0f172a;
  font-weight: 800;
}

.yp-orbit-count i {
  position: relative;
  display: block;
  width: 48px;
  height: 2px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.14);
}

.yp-orbit-count i::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #06b6d4);
  transform-origin: 0 50%;
  transform: scaleX(var(--yp-orbit-fill, 0));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.yp-orbit-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.yp-orbit-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
}

.yp-orbit-arrow svg {
  width: 18px;
  height: 18px;
}

.yp-orbit-arrow:hover {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.yp-orbit-arrow:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.yp-orbit-rail {
  display: flex;
  gap: 6px;
  min-width: 0;
  padding: 4px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

.yp-orbit-rail::-webkit-scrollbar {
  display: none;
}

.yp-orbit-chip {
  --p: 0;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px 6px 7px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: #1e293b;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  touch-action: manipulation;
}

.yp-orbit-chip:hover {
  border-color: rgba(139, 92, 246, 0.36);
}

.yp-orbit-chip[aria-checked='true'] {
  border-color: transparent;
  background: #0f1d3d;
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 29, 61, 0.28);
}

/* Progress ring: the share of the subject's topics marked done. */
.yp-orbit-chip__ring {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: conic-gradient(#10b981 calc(var(--p) * 1%), rgba(15, 23, 42, 0.12) 0);
}

.yp-orbit-chip__ring::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #fff;
}

.yp-orbit-chip[aria-checked='true'] .yp-orbit-chip__ring {
  background: conic-gradient(#34d399 calc(var(--p) * 1%), rgba(255, 255, 255, 0.22) 0);
}

.yp-orbit-chip[aria-checked='true'] .yp-orbit-chip__ring::after {
  background: #0f1d3d;
}

.yp-orbit-chip__pct {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.yp-orbit-chip[aria-checked='true'] .yp-orbit-chip__pct {
  color: rgba(255, 255, 255, 0.72);
}

/* Reviews waiting: the same tones as the card's own reminder button. */
.yp-orbit-chip__due {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.yp-orbit-chip__due.is-danger {
  background: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18);
}

.yp-orbit-view {
  display: inline-flex;
  padding: 3px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  justify-self: end;
}

.yp-orbit-view button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #334155;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

.yp-orbit-view button svg {
  width: 15px;
  height: 15px;
}

.yp-orbit-view button[aria-pressed='true'] {
  background: #0f1d3d;
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 29, 61, 0.22);
}

.yp-orbit-arrow:focus-visible,
.yp-orbit-chip:focus-visible,
.yp-orbit-view button:focus-visible {
  outline: 3px solid #8b5cf6;
  outline-offset: 2px;
}

/* ─── Stage: backdrop (light and globe lines) and the cards above it ─── */
.yp-orbit-host {
  --yp-stage-w: 100%;
  --yp-stage-ml: 0px;
  --yp-stage-h: 780px;
}

.yp-orbit-backdrop {
  position: relative;
  z-index: 0;
  width: var(--yp-stage-w);
  height: var(--yp-stage-h);
  margin: 0 0 calc(-1 * var(--yp-stage-h)) var(--yp-stage-ml);
  border-radius: 32px;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(120% 85% at 50% -12%, #24427d 0%, #11214a 42%, #080f26 100%);
  box-shadow: 0 30px 80px rgba(8, 15, 38, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* The light behind the cards takes the colour of the subject in front. Two
   layers cross-fade (opacity only, done by the compositor): fading the
   gradient's colour instead would repaint the whole stage on every frame. */
.yp-orbit-light {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(30% 38% at 50% 50%, rgba(139, 92, 246, 0.3) 0%, transparent 100%),
    radial-gradient(55% 12% at 50% 94%, rgba(139, 92, 246, 0.22) 0%, transparent 100%);
  background:
    radial-gradient(30% 38% at 50% 50%, color-mix(in srgb, var(--yp-orbit-accent) 34%, transparent) 0%, transparent 100%),
    radial-gradient(55% 12% at 50% 94%, color-mix(in srgb, var(--yp-orbit-accent) 26%, transparent) 0%, transparent 100%);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity;
}

.yp-orbit-light[data-on] {
  opacity: 1;
}

/* Fade the side cards into the stage edges. */
.yp-orbit-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(8, 15, 38, 0.65) 0%, transparent 18%, transparent 82%, rgba(8, 15, 38, 0.65) 100%);
}

.yp-orbit-globe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  /* Its own layer: redrawing the turning lines then repaints only the lines,
     not the gradients of the backdrop under them. */
  will-change: transform;
}

.yp-orbit-globe path,
.yp-orbit-globe ellipse,
.yp-orbit-globe circle {
  fill: none;
  stroke: rgba(173, 196, 255, 0.13);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.yp-orbit-globe .is-rim {
  stroke: rgba(173, 196, 255, 0.2);
}

.yp-orbit-globe .is-equator {
  stroke: rgba(173, 196, 255, 0.26);
  stroke-dasharray: 2 6;
}

.subject-grid.yp-orbit {
  display: block !important;
  position: relative;
  z-index: 1;
  width: var(--yp-stage-w);
  height: var(--yp-stage-h);
  margin: 0 0 40px var(--yp-stage-ml);
  /* A plain rectangular clip (the rounded corners belong to the backdrop):
     clipping 3D layers to a rounded shape needs a mask on every frame. */
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  touch-action: pan-y pinch-zoom;
}

/* The pointer over a card at the side, and the hand while dragging, come from
   a layer over the stage: a cursor set on the grid itself is inherited, so
   changing it would re-style every card inside. */
.subject-grid.yp-orbit[data-yp-orbit-hover]::after,
.subject-grid.yp-orbit[data-yp-orbit-dragging]::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 299; /* drawn after the nearest side card (also 299), under the card in front */
  cursor: pointer;
}

.subject-grid.yp-orbit[data-yp-orbit-dragging]::after {
  z-index: 1000;
  cursor: grabbing;
}

/* Cards share one origin, the globe's centre: each one carries the whole
   camera in its own transform (set by the script), as on the Likes4U globe. */
.subject-grid.yp-orbit > .subject-card {
  position: absolute !important;
  left: 0;
  top: 0;
  width: var(--yp-card-w, 460px);
  margin: 0 !important;
  transform-origin: 50% 50% !important;
  transition: box-shadow 0.35s ease, border-color 0.28s ease !important;
  backface-visibility: hidden;
}

.subject-grid.yp-orbit > .subject-card[data-yp-orbit='side'],
.subject-grid.yp-orbit[data-yp-orbit-moving] > .subject-card:not([data-yp-orbit='hidden']) {
  will-change: transform, translate, rotate, scale, opacity;
}

/* While turning, the glow moves with the card at once: fading a box-shadow
   would repaint a whole card on every frame. */
.subject-grid.yp-orbit[data-yp-orbit-moving] > .subject-card {
  transition: none !important;
}

.subject-grid.yp-orbit > .subject-card[data-yp-orbit='front'] {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 0 6px rgba(139, 92, 246, 0.16),
    0 38px 90px -28px rgba(139, 92, 246, 0.55),
    0 24px 50px rgba(3, 7, 18, 0.45) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5),
    0 0 0 6px color-mix(in srgb, var(--yp-orbit-accent) 22%, transparent),
    0 38px 90px -28px color-mix(in srgb, var(--yp-orbit-accent) 70%, transparent),
    0 24px 50px rgba(3, 7, 18, 0.45) !important;
}

.subject-grid.yp-orbit > .subject-card[data-yp-orbit='side'],
.subject-grid.yp-orbit > .subject-card[data-yp-orbit='hidden'] {
  box-shadow: 0 24px 60px rgba(3, 7, 18, 0.5) !important;
}

.subject-grid.yp-orbit > .subject-card[data-yp-orbit-hover] {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55), 0 24px 60px rgba(3, 7, 18, 0.5) !important;
}

/* Making a card inert (the card turning away, then the card arriving) makes the
   browser restart a scrollbar-color transition on every topic button, because the
   planner gives them "transition: all". Those transitions change nothing you can
   see (the list's scrollbar colours are fixed) but run on the main thread, so that
   one property is left out; every other transition keeps the planner's timing. */
.subject-grid.yp-orbit .completion-btn {
  transition: all 0.3s ease, scrollbar-color 0s;
}

/* The topic list keeps its own scrolling; horizontal swipes turn the globe. */
.subject-grid.yp-orbit .topic-list {
  max-height: var(--yp-list-max, 400px) !important;
  touch-action: pan-y pinch-zoom;
}

/* A search with no match: the planner's own message, in normal flow. */
.subject-grid.yp-orbit.yp-orbit--empty {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.yp-orbit-host.yp-orbit-host--empty .yp-orbit-backdrop {
  display: none;
}

@media (max-width: 639px) {
  .yp-orbit-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 12px;
  }

  .yp-orbit-nav {
    grid-column: 1 / -1;
    order: 3;
  }

  .yp-orbit-arrow {
    width: 38px;
    height: 38px;
  }

  .yp-orbit-backdrop {
    border-radius: 0;
  }

  .yp-orbit-view button {
    padding: 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .yp-orbit-light,
  .yp-orbit-count i::after {
    transition: none;
  }
}

/* Printing (and "PDF olarak kaydet") always uses the plain grid. The script
   switches to it on beforeprint; these rules give the same layout even when no
   print event reaches it (some PDF tools print without one). */
@media print {
  .yp-orbit-bar,
  .yp-orbit-backdrop {
    display: none !important;
  }

  .subject-grid.yp-orbit {
    display: grid !important;
    width: auto !important;
    height: auto !important;
    margin: 0 0 40px !important;
    overflow: visible !important;
    border-radius: 0 !important;
    perspective: none !important; /* the card's own translateZ is then flat */
  }

  .subject-grid.yp-orbit::after {
    display: none !important;
  }

  .subject-grid.yp-orbit > .subject-card {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    transform: none !important;
    translate: none !important;
    rotate: none !important;
    scale: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .subject-grid.yp-orbit .topic-list {
    max-height: none !important;
  }
}
