/* ============================================================
   MAAT — concept 17
   Theme: papyrus tan (#E8D5A0) · Nile blue (#2A5570) ·
   Egyptian gold (#C9962F) · tomb black (#1A1410) · feather white (#F5F0E0)
   Pattern: every input → tailored Egyptian reading.
   ============================================================ */

.page-maat {
    --maat-papyrus:   #E8D5A0;
    --maat-papyrus-2: #DBC58A;
    --maat-cream:     #F5F0E0;
    --maat-nile:      #2A5570;
    --maat-nile-d:    #1A3A5C;
    --maat-gold:      #C9962F;
    --maat-gold-d:    #A47823;
    --maat-amber:     #E8B65C;
    --maat-tomb:      #1A1410;
    --maat-ink:       #2A1F14;
    --maat-mute:      #6E5F4A;

    --c-gold:    var(--maat-gold);
    --c-bg:      var(--maat-papyrus);
    --c-ink:     var(--maat-ink);
    --c-mute:    var(--maat-mute);
    --c-accent:  var(--maat-nile);

    background: var(--maat-papyrus);
    color: var(--maat-ink);
}

[data-theme="dark"] .page-maat,
[data-theme="dark"].page-maat {
    --maat-papyrus:   #100C08;
    --maat-papyrus-2: #181410;
    --maat-cream:     #181410;
    --maat-ink:       #E8D5A0;
    --maat-mute:      #B8A988;
    --maat-nile:      #6FA3C4;
    --maat-nile-d:    #4F8095;
    --maat-gold:      #E2B65C;
    --maat-gold-d:    #C49B47;
    --maat-amber:     #F0C878;
    --maat-tomb:      #050402;
    --c-bg:           #100C08;
    --c-ink:          #E8D5A0;
    --c-mute:         #B8A988;
    background: #100C08;
    color: #E8D5A0;
}

/* shared ---------------------------- */
.maat-section { padding: var(--s-10, 4rem) 0; position: relative; }
.maat-section-head { max-width: 820px; margin: 0 auto var(--s-7, 2.5rem); text-align: center; }
.maat-eyebrow {
    font-family: var(--f-mono, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--maat-gold-d);
    margin-bottom: var(--s-3, 0.75rem);
}
.maat-h2 {
    font-family: var(--f-serif, serif);
    font-size: clamp(1.7rem, 3.2vw, 2.6rem);
    line-height: 1.2;
    color: var(--maat-ink);
    margin-bottom: var(--s-4, 1rem);
    font-weight: 600;
}
.maat-h2 em { font-style: italic; color: var(--maat-gold-d); font-weight: 500; }
.maat-sub {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--maat-mute);
    max-width: 70ch;
    margin: 0 auto;
}
.maat-sub em { color: var(--maat-nile); font-style: italic; }
.maat-sub b  { color: var(--maat-ink); }

.maat-field { display: block; margin-bottom: var(--s-3, 0.75rem); }
.maat-field-label {
    display: block;
    font-size: 0.92rem;
    color: var(--maat-ink);
    font-weight: 500;
    margin-bottom: 4px;
}
.maat-hint-inline { font-weight: 400; color: var(--maat-mute); font-size: 0.84em; font-style: italic; }
.maat-input-text,
.maat-textarea,
.maat-field input[type=text],
.maat-field select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid rgba(42, 85, 112, 0.3);
    border-radius: 4px;
    background: var(--maat-cream);
    color: var(--maat-ink);
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}
.maat-textarea { resize: vertical; line-height: 1.55; font-family: var(--f-serif, serif); font-size: 1.05rem; }
.maat-input-text:focus,
.maat-textarea:focus,
.maat-field select:focus { outline: none; border-color: var(--maat-gold); }
[data-theme="dark"] .maat-input-text,
[data-theme="dark"] .maat-textarea,
[data-theme="dark"] .maat-field input,
[data-theme="dark"] .maat-field select { background: #0A0805; color: #E8D5A0; }
.maat-field select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%23C9962F'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 10px 6px;
    padding-right: 2rem;
}
.maat-q { font-weight: 600; color: var(--maat-ink); margin: var(--s-4, 1rem) 0 var(--s-2, 0.5rem); font-size: 0.95rem; }

.maat-form { max-width: 720px; margin: 0 auto; }
.maat-form .calc-btn { margin-top: var(--s-3, 0.75rem); }

.maat-result {
    max-width: 740px;
    margin: var(--s-6, 2rem) auto 0;
    padding: var(--s-5, 1.5rem) var(--s-6, 2rem);
    background: var(--maat-cream);
    border-left: 3px solid var(--maat-gold);
    border-radius: 4px;
}
[data-theme="dark"] .maat-result { background: #0F0B07; }
.maat-result-tag {
    font-family: var(--f-mono, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--maat-gold-d);
    margin-bottom: var(--s-3, 0.75rem);
}
.maat-result-body { font-family: var(--f-serif, serif); font-size: 1.05rem; line-height: 1.7; color: var(--maat-ink); }
.maat-result-body p { margin-bottom: var(--s-3, 0.75rem); }
.maat-result-body p:last-child { margin-bottom: 0; }
.maat-result-body b { color: var(--maat-nile); font-weight: 600; }
.maat-result-body em { color: var(--maat-gold-d); font-style: italic; }
[data-theme="dark"] .maat-result-body b { color: var(--maat-amber); }
[data-theme="dark"] .maat-result-body em { color: var(--maat-gold); }

/* ====== 1. HERO ====== */
.maat-hero {
    position: relative;
    overflow: hidden;
    color: var(--maat-cream);
    padding: var(--s-12, 5rem) 0 var(--s-12, 5rem);
    isolation: isolate;
}
.maat-hero-canvas { position: absolute; inset: 0; z-index: 0; }
.maat-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
.maat-feather {
    position: absolute;
    right: 5%; top: 12%;
    width: 80px; height: 240px;
    opacity: 0.92;
}
.maat-hieroglyph {
    position: absolute;
    bottom: 6%; left: 4%;
    font-family: serif;
    font-size: clamp(3rem, 9vw, 6rem);
    color: rgba(245, 240, 224, 0.18);
    pointer-events: none;
    letter-spacing: 0.05em;
}
.maat-hero-content { position: relative; z-index: 1; max-width: 820px; }
.maat-hero .maat-eyebrow { color: var(--maat-amber); }
.maat-hero-title {
    font-family: var(--f-serif, serif);
    font-size: clamp(2.2rem, 5.5vw, 4rem);
    line-height: 1.08;
    color: var(--maat-cream);
    margin-bottom: var(--s-5, 1.5rem);
    font-weight: 600;
}
.maat-hero-title .maat-hero-line-1 { display: block; }
.maat-hero-title em {
    display: block;
    font-style: italic;
    color: var(--maat-amber);
    font-weight: 500;
}
.maat-hero-title .maat-hero-line-3 { display: block; color: var(--maat-gold); font-style: italic; }
.maat-hero-sub,
.maat-hero-promise {
    font-size: 1.08rem;
    line-height: 1.75;
    color: rgba(245, 240, 224, 0.92);
    max-width: 68ch;
    margin-bottom: var(--s-4, 1rem);
}
.maat-hero-sub em,
.maat-hero-promise em { color: var(--maat-amber); font-style: italic; }
.maat-hero-sub b,
.maat-hero-promise b { color: var(--maat-cream); }
.maat-hero-cta { display: flex; gap: var(--s-3, 0.75rem); flex-wrap: wrap; margin-top: var(--s-5, 1.5rem); }

/* ====== 2. 42 CONFESSIONS ====== */
.maat-confessions { background: linear-gradient(180deg, var(--maat-papyrus) 0%, var(--maat-papyrus-2) 100%); }
[data-theme="dark"] .maat-confessions { background: linear-gradient(180deg, #100C08 0%, #181410 100%); }
.maat-confess-form { max-width: 920px; margin: 0 auto; }
.maat-confess-group {
    border: none;
    padding: 0;
    margin: 0 0 var(--s-5, 1.5rem);
    background: var(--maat-cream);
    border-radius: 6px;
    padding: var(--s-4, 1rem) var(--s-5, 1.5rem);
    box-shadow: 0 2px 8px rgba(26, 20, 16, 0.06);
}
[data-theme="dark"] .maat-confess-group { background: #0F0B07; box-shadow: none; border: 1px solid #2A1F14; }
.maat-confess-group legend {
    padding: 0 var(--s-2, 0.5rem) var(--s-3, 0.75rem);
    display: flex;
    align-items: baseline;
    gap: var(--s-3, 0.75rem);
    flex-wrap: wrap;
}
.maat-g-name {
    font-family: var(--f-serif, serif);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--maat-gold-d);
}
.maat-g-tag {
    font-family: var(--f-mono, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--maat-mute);
}
.maat-confess-row {
    display: flex;
    gap: var(--s-3, 0.75rem);
    padding: 0.4rem 0;
    cursor: pointer;
    align-items: baseline;
    border-top: 1px dotted rgba(42, 85, 112, 0.15);
}
.maat-confess-row:first-of-type { border-top: none; }
.maat-confess-row input { position: absolute; opacity: 0; }
.maat-confess-mark {
    width: 16px; height: 16px;
    border: 1.5px solid var(--maat-nile);
    border-radius: 3px;
    flex: none;
    margin-top: 4px;
    position: relative;
    background: var(--maat-cream);
}
[data-theme="dark"] .maat-confess-mark { background: #0A0805; }
.maat-confess-row input:checked ~ .maat-confess-mark::after {
    content: '✓';
    position: absolute;
    inset: 0;
    color: var(--maat-gold-d);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}
.maat-confess-row:has(input:checked) .maat-confess-mark {
    border-color: var(--maat-gold);
    background: rgba(201, 150, 47, 0.15);
}
.maat-confess-text {
    flex: 1;
    color: var(--maat-ink);
    font-size: 0.98rem;
    line-height: 1.5;
}
.maat-confess-row:has(input:checked) .maat-confess-text {
    color: var(--maat-mute);
    text-decoration: line-through;
    text-decoration-color: rgba(110, 95, 74, 0.4);
}
.maat-confess-action {
    max-width: 720px;
    margin: var(--s-5, 1.5rem) auto;
    text-align: center;
}
.maat-confess-count {
    font-family: var(--f-mono, monospace);
    font-size: 0.92rem;
    color: var(--maat-gold-d);
    margin-bottom: var(--s-3, 0.75rem);
    letter-spacing: 0.08em;
}
.maat-confess-count span { color: var(--maat-nile); font-weight: 700; font-size: 1.1rem; }
[data-theme="dark"] .maat-confess-count span { color: var(--maat-amber); }

/* ====== 3. SINGLE-ACT WEIGHING / 4. ISFET ====== */
.maat-weighing { background: var(--maat-papyrus); }
.maat-isfet { background: linear-gradient(180deg, var(--maat-papyrus) 0%, var(--maat-papyrus-2) 100%); }
[data-theme="dark"] .maat-weighing { background: #100C08; }
[data-theme="dark"] .maat-isfet { background: linear-gradient(180deg, #100C08 0%, #181410 100%); }

/* ====== 5. SEVEN ASPECTS ====== */
.maat-aspects { background: var(--maat-papyrus-2); }
[data-theme="dark"] .maat-aspects { background: #181410; }
.maat-aspect-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--s-2, 0.5rem);
    margin-bottom: var(--s-3, 0.75rem);
}
.maat-aspect-opt {
    display: flex;
    gap: var(--s-3, 0.75rem);
    padding: var(--s-3, 0.75rem) var(--s-4, 1rem);
    border: 1px solid rgba(42, 85, 112, 0.3);
    border-radius: 6px;
    background: var(--maat-cream);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
[data-theme="dark"] .maat-aspect-opt { background: #0F0B07; }
.maat-aspect-opt input { position: absolute; opacity: 0; }
.maat-aspect-mark {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--maat-nile);
    flex: none;
    margin-top: 4px;
    position: relative;
}
.maat-aspect-opt input:checked ~ .maat-aspect-mark::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--maat-gold);
}
.maat-aspect-opt:has(input:checked) {
    border-color: var(--maat-gold);
    background: rgba(201, 150, 47, 0.12);
}
.maat-aspect-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.maat-aspect-name { font-weight: 600; color: var(--maat-ink); font-size: 1.02rem; }
.maat-aspect-meaning { font-size: 0.88rem; color: var(--maat-mute); line-height: 1.4; }

/* ====== 6. RECIPROCITY ====== */
.maat-reciprocity { background: var(--maat-papyrus); }
[data-theme="dark"] .maat-reciprocity { background: #100C08; }
.maat-dir-row { display: flex; gap: var(--s-2, 0.5rem); flex-wrap: wrap; }
.maat-dir-opt { position: relative; cursor: pointer; }
.maat-dir-opt input { position: absolute; opacity: 0; }
.maat-dir-opt span {
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(42, 85, 112, 0.3);
    border-radius: 4px;
    background: var(--maat-cream);
    font-size: 0.95rem;
    color: var(--maat-ink);
}
[data-theme="dark"] .maat-dir-opt span { background: #0F0B07; }
.maat-dir-opt input:checked + span {
    border-color: var(--maat-gold);
    background: rgba(201, 150, 47, 0.15);
    color: var(--maat-gold-d);
    font-weight: 600;
}

/* ====== 7. PTAHHOTEP / 8. PHARAOH ====== */
.maat-ptahhotep { background: var(--maat-papyrus-2); }
.maat-pharaoh { background: var(--maat-papyrus); }
[data-theme="dark"] .maat-ptahhotep { background: #181410; }
[data-theme="dark"] .maat-pharaoh { background: #100C08; }

/* ====== 9. HEKAU ====== */
.maat-hekau { background: var(--maat-papyrus-2); }
[data-theme="dark"] .maat-hekau { background: #181410; }
.maat-hekau-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--s-2, 0.5rem);
    margin-bottom: var(--s-3, 0.75rem);
}
.maat-hekau-opt {
    display: flex;
    gap: var(--s-3, 0.75rem);
    padding: var(--s-3, 0.75rem) var(--s-4, 1rem);
    border: 1px solid rgba(42, 85, 112, 0.3);
    border-radius: 6px;
    background: var(--maat-cream);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
[data-theme="dark"] .maat-hekau-opt { background: #0F0B07; }
.maat-hekau-opt input { position: absolute; opacity: 0; }
.maat-hekau-mark {
    width: 14px; height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--maat-nile);
    flex: none;
    margin-top: 4px;
    position: relative;
}
.maat-hekau-opt input:checked ~ .maat-hekau-mark::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: var(--maat-gold);
}
.maat-hekau-opt:has(input:checked) {
    border-color: var(--maat-gold);
    background: rgba(201, 150, 47, 0.12);
}
.maat-hekau-body { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.maat-hekau-name { font-weight: 600; color: var(--maat-ink); font-size: 1.02rem; font-family: var(--f-serif, serif); }
.maat-hekau-meaning { font-size: 0.88rem; color: var(--maat-mute); line-height: 1.4; }

/* ====== 10. DAILY TICK ====== */
.maat-tick { background: var(--maat-papyrus); }
[data-theme="dark"] .maat-tick { background: #100C08; }
.maat-tick-stage {
    max-width: 760px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--s-6, 2rem);
    align-items: start;
}
@media (max-width: 600px) {
    .maat-tick-stage { grid-template-columns: 1fr; text-align: center; }
}
.maat-tick-stat {
    padding: var(--s-5, 1.5rem) var(--s-6, 2rem);
    background: var(--maat-nile);
    color: var(--maat-cream);
    border-radius: 6px;
    text-align: center;
}
.maat-tick-num {
    font-family: var(--f-serif, serif);
    font-size: 3rem;
    font-weight: 600;
    color: var(--maat-amber);
    line-height: 1;
    margin-bottom: var(--s-2, 0.5rem);
}
.maat-tick-label {
    font-family: var(--f-mono, monospace);
    font-size: 0.82rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--maat-gold);
}
.maat-tick-form { margin: 0; flex: 1; }

.maat-recent {
    max-width: 760px;
    margin: var(--s-7, 2.5rem) auto 0;
    padding: var(--s-4, 1rem) var(--s-5, 1.5rem);
    background: var(--maat-cream);
    border-radius: 4px;
}
[data-theme="dark"] .maat-recent { background: #0F0B07; }
.maat-recent-h {
    font-family: var(--f-mono, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--maat-gold-d);
    margin-bottom: var(--s-2, 0.5rem);
}
.maat-recent-list { list-style: none; padding: 0; margin: 0; }
.maat-recent-list li {
    padding: 0.55rem 0;
    border-bottom: 1px dotted rgba(42, 85, 112, 0.15);
    display: flex;
    gap: var(--s-2, 0.5rem);
    flex-wrap: wrap;
    align-items: baseline;
    font-size: 0.92rem;
}
.maat-recent-list li:last-child { border-bottom: none; }
.maat-recent-date { font-family: var(--f-mono, monospace); color: var(--maat-gold-d); font-size: 0.84rem; min-width: 48px; }
.maat-recent-maat { color: var(--maat-nile); font-weight: 500; }
.maat-recent-isfet { color: var(--maat-mute); font-style: italic; }
[data-theme="dark"] .maat-recent-maat { color: var(--maat-amber); }

/* ====== 11. SPELL 125 ====== */
.maat-spell { background: linear-gradient(180deg, var(--maat-papyrus-2) 0%, var(--maat-papyrus) 100%); }
[data-theme="dark"] .maat-spell { background: linear-gradient(180deg, #181410 0%, #100C08 100%); }
.maat-spell-card {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--s-6, 2rem);
    background: var(--maat-cream);
    border: 1px solid rgba(42, 85, 112, 0.2);
    border-radius: 6px;
}
[data-theme="dark"] .maat-spell-card { background: #0A0805; }
.maat-spell-h {
    font-family: var(--f-mono, monospace);
    font-size: 0.82rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--maat-gold-d);
    margin: var(--s-4, 1rem) 0 var(--s-2, 0.5rem);
}
.maat-spell-h:first-child { margin-top: 0; }
.maat-spell-card p:not(.maat-spell-h) {
    font-family: var(--f-serif, serif);
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--maat-ink);
    margin-bottom: 0;
}
.maat-spell-card p em { color: var(--maat-nile); font-style: italic; }
[data-theme="dark"] .maat-spell-card p em { color: var(--maat-amber); }

/* ====== 12. QUOTES ====== */
.maat-quotes { background: var(--maat-papyrus); }
.maat-quote-card {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--s-7, 2.5rem) var(--s-6, 2rem);
    background: var(--maat-cream);
    border-radius: 6px;
    text-align: center;
}
[data-theme="dark"] .maat-quote-card { background: #0F0B07; }
.maat-quote-text {
    font-family: var(--f-serif, serif);
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    line-height: 1.55;
    color: var(--maat-ink);
    margin-bottom: var(--s-4, 1rem);
}
.maat-quote-meta { color: var(--maat-mute); font-size: 0.95rem; margin-bottom: var(--s-4, 1rem); }
.maat-quote-author { font-weight: 600; color: var(--maat-gold-d); }
.maat-quote-source { font-style: italic; }
.maat-quote-actions { display: flex; gap: var(--s-3, 0.75rem); justify-content: center; flex-wrap: wrap; }
.maat-quote-actions button[aria-pressed="true"] { color: var(--maat-gold); font-weight: 600; }

/* fade-in animations ---------------------------- */
.fade-up { opacity: 0; transform: translateY(12px); animation: maatFadeUp 0.6s 0.05s forwards; }
.fade-up.delay-1 { animation-delay: 0.15s; }
.fade-up.delay-2 { animation-delay: 0.3s; }
.fade-up.delay-3 { animation-delay: 0.45s; }
.fade-up.delay-4 { animation-delay: 0.6s; }
@keyframes maatFadeUp { to { opacity: 1; transform: translateY(0); } }
