/* YKS Program fixes on the original design (UI/UX audit 2026, classic look).
   The site keeps its own header, footer, heroes, cards, colours and layout.
   This file styles only what the fixes add (skip link, sort buttons that look
   like the header labels, source line, variant note, archive table repair,
   empty states, the homepage speed fixes) and the two parts kept from the
   redesign at the owner's request: the row link buttons (Atlas, Ekle,
   Ücretler, Ders Programı, Konum) and the per-row trend line with its badge.
   Every rule is scoped to html[data-yp] (pages the release transformer
   marked). */

html[data-yp] {
  --yp-primary: #1a3356;
  --yp-primary-tint: rgba(26, 51, 86, 0.08);
  --yp-text: #0f1e33;
  --yp-meta: #4b5d75;
  --yp-row-line: #dbe2ea;
  --yp-control-border: #8a96a6;
  --yp-radius-sm: 6px;
  --yp-radius-md: 8px;
  --yp-radius-lg: 12px;
  --yp-radius-pill: 999px;
  --yp-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ------------------------------------------------------------------ */
/* Accessibility                                                       */
/* ------------------------------------------------------------------ */
html[data-yp] .yp-sr,
html[data-yp] .yp-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
html[data-yp] .yp-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10050;
  padding: 10px 16px;
  border-radius: var(--yp-radius-md);
  background: var(--yp-primary);
  color: #ffffff;
  font: 700 15px/1.2 var(--yp-font);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}
html[data-yp] .yp-skip-link:focus { transform: translateY(0); }
html[data-yp] [id="yp-main"]:focus { outline: none; box-shadow: none; }
html[data-yp] [class*="yp-"][hidden] { display: none !important; }

/* Native multi-selects stay hidden until the custom dropdown mounts. */
html[data-yp] select[multiple]:not(.yks-multi-source):not(.yp-native-ok) { opacity: 0; pointer-events: none; }

/* Phones: 16px filter fields, so iOS does not zoom into the page on focus. */
@media (max-width: 900px) {
  html[data-yp-page^="leaf"] .sayfa-filter-field input,
  html[data-yp-page^="leaf"] .sayfa-filter-field select { font-size: 16px; }
}

/* ------------------------------------------------------------------ */
/* Detail pages: sortable headers keep the look of the labels          */
/* ------------------------------------------------------------------ */
/* The header's own chip and ▲▼ icons sit inside the button unchanged. */
html[data-yp] .yp-sort-btn {
  display: inline;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  text-align: inherit;
  text-transform: inherit;
  cursor: pointer;
}
html[data-yp] .yp-sort-btn:focus-visible { outline: 2px solid var(--yp-primary); outline-offset: 2px; border-radius: 4px; }
html[data-yp] th.yp-sortable { cursor: pointer; }
/* Headers without a chip (Üniversite / Akademik Birim) show the sorted state
   with an underline. */
html[data-yp] .yp-sort-btn--plain.is-sorted { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

/* Desktop: the links column gets room for the two-column buttons; the rank
   and score columns (mostly empty space in the original widths) give it.
   University pages write their column widths inline (atlas 6%), so these
   need !important to reach them too. */
@media (min-width: 901px) {
  html[data-yp] .detail-results-col-university { width: 16% !important; }
  html[data-yp] .detail-results-col-program { width: 16% !important; }
  html[data-yp] .detail-results-col-year { width: 5.5% !important; }
  html[data-yp] .detail-results-col-quota,
  html[data-yp] .detail-results-col-placed { width: 6.5% !important; }
  html[data-yp] .detail-results-col-occupancy { width: 8% !important; }
  /* Wide enough that "BAŞARI SIRASI" and "TABAN PUAN" stay on one line down
     to 1280px, as in the original table. */
  html[data-yp] .detail-results-col-rank { width: 13% !important; }
  html[data-yp] .detail-results-col-score { width: 12% !important; }
  html[data-yp] .detail-results-col-atlas { width: 16.5% !important; }
  /* Same inner width as the redesign's links cell, so "Ders Programı" stays
     on one line at 1440px and wider. */
  html[data-yp] .detail-results-cell-atlas { padding-left: 8px; padding-right: 8px; }
}

/* ------------------------------------------------------------------ */
/* Row link buttons (kept from the redesign)                           */
/* ------------------------------------------------------------------ */
html[data-yp] .detail-results-cell-atlas { vertical-align: top; }
html[data-yp] .detail-resource-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 4px;
  width: 100%;
}
html[data-yp] .detail-resource-links > a,
html[data-yp] .detail-resource-links > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 26px;
  max-width: 100%;
  margin: 0;
  padding: 2px 6px;
  border: 1px solid #b6c3d3;
  border-radius: var(--yp-radius-sm);
  background: #ffffff;
  color: var(--yp-primary);
  font: 700 12px/1.15 var(--yp-font);
  text-align: center;
  text-decoration: none;
  white-space: normal;
  box-shadow: none;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease;
}
html[data-yp] .detail-resource-links > a:hover,
html[data-yp] .detail-resource-links > button:hover { border-color: var(--yp-primary); background: var(--yp-primary-tint); }
html[data-yp] .detail-resource-links > .detail-atlas-link::after {
  content: "";
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17L17 7M9 7h8v8'/%3E%3C/svg%3E") center / contain no-repeat;
}
html[data-yp] .detail-resource-links > .detail-fee-link { color: #166534; border-color: #9fd4b1; }
html[data-yp] .detail-resource-links > .detail-location-link { color: #075c62; border-color: #9fd3cf; }
/* Desktop uses the auto-fill grid above, as the live redesign does: two
   columns when the cell has room (about 1200px and wider), one column on
   narrower desktops. */
@media (max-width: 900px) {
  html[data-yp] .detail-resource-links,
  html[data-yp] body[data-taban-content-family] .detail-results-cell-atlas .detail-resource-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: stretch; flex-direction: initial; }
  html[data-yp] .detail-resource-links > a,
  html[data-yp] .detail-resource-links > button,
  html[data-yp] body[data-taban-content-family] .detail-results-cell-atlas .detail-resource-links > a,
  html[data-yp] body[data-taban-content-family] .detail-results-cell-atlas .detail-resource-links > button { width: 100%; max-width: none; min-height: 44px; padding: 6px 4px; font-size: 13px; line-height: 1.2; border-radius: var(--yp-radius-md); }
}

/* ------------------------------------------------------------------ */
/* Trend line under the program name (kept from the redesign)          */
/* ------------------------------------------------------------------ */
html[data-yp] .yp-trend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
html[data-yp] .yp-spark { display: block; width: 72px; height: 18px; overflow: visible; }
html[data-yp] .yp-spark polyline { fill: none; stroke: var(--yp-primary); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
html[data-yp] .yp-spark circle { fill: var(--yp-primary); }
html[data-yp] .yp-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--yp-radius-pill);
  font: 800 12px/1.2 var(--yp-font);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
html[data-yp] .yp-badge--up { color: #9a3412; background: #fff7ed; border-color: #fdba74; }
html[data-yp] .yp-badge--down { color: #166534; background: #f0fdf4; border-color: #86efac; }
html[data-yp] .yp-badge--flat { color: #334155; background: #f1f5f9; border-color: #cbd5e1; }

/* ------------------------------------------------------------------ */
/* Source line, variant note, archive table                            */
/* ------------------------------------------------------------------ */
html[data-yp] .yp-table-source {
  margin: 10px 2px 0;
  color: var(--yp-meta);
  font-size: 13px;
  line-height: 1.5;
}
html[data-yp] .yp-variant-note {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #fcd34d;
  border-radius: var(--yp-radius-md);
  background: #fffbeb;
  color: #78350f;
  font-size: 14px;
  line-height: 1.55;
}
html[data-yp] .yp-variant-note a { color: #78350f; font-weight: 800; }
/* The açıköğretim archive table rendered as broken cards with the results
   table's class; it is a plain table again and scrolls sideways on phones. */
html[data-yp] .detail-table-shell.yp-archive-shell { overflow: hidden; background: #ffffff; }
html[data-yp] .yp-archive-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
html[data-yp] .yp-archive-table { display: table; width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13.5px; color: var(--yp-text); }
html[data-yp] .yp-archive-table thead { display: table-header-group; }
html[data-yp] .yp-archive-table tbody { display: table-row-group; }
html[data-yp] .yp-archive-table tr { display: table-row; }
html[data-yp] .yp-archive-table th,
html[data-yp] .yp-archive-table td { display: table-cell; }
html[data-yp] .yp-archive-table td::before { content: none; }
html[data-yp] .yp-archive-table td strong { font-weight: 800; }
html[data-yp] .yp-archive-table .detail-program-meta { display: block; margin-top: 2px; color: var(--yp-meta); font-size: 12.5px; }
html[data-yp] .yp-archive-table .detail-atlas-link { color: var(--yp-primary); font-weight: 700; }
html[data-yp] .yp-archive-table th {
  padding: 10px 12px;
  border-bottom: 1px solid #c9d2de;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
html[data-yp] .yp-archive-table td { padding: 9px 12px; border-bottom: 1px solid var(--yp-row-line); vertical-align: top; line-height: 1.45; }
html[data-yp] .yp-archive-table tr:nth-child(even) td { background: #f8fafc; }
html[data-yp] .yp-archive-table td + td,
html[data-yp] .yp-archive-table th + th { white-space: nowrap; }

/* ------------------------------------------------------------------ */
/* Empty states and "Filtreleri temizle"                               */
/* ------------------------------------------------------------------ */
html[data-yp] .yp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--yp-control-border);
  border-radius: var(--yp-radius-md);
  background: #ffffff;
  color: var(--yp-text);
  font: 800 13.76px/1.2 var(--yp-font);
  text-decoration: none;
  cursor: pointer;
}
html[data-yp] .yp-btn--navy { border-color: var(--yp-primary); background: var(--yp-primary); color: #ffffff; }
html[data-yp] .yp-btn--navy:hover { background: #122640; color: #ffffff; }
html[data-yp-page="hub"] .yp-clear-filters {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--yp-primary);
  font: 800 13.5px/1 var(--yp-font);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
html[data-yp-page="hub"] .yp-clear-filters[hidden] { display: none; }
html[data-yp-page^="dir"] .yp-directory-empty {
  margin: 12px 0;
  padding: 18px;
  border: 1px dashed var(--yp-control-border);
  border-radius: var(--yp-radius-lg);
  background: #ffffff;
  text-align: center;
}
html[data-yp-page^="dir"] .yp-directory-empty[hidden] { display: none; }
html[data-yp-page^="dir"] .yp-directory-empty p { margin: 0 0 10px; color: var(--yp-text); }

/* ------------------------------------------------------------------ */
/* Homepage: speed and layout-shift fixes (no visible change)          */
/* ------------------------------------------------------------------ */
/* The entrance animation started at opacity 0, which kept the first screen
   out of Largest Contentful Paint. Same slide, no fade. */
@keyframes ypPageIn { from { transform: translateY(12px); } to { transform: translateY(0); } }
html[data-yp-page="home"] .container { animation-name: ypPageIn; }
@media (prefers-reduced-motion: reduce) {
  html[data-yp-page="home"] .container { animation: none; }
}
/* content-guard.js restyles the question-bank card on DOMContentLoaded (its
   "homepage-distribution-card-hotfix" style). The same rules apply here from
   the first paint, so the card no longer changes size once that script runs. */
html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-featured,
html[data-yp-page="home"] .surface-link-panel--taban .surface-link-featured { display: none !important; }
@media (max-width: 680px) {
  html[data-yp-page="home"] .surface-link-panel--distribution { display: block !important; align-items: flex-start !important; min-height: 0 !important; padding: 12px !important; gap: 0 !important; }
  html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-copy,
  html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-heading,
  html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-heading-copy { display: block !important; }
  html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-title { margin: 0 !important; }
  html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-pills { margin-top: 6px !important; gap: 6px !important; }
  html[data-yp-page="home"] .surface-link-panel--distribution .surface-link-actions { display: grid !important; grid-template-columns: 1fr !important; gap: 8px !important; width: 100% !important; margin-top: 10px !important; }
}
/* Idle main-thread work. Two infinite background-position animations kept a
   throttled phone's main thread about two-thirds busy while the page sat idle.
   - Subject progress bars: the shimmer never showed (each bar's inline style
     paints it one solid colour), so it stops.
   - Hero card: same gradient, same 14 s drift, now moved with transform on a
     composited layer (.yp-hero-glow, added by the publish transformer). */
html[data-yp-page="home"] .progress-bar-fill { animation: none; }
html[data-yp-page="home"] .header.yp-hero { position: relative; isolation: isolate; background: none; animation: none; }
html[data-yp-page="home"] .yp-hero-glow { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; pointer-events: none; }
html[data-yp-page="home"] .yp-hero-glow::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 300%;
  height: 100%;
  background: linear-gradient(135deg, rgba(26, 51, 86, 0.05), rgba(122, 56, 40, 0.04), rgba(26, 107, 90, 0.03), rgba(26, 51, 86, 0.05)) 0 50% / 100% 300% no-repeat;
  animation: ypHeroDrift 14s ease infinite;
  will-change: transform;
}
@keyframes ypHeroDrift { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-66.6667%); } }
@media (prefers-reduced-motion: reduce) {
  html[data-yp-page="home"] .yp-hero-glow::before { animation: none; }
}

/* ------------------------------------------------------------------ */
/* Long lists: off-screen items skip rendering until they come close   */
/* ------------------------------------------------------------------ */
/* The placeholder heights are the original layout's typical heights; once an
   item has rendered, the browser keeps its real height. */
@media (max-width: 900px) {
  html[data-yp] tr.detail-results-row { content-visibility: auto; contain-intrinsic-height: auto 640px; }
}
html[data-yp-page="hub"] #bolumGrid > .favorite-card-shell,
html[data-yp-page="hub"] #bolumGrid > .bolum-card { content-visibility: auto; contain-intrinsic-height: auto 150px; }
html[data-yp-page="dir-departments"] .favorite-card-shell[data-directory-item] { content-visibility: auto; contain-intrinsic-height: auto 200px; }
html[data-yp-page="dir-universities"] .favorite-card-shell[data-directory-item] { content-visibility: auto; contain-intrinsic-height: auto 165px; }
