:root {
  color-scheme: light;
  --paper: #f8f5ee;
  --paper-deep: #f0ebe0;
  --ink: #20272e;
  --muted: #5a5a54;
  --navy: #121c27;
  --gold: #e4b46c;
  --bronze: #8b5428;
  --line: #e3dbce;
  --heading: "Noto Kufi Arabic", Tahoma, sans-serif;
  --body: "IBM Plex Sans Arabic", Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 1rem; line-height: 1.65; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #a97532; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); }
.frame { width: min(1248px, calc(100% - 112px)); margin-inline: auto; }
.visually-hidden, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); white-space: nowrap; overflow: hidden; }
.skip:focus { position: absolute; z-index: 10; background: var(--paper); padding: 8px 18px; }
.site-header { background: #111b25; color: #f6eee3; border-bottom: 1px solid #debb8050; }
.header-inner { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 34px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }
.brand-logo {
  display: block;
  flex: none;
  inline-size: 60px;
  block-size: 54px;
  padding: 3px;
  object-fit: contain;
  border: 1px solid #cfab77;
  border-radius: 8px;
  background: var(--paper);
}
.brand-subtitle { color: #e1d6c7; font-size: .88rem; font-weight: 600; line-height: 1.35; white-space: nowrap; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0 24px; align-items: center; align-self: stretch; }
.site-header nav a { display: grid; place-items: center; color: #dcd5cc; font-size: .95rem; position: relative; white-space: nowrap; }
.site-header nav a:hover, .site-header nav .nav-active { color: var(--gold); }
.site-header nav .nav-active::after { content: ""; position: absolute; bottom: 0; width: 100%; height: 2px; background: var(--gold); }
.search-trigger { justify-self: end; display: flex; align-items: center; gap: 11px; border: 1px solid #d2b88a57; border-radius: 7px; padding: 7px 14px; background: transparent; color: #f3ebdf; white-space: nowrap; font-size: .89rem; }
.search-trigger:hover { background: #ffffff13; }
.search-icon { display: inline-block; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 50%; position: relative; margin-left: 3px; }
.search-icon::after { content: ""; position: absolute; width: 6px; height: 1.5px; background: currentColor; transform: rotate(45deg); right: -5px; bottom: -3px; }
.hero { min-height: 493px; background: #17212d; color: #fff9ee; position: relative; isolation: isolate; display: grid; align-content: center; overflow: hidden; border-bottom: 3px solid #d6aa6d; }
.hero-art { position: absolute; z-index: -2; inset: 0; background: linear-gradient(270deg, #131e2a 2%, #151f2bf5 18%, #16202bc4 37%, #16202b26 64%, #16202b05 100%), linear-gradient(0deg, #10192181, transparent 23%), url("assets/istanbul.webp") 50% 60% / cover no-repeat, #17212d; }
.hero-content { padding-block: 48px 57px; }
.eyebrow { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: .91rem; }
.hero-eyebrow { color: #f2c583; margin-bottom: 16px; }
.eyebrow span { font-size: .8rem; }
.hero h1 { font-size: clamp(2.55rem, 4.5vw, 4.25rem); font-weight: 800; line-height: 1.48; }
.hero h1 span { color: #edbd78; }
.hero-intro { max-width: 415px; color: #eee5d9; font-size: 1.15rem; line-height: 1.8; margin-top: 16px; }
.primary-action { display: inline-flex; align-items: center; gap: 13px; background: #e6b675; color: #201913; padding: 10px 19px; min-height: 47px; border-radius: 6px; margin-top: 26px; font-weight: 700; }
.primary-action:hover { background: #f1c88f; }
.rail-icon { width: 16px; height: 12px; display: inline-block; background: radial-gradient(circle, currentColor 0 2px, transparent 2.8px) 0 50% / 8px 8px repeat-x, linear-gradient(currentColor,currentColor) center / 11px 1px no-repeat; }
.hero-caption { position: absolute; bottom: 21px; inset-inline: 0; text-align: left; color: #fff5e7; font-size: .82rem; pointer-events: none; }
.hero-caption span { background: #171b22bf; padding: 4px 10px; border-radius: 4px; }
.timeline-section { padding-block: 39px 30px; background: #f6f1e7; border-bottom: 1px solid var(--line); }
.timeline-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.section-eyebrow { color: var(--bronze); margin-bottom: 5px; }
h2 { font-size: clamp(1.45rem, 2.35vw, 2rem); font-weight: 800; line-height: 1.6; }
.timeline-header p:not(.eyebrow) { color: var(--muted); margin-top: 6px; }
.calendar { display: flex; gap: 3px; background: #ebe3d6; padding: 4px; border-radius: 8px; flex: 0 0 auto; }
.calendar button { background: transparent; border: 0; border-radius: 5px; padding: 4px 15px; min-height: 35px; color: #514b43; font-weight: 600; font-size: .88rem; }
.calendar button[aria-pressed="true"] { background: #fffdf8; box-shadow: 0 1px 3px #57463228; color: #563614; }
.timeline-note { margin-top: 13px; font-size: .84rem; color: #605b50; display: flex; align-items: baseline; gap: 6px; }
.timeline-note span { color: var(--bronze); }
.eras-section { padding-block: 38px 59px; }
.eras-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 23px; }
.filters { display: flex; flex-wrap: wrap; gap: 7px; }
.filters button { background: transparent; border: 1px solid #ded5c7; border-radius: 6px; color: #4a4943; min-height: 36px; padding: 4px 12px; font-size: .88rem; font-weight: 600; }
.filters button:hover { border-color: #8d6b43; }
.filters button[aria-pressed="true"] { background: #263441; color: #fff8ec; border-color: #263441; }
.era-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.era-card { min-width: 0; display: flex; flex-direction: column; border: 1px solid #e2d9cb; border-radius: 10px; background: #fffdf7; overflow: clip; box-shadow: 0 3px 8px #3d302009; transition: border-color .2s, box-shadow .2s; }
.era-card:hover { border-color: #bca27d; box-shadow: 0 5px 15px #3d302015; }
.card-artpoint { position: relative; height: 139px; background: var(--tone); overflow: hidden; }
.card-artpoint img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-artpoint::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg,#1b191a2c,transparent 48%); pointer-events: none; }
.card-period { position: absolute; z-index: 1; top: 11px; inset-inline-start: 11px; padding: 3px 9px; border-radius: 4px; color: #fffaf1; background: #212a2cee; font-size: .82rem; font-weight: 600; }
.card-body { padding: 15px 16px 13px; display: flex; flex-direction: column; align-items: start; flex: 1; border-top: 3px solid var(--tone); }
.card-body h3 { font-size: 1rem; font-weight: 800; line-height: 1.55; }
.card-body p { margin-top: 7px; margin-bottom: 12px; color: var(--muted); line-height: 1.55; }
.card-body button { margin-top: auto; background: transparent; color: var(--tone); font-size: .91rem; font-weight: 700; border: 0; border-bottom: 1px solid transparent; padding: 3px 0; }
.card-body button:hover { border-bottom-color: currentColor; }
.about-section { background: var(--paper-deep); border-block: 1px solid var(--line); padding-block: 35px; }
.basics-section { padding-block: 44px; background: #f6f1e7; border-top: 1px solid var(--line); }
.basics-intro { margin-top: 6px; color: var(--muted); }
.basics-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.basics-tabs button { min-height: 44px; padding-inline: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fffdf7; color: var(--ink); font-weight: 600; }
.basics-tabs button:hover { border-color: var(--bronze); }
.basics-tabs button[aria-selected="true"] { background: var(--navy); color: var(--gold); border-color: var(--navy); }
.basics-panel { display: grid; grid-template-columns: 3fr 2fr; margin-top: 16px; background: #fffdf7; border: 1px solid var(--line); border-radius: 10px; overflow: clip; }
.basics-tabs[hidden], .basics-panel[hidden] { display: none; }
.basics-copy { padding: clamp(18px, 3vw, 36px); }
.basics-copy ul { display: grid; gap: 8px; margin-block: 12px 0; padding-inline-start: 1.25em; }
.basics-copy li::marker { color: var(--bronze); }
.basics-references { margin-top: 14px; color: var(--muted); }
.basics-copy a { color: var(--bronze); text-decoration: underline; text-underline-offset: 3px; }
.basics-panel img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.learning-page { min-height: 100vh; display: flex; flex-direction: column; }
.learning-page main { flex: 1; }
.learning-header { grid-template-columns: max-content minmax(0, 1fr); }
.learning-header nav { justify-content: center; }
.learning-page h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); }
.akhlaq-section { padding-block: clamp(30px, 6vw, 70px); }
.akhlaq-section .frame { max-width: 1040px; }
.mind-search-status:not(:empty) { margin-top: 8px; }
.mind-branches { --connector: #b49267; --branch-gap: 46px; position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 20px var(--branch-gap); padding-top: 26px; }
.mind-branches::before, .mind-branches::after, .mind-branch::before { content: ""; position: absolute; background: var(--connector); pointer-events: none; }
.mind-branches::before { inset-block: 0; inset-inline-start: 50%; width: 1px; }
.mind-branches::after { inset-block-end: 0; inset-inline-start: 50%; width: 7px; height: 7px; border-radius: 50%; transform: translateX(50%); }
.mind-branch { position: relative; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper-deep); }
.mind-branch::before { inset-block-start: 29px; width: calc(var(--branch-gap) / 2 + 2px); height: 1px; }
.mind-branch:nth-child(odd)::before { inset-inline-start: 100%; }
.mind-branch:nth-child(even)::before { inset-inline-end: 100%; }
.mind-branch h2 { font-size: 1.08rem; color: var(--bronze); }
.mind-branches.is-filtered { gap: 18px; }
.mind-branches.is-filtered::before, .mind-branches.is-filtered::after, .mind-branches.is-filtered .mind-branch::before { display: none; }
.virtues { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.virtues details { background: #fffdf7; border: 1px solid var(--line); border-radius: 6px; }
.virtues summary { min-height: 44px; cursor: pointer; font-weight: 700; padding: 9px 12px; }
.virtues summary:hover, .virtues summary::marker { color: var(--bronze); }
.virtues details[open] { border-color: #c5aa86; }
.virtue-evidence { padding: 0 12px 14px; }
.virtue-evidence > p { color: var(--muted); }
.virtue-evidence dl { border-top: 1px solid var(--line); margin: 10px 0 0; padding-top: 8px; }
.virtue-evidence dt { color: var(--bronze); font-weight: 700; }
.virtue-evidence dt:not(:first-child) { margin-top: 12px; }
.virtue-evidence dd { margin: 0; }
.virtue-evidence a { color: var(--bronze); text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  .basics-panel { grid-template-columns: 1fr; }
  .basics-panel img { height: clamp(140px, 45vw, 260px); }
  .mind-branches { grid-template-columns: 1fr; padding-inline-start: 22px; }
  .mind-branches::before, .mind-branches::after { inset-inline-start: 8px; }
  .mind-branch:nth-child(n)::before { inset-inline: auto 100%; width: 16px; }
  .mind-branches.is-filtered { padding-inline-start: 0; }
}
.about-inner { display: flex; align-items: start; gap: 20px; }
.about-inner h2 { font-size: 1.35rem; margin-bottom: 5px; }
.about-inner p { max-width: 700px; color: #54544d; }
.about-mark { font-size: 2rem; line-height: 1.4; color: var(--bronze); }
.illustration-note { font-size: .86rem; margin-top: 7px; }
footer { background: var(--navy); color: #f4e9d9; padding-block: 19px; }
.footer-inner { display: flex; justify-content: space-between; gap: 15px; font-size: .9rem; }
.footer-inner a, .footer-inner span { color: var(--gold); }
dialog { color: var(--ink); border: 1px solid #dfd2bf; border-radius: 13px; padding: 0; background: var(--paper); max-width: calc(100% - 24px); max-height: 88dvh; box-shadow: 0 20px 80px #0c111982; }
dialog::backdrop { background: #121c27bb; }
body:has(dialog[open]) { overflow: hidden; }
.era-dialog { width: 750px; }
.dialog-inner { position: relative; }
.close-button { position: absolute; inset-inline-end: 14px; top: 14px; z-index: 1; border: 1px solid #dfd2bf; border-radius: 50%; background: var(--paper); color: var(--ink); width: 40px; height: 40px; padding: 0; line-height: 1; font-size: 1.55rem; }
.close-button:hover { background: #efe3ce; }
.detail-banner { background: linear-gradient(270deg, #101b27f2 0%, #152331bd 38%, #172a3620 95%), linear-gradient(0deg, #17222c7d, transparent 80%), var(--detail-image) center 55% / cover no-repeat, var(--navy); color: #fff9eb; padding: 36px 28px 24px; min-height: clamp(150px, 25vw, 200px); display: grid; align-content: end; border-bottom: 4px solid var(--tone); }
.detail-banner h2 { margin-top: 6px; }
.detail-period { color: #f5cd91; font-size: .95rem; font-weight: 700; }
.detail-body { padding: 22px 28px 28px; }
.detail-summary { font-size: 1.1rem; }
.detail-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 18px 0 22px; }
.detail-facts div { background: #efe8db; border-radius: 7px; padding: 12px; }
.detail-facts div:only-child { grid-column: 1 / -1; }
.detail-facts dt { font-weight: 700; color: #815227; }
.detail-facts dd { margin: 2px 0 0; }
.detail-map-link { display: inline-block; padding: 6px 0; background: none; border: 0; color: #684423; text-decoration: underline; text-underline-offset: 4px; font-weight: 600; }
.detail-body h3 { font-size: 1rem; margin-block: 12px; }
.figure-directory-link, .atlas-link { color: #684423; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.event-links, .timeline-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }
.event-links { margin-top: 5px; font-size: .91rem; }
.virtue-practice-link { margin-block: -10px 15px; }
.detail-figures { margin-block-end: 20px; }
.detail-figures details { margin-top: 8px; }
.detail-figures summary { width: fit-content; padding: 4px 0; cursor: pointer; font-weight: 600; }
.detail-figure-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 8px 0 0; list-style: none; }
.detail-figure-links a {
  display: block;
  padding: 5px 10px;
  border: 1px solid #d4c4ae;
  border-radius: 6px;
  color: var(--tone);
  background: #fffdf7;
  font-weight: 600;
}
.detail-figure-links a:hover { background: #efe5d4; text-decoration: underline; }
.event-list { --date-width: 8.6rem; padding: 0; margin: 0 0 20px; list-style: none; }
.event-list li { display: grid; grid-template-columns: var(--date-width) minmax(0, 1fr); column-gap: 22px; position: relative; }
.event-list li::after { content: ""; position: absolute; inset-inline-start: calc(var(--date-width) + 1px); inset-block-start: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 0 3px var(--paper); }
.event-list li:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: calc(var(--date-width) + 4px); inset-block: 16px -16px; width: 2px; background: var(--line); }
.event-dates { padding-top: 2px; color: var(--tone); font-weight: 700; }
.event-dates > * { display: block; }
.event-dates small { color: var(--muted); font-size: .88rem; font-weight: 400; }
.event-story { padding: 2px 0 18px; }
.event-story p { color: var(--muted); margin-top: 3px; }
@media (max-width: 540px) {
  .event-list { --date-width: 0px; }
  .event-list li { display: block; padding-inline-start: 22px; }
  .event-dates { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
}
.sources { padding: 0 19px 0 0; margin: 0; }
.sources a { color: #684423; text-decoration: underline; text-underline-offset: 3px; }
.detail-navigation { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; display: flex; justify-content: space-between; gap: 12px; }
.detail-navigation button { color: var(--ink); font-weight: 600; border: 1px solid #d4c4ae; border-radius: 6px; background: #fffdf7; padding: 6px 12px; }
.detail-navigation button:hover { background: #efe5d4; }
.search-dialog { width: 575px; }
.search-dialog .dialog-inner { padding: 22px; }
.search-dialog h2 { padding-inline-end: 42px; font-size: 1.28rem; margin-bottom: 14px; }
.search-dialog input { display: block; width: 100%; padding: 10px 12px; border: 1px solid #b8a483; border-radius: 6px; background: #fffdf8; color: var(--ink); }
.search-results { margin-top: 12px; }
.search-results button { display: block; width: 100%; text-align: start; background: transparent; color: var(--ink); padding: 10px 5px; border: 0; border-bottom: 1px solid var(--line); }
.search-results button:hover { background: #efe8d9; }
.search-results small { color: var(--muted); margin-inline-start: 8px; }
@media (min-width: 1500px) { .hero { min-height: 545px; } }
@media (max-width: 1050px) { .frame { width: calc(100% - 60px); } .era-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } .site-header nav { gap: 22px; } }
@media (max-width: 1200px) {
  .header-inner:has(.search-trigger) { grid-template-columns: 1fr auto; row-gap: 5px; padding-top: 10px; }
  .header-inner:has(.search-trigger) nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: start;
    gap: 0 clamp(12px, 2vw, 24px);
  }
  .header-inner:has(.search-trigger) nav a { padding-block: 5px 9px; }
}
@media (max-width: 790px) {
  .frame { width: calc(100% - 36px); }
  .header-inner { gap: 12px; }
  .hero-art { background-position: center, center, 37% center; }
  .eras-heading { align-items: start; flex-direction: column; gap: 11px; }
  .era-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 580px) {
  .header-inner { padding-block: 10px 0; min-height: 93px; grid-template-columns: 1fr auto; gap: 8px; }
  .site-header nav { grid-row: 2; grid-column: 1 / -1; justify-content: space-between; flex-wrap: wrap; gap: 0 12px; }
  .site-header nav a { padding-block: 5px 9px; font-size: .9rem; }
  .search-trigger { grid-column: 2; grid-row: 1; padding: 6px 9px; }
  .brand { gap: 7px; }
  .brand-logo { inline-size: 46px; block-size: 42px; padding: 2px; border-radius: 6px; }
  .brand-subtitle { font-size: .77rem; }
  .hero { min-height: 450px; }
  .hero-content { padding: 37px 0 57px; }
  .hero h1 { font-size: clamp(2rem, 8.5vw, 2.8rem); }
  .hero-intro { font-size: 1.04rem; max-width: 325px; }
  .hero-art { background-image: linear-gradient(270deg,#121d29f0,#121d29b8 53%,#121d2960),linear-gradient(0deg,#10192178,transparent 40%),url("assets/istanbul.webp"); }
  .timeline-section { padding-top: 30px; }
  .timeline-header { align-items: start; flex-direction: column; gap: 10px; }
  .era-grid { gap: 10px; }
  .card-artpoint { height: 105px; }
  .card-body { padding: 10px; }
  .card-body h3 { font-size: .86rem; }
  .card-body p { font-size: .91rem; }
  .card-period { top: 7px; inset-inline-start: 7px; font-size: .74rem; }
  .detail-banner, .detail-body { padding-inline: 17px; }
}
@media (max-width: 380px) {
  .header-inner:has(.search-trigger) { grid-template-columns: minmax(0, 1fr) auto; }
  .header-inner:has(.search-trigger) .brand { min-inline-size: 0; }
  .header-inner:has(.search-trigger) .brand-subtitle { white-space: normal; }
}
@media (max-width: 340px) { .era-grid, .detail-facts { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
.timeline-bottom { margin-top: 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.timeline-bottom .timeline-note { margin: 0; }
#compare-toggle { color: #704823; font-weight: 700; background: transparent; border: 0; border-bottom: 1px solid currentColor; padding: 1px 0; white-space: nowrap; font-size: .86rem; }
#compare-toggle:hover { color: #422f1d; }
#comparison { margin-top: 14px; background: #fffdf7; border: 1px solid var(--line); border-radius: 9px; padding: 10px 13px; }
@media (max-width: 580px) {
  .timeline-bottom { align-items: start; flex-direction: column; gap: 5px; }
}
