/* ============================================
   pmt.report — Japanese-Minimal Urban Manuscript
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-earth: #2A2018;
    --warm-earth: #4A3A28;
    --muted-earth: #8A7A58;
    --medium-earth: #7A6A50;
    --sand: #C8B898;
    --parchment: #F6F0E4;
    --cream: #FDF8F0;

    --font-display: 'Caveat', cursive;
    --font-body: 'Noto Serif JP', serif;
    --font-mono: 'Space Mono', monospace;

    --mx: 50%;
    --my: 50%;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--cream);
    color: var(--warm-earth);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.95;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Cursor-Follow Reading Lamp --- */
#reading-lamp {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(
        circle 150px at var(--mx) var(--my),
        rgba(160, 130, 80, 0.04),
        transparent
    );
    transition: background 0.3s ease;
}

/* --- Organic Blob Decorations --- */
.blob {
    position: fixed;
    border-radius: 50%;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.blob-1 {
    width: 400px;
    height: 350px;
    background: var(--sand);
    top: 10vh;
    right: -100px;
    border-radius: 60% 40% 50% 50% / 40% 60% 40% 60%;
    animation: blobFloat1 20s ease-in-out infinite;
}

.blob-2 {
    width: 300px;
    height: 280px;
    background: var(--muted-earth);
    top: 50vh;
    left: -80px;
    border-radius: 50% 60% 40% 50% / 60% 40% 60% 40%;
    animation: blobFloat2 25s ease-in-out infinite;
}

.blob-3 {
    width: 250px;
    height: 220px;
    background: var(--sand);
    bottom: 15vh;
    right: -60px;
    border-radius: 40% 60% 50% 50% / 50% 50% 60% 40%;
    animation: blobFloat3 18s ease-in-out infinite;
}

@keyframes blobFloat1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, 15px) rotate(3deg); }
    66% { transform: translate(10px, -10px) rotate(-2deg); }
}

@keyframes blobFloat2 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(15px, -20px) rotate(-3deg); }
    66% { transform: translate(-10px, 10px) rotate(2deg); }
}

@keyframes blobFloat3 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-15px, -10px) rotate(2deg); }
    66% { transform: translate(20px, 15px) rotate(-3deg); }
}

/* --- Manuscript Column --- */
#manuscript {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 clamp(20px, 5vw, 60px);
    padding-top: 12vh;
    padding-bottom: 10vh;
}

/* --- Header --- */
#report-header {
    margin-bottom: 6rem;
    animation: fadeInUp 1.2s ease-out;
}

.urban-detail {
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

.urban-detail svg {
    width: 120px;
    height: 40px;
}

.urban-detail-small svg {
    width: 60px;
    height: 30px;
}

.timestamp {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted-earth);
    letter-spacing: 0.08em;
    margin-bottom: 0.8rem;
    opacity: 0.7;
}

.title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.5vw, 3.2rem);
    font-weight: 700;
    color: var(--deep-earth);
    letter-spacing: 0.02em;
    line-height: 1.2;
    margin-bottom: 0.6rem;
}

.subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: var(--medium-earth);
    letter-spacing: 0.04em;
    margin-bottom: 1.5rem;
}

.wabi-sabi-marker {
    margin: 1rem 0;
}

.wabi-sabi-marker svg {
    width: 100%;
    max-width: 200px;
    height: auto;
}

/* --- Section Styles --- */
.report-section {
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.report-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-header {
    margin-bottom: 1.5rem;
    position: relative;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--deep-earth);
    line-height: 1.3;
    margin-bottom: 0.3rem;
}

.section-timestamp {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted-earth);
    letter-spacing: 0.1em;
    opacity: 0.6;
}

/* --- Annotations --- */
.annotation {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--muted-earth);
    font-style: italic;
    margin-bottom: 1rem;
    opacity: 0.7;
}

/* --- Body Paragraphs --- */
.report-section p {
    margin-bottom: 1.2rem;
    color: var(--warm-earth);
    font-weight: 300;
}

/* --- Handwritten Notes (Blockquotes) --- */
.handwritten-note {
    font-family: var(--font-display);
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: var(--deep-earth);
    border-left: 2px solid var(--sand);
    padding: 1rem 0 1rem 1.5rem;
    margin: 2rem 0;
    position: relative;
    line-height: 1.6;
    opacity: 0.85;
}

.handwritten-note::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--sand), transparent);
}

/* --- Section Dividers --- */
.section-divider {
    text-align: center;
    margin: 2rem 0;
    padding: 0.5rem 0;
}

.section-divider svg {
    width: 100%;
    max-width: 300px;
    height: auto;
    opacity: 0.8;
}

/* --- Data Table --- */
.data-table {
    margin: 1.5rem 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.data-row {
    display: flex;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(200, 184, 152, 0.25);
}

.data-row:last-child {
    border-bottom: none;
}

.data-header {
    border-bottom: 1px solid var(--sand);
    font-weight: 400;
    color: var(--muted-earth);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.data-cell {
    display: inline-block;
}

.cell-project {
    flex: 2;
    color: var(--warm-earth);
}

.cell-status {
    flex: 1;
    text-align: center;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
}

.cell-health {
    flex: 0 0 40px;
    text-align: center;
    font-size: 0.9rem;
}

.status-active { color: var(--muted-earth); }
.status-review { color: #9A8A58; }
.status-hold { color: var(--sand); }
.status-planning { color: var(--medium-earth); }

.health-green { color: #7A9A58; }
.health-amber { color: #B8A050; }

/* --- Metrics Grid --- */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin: 1.5rem 0 2rem;
}

.metric-card {
    background: var(--parchment);
    padding: 1.2rem 1rem;
    border-radius: 2px;
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(200, 184, 152, 0.2);
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    color: var(--deep-earth);
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.metric-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--muted-earth);
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.metric-trend {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    margin-top: 0.5rem;
    letter-spacing: 0.05em;
}

.trend-up { color: #7A9A58; }
.trend-down { color: #7A9A58; }
.trend-neutral { color: var(--muted-earth); }

/* --- Allocation Bars --- */
.allocation-bars {
    margin: 1.5rem 0 2rem;
}

.allocation-item {
    margin-bottom: 0.8rem;
}

.allocation-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted-earth);
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

.allocation-bar-track {
    width: 100%;
    height: 22px;
    background: var(--parchment);
    border-radius: 1px;
    overflow: hidden;
    border: 1px solid rgba(200, 184, 152, 0.2);
}

.allocation-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sand), var(--muted-earth));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--cream);
    letter-spacing: 0.05em;
    width: 0%;
    transition: width 1.2s ease-out;
    border-radius: 1px;
}

/* --- Risk Register --- */
.risk-entries {
    margin: 1.5rem 0;
}

.risk-entry {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(200, 184, 152, 0.15);
}

.risk-entry:last-child {
    border-bottom: none;
}

.risk-severity {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    flex: 0 0 40px;
    text-align: center;
    padding-top: 0.2rem;
    font-weight: 400;
}

.risk-high .risk-severity { color: #A07040; }
.risk-medium .risk-severity { color: #B8A050; }
.risk-low .risk-severity { color: var(--muted-earth); }

.risk-content h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--deep-earth);
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.risk-content p {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.risk-mitigation {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-earth);
    letter-spacing: 0.03em;
    opacity: 0.8;
}

/* --- Timeline --- */
.timeline-entries {
    margin: 1.5rem 0;
    position: relative;
    padding-left: 1.5rem;
}

.timeline-entries::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: linear-gradient(to bottom, var(--sand), var(--muted-earth), var(--sand));
    opacity: 0.4;
}

.timeline-entry {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.timeline-date {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted-earth);
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
    opacity: 0.7;
}

.timeline-marker {
    position: absolute;
    left: -1.5rem;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--sand);
    background: var(--cream);
    z-index: 1;
}

.timeline-entry.completed .timeline-marker {
    background: var(--sand);
    border-color: var(--muted-earth);
}

.timeline-entry.current .timeline-marker {
    background: var(--muted-earth);
    border-color: var(--deep-earth);
    box-shadow: 0 0 0 3px rgba(138, 122, 88, 0.15);
}

.timeline-entry.upcoming .timeline-marker {
    background: var(--parchment);
    border-color: var(--sand);
}

.timeline-content h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--deep-earth);
    margin-bottom: 0.3rem;
    line-height: 1.3;
}

.timeline-content p {
    font-size: 0.88rem;
    color: var(--medium-earth);
    margin-bottom: 0;
}

.timeline-entry.upcoming .timeline-content h3 {
    opacity: 0.6;
}

.timeline-entry.upcoming .timeline-content p {
    opacity: 0.5;
}

/* --- Observations --- */
.observation-list {
    margin: 1.5rem 0;
}

.observation-item {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    align-items: flex-start;
}

.observation-marker {
    font-size: 0.7rem;
    color: var(--sand);
    margin-top: 0.5rem;
    flex: 0 0 16px;
}

.observation-item p {
    margin-bottom: 0;
    font-size: 0.92rem;
}

/* --- Footer --- */
#report-footer {
    margin-top: 6rem;
    padding-top: 2rem;
    text-align: center;
}

.wabi-sabi-marker.marker-footer svg {
    width: 100%;
    max-width: 200px;
    height: auto;
    margin-bottom: 2rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
}

.footer-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--deep-earth);
    letter-spacing: 0.02em;
}

.footer-meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted-earth);
    letter-spacing: 0.1em;
    opacity: 0.6;
}

.footer-stamp {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--sand);
    margin-top: 0.5rem;
    opacity: 0.6;
}

.footer-end-mark {
    margin-top: 3rem;
    font-size: 0.5rem;
    color: var(--sand);
    opacity: 0.4;
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .risk-entry {
        flex-direction: column;
        gap: 0.5rem;
    }

    .risk-severity {
        text-align: left;
    }

    .data-row {
        font-size: 0.7rem;
    }

    .cell-project {
        flex: 1.5;
    }

    .metric-value {
        font-size: 1.5rem;
    }
}

/* --- Scroll-triggered bar animation class --- */
.allocation-bar-fill.animated {
    /* Width set by JS based on data-width attribute */
}

/* --- Selection styling --- */
::selection {
    background: rgba(200, 184, 152, 0.3);
    color: var(--deep-earth);
}
