/* tanso.club - Neomorphic Carbon Workshop */
/* Fonts: Source Serif 4, Nunito Sans, Fira Code (Google Fonts) */
/* Palette: Ceramic Pastel */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --kiln-clay: #e8e0d6;
    --warm-stone: #d8d0c8;
    --ash: #c4bdb3;
    --bone: #fcf4ea;
    --charcoal-ink: #3a352e;
    --smoke: #7a7268;
    --celadon-blush: #b8c9b4;
    --slate-periwinkle: #a8b4c8;
    --kiln-rose: #d4a8a0;
    --carbon-black: #2a2520;

    --shadow-convex: 8px 8px 16px var(--ash), -8px -8px 16px var(--bone);
    --shadow-convex-hover: 12px 12px 20px var(--ash), -12px -12px 20px var(--bone);
    --shadow-concave: inset 6px 6px 12px var(--ash), inset -6px -6px 12px var(--bone);
    --shadow-flat: none;
    --shadow-btn: 4px 4px 8px var(--ash), -4px -4px 8px var(--bone);
    --shadow-btn-pressed: inset 4px 4px 8px var(--ash), inset -4px -4px 8px var(--bone);

    --radius: 24px;
    --gap: 8px;
}

html {
    font-size: 16px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--warm-stone);
    color: var(--charcoal-ink);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Hex background texture */
.hex-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Bento Container */
.bento-container {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: minmax(140px, auto);
    gap: var(--gap);
    width: 92vw;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--gap);
    min-height: 100vh;
}

/* Base Bento Cell */
.bento-cell {
    background: var(--kiln-clay);
    border-radius: var(--radius);
    box-shadow: var(--shadow-convex);
    padding: 28px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 300ms ease, transform 300ms ease;
    animation: bounceSettle 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.bento-cell:hover {
    box-shadow: var(--shadow-convex-hover);
    transform: translateY(-3px);
}

/* Bounce-enter stagger */
@keyframes bounceSettle {
    0% { opacity: 0; transform: translateY(-30px) scale(0.96); }
    60% { opacity: 1; transform: translateY(4px) scale(1.01); }
    80% { transform: translateY(-2px) scale(0.995); }
    100% { transform: translateY(0) scale(1); }
}

.bento-cell:nth-child(1) { animation-delay: 0ms; }
.bento-cell:nth-child(2) { animation-delay: 80ms; }
.bento-cell:nth-child(3) { animation-delay: 160ms; }
.bento-cell:nth-child(4) { animation-delay: 240ms; }
.bento-cell:nth-child(5) { animation-delay: 320ms; }
.bento-cell:nth-child(6) { animation-delay: 400ms; }
.bento-cell:nth-child(7) { animation-delay: 480ms; }
.bento-cell:nth-child(8) { animation-delay: 560ms; }
.bento-cell:nth-child(9) { animation-delay: 640ms; }
.bento-cell:nth-child(10) { animation-delay: 720ms; }
.bento-cell:nth-child(11) { animation-delay: 800ms; }

/* Grid Area Assignments */
.cell-header {
    grid-column: 1 / -1;
    grid-row: span 1;
}

.cell-hero {
    grid-column: 1 / 5;
    grid-row: span 3;
}

.cell-sidebar-1 {
    grid-column: 5 / 7;
    grid-row: span 2;
}

.cell-sidebar-2 {
    grid-column: 5 / 7;
    grid-row: span 1;
}

.cell-feature-1 {
    grid-column: 1 / 4;
    grid-row: span 2;
}

.cell-feature-2 {
    grid-column: 4 / 7;
    grid-row: span 2;
}

.cell-small-1 {
    grid-column: 1 / 3;
    grid-row: span 1;
}

.cell-small-2 {
    grid-column: 3 / 5;
    grid-row: span 1;
}

.cell-small-3 {
    grid-column: 5 / 7;
    grid-row: span 1;
}

.cell-feature-3 {
    grid-column: 1 / 4;
    grid-row: span 1;
}

.cell-footer {
    grid-column: 1 / -1;
    grid-row: span 1;
    box-shadow: var(--shadow-concave);
    background: var(--kiln-clay);
}

.cell-footer:hover {
    box-shadow: var(--shadow-concave);
    transform: none;
}

/* Typography */
h1 {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--charcoal-ink);
    margin-bottom: 16px;
}

h2 {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--charcoal-ink);
    margin-bottom: 12px;
}

.subtitle {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 0.75em;
    color: var(--smoke);
}

.cell-content h2 {
    font-size: 1.3rem;
}

.cell-content p {
    font-size: 0.95rem;
    color: var(--smoke);
    line-height: 1.65;
}

.code-text {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    background: var(--warm-stone);
    box-shadow: inset 2px 2px 4px var(--ash), inset -2px -2px 4px var(--bone);
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-block;
}

.formula {
    display: block;
    margin-top: 12px;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--smoke);
}

/* Header */
.cell-header {
    padding: 16px 28px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logotype {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.kanji {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: 1.8rem;
    color: var(--carbon-black);
}

.latin {
    font-family: 'Source Serif 4', serif;
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--charcoal-ink);
}

.header-nav {
    display: flex;
    gap: 8px;
}

.nav-pill {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--smoke);
    background: var(--kiln-clay);
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: inset 3px 3px 6px var(--ash), inset -3px -3px 6px var(--bone);
    transition: box-shadow 200ms ease, color 200ms ease, background 200ms ease;
}

.nav-pill:hover {
    box-shadow: none;
    background: #ddd6cc;
    color: var(--charcoal-ink);
}

.nav-pill:active {
    box-shadow: inset 4px 4px 8px var(--ash), inset -4px -4px 8px var(--bone);
}

/* Hero Cell */
.cell-hero {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0;
}

.hero-lattice {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: var(--radius);
    background: radial-gradient(ellipse at center, var(--kiln-clay) 0%, var(--warm-stone) 80%);
}

.lattice-svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duotone-overlay {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
}

.science-overlay {
    background: linear-gradient(135deg, rgba(184,201,180,0.15), rgba(184,201,180,0.05));
    mix-blend-mode: color;
}

.culture-overlay {
    background: linear-gradient(135deg, rgba(212,168,160,0.15), rgba(212,168,160,0.05));
    mix-blend-mode: color;
}

.hero-text {
    position: relative;
    z-index: 2;
    padding: 32px;
    background: linear-gradient(to top, var(--kiln-clay) 0%, rgba(232,224,214,0.9) 60%, transparent 100%);
    border-radius: 0 0 var(--radius) var(--radius);
}

.hero-text h1 {
    margin-bottom: 12px;
}

.hero-text p {
    max-width: 600px;
    font-size: 1rem;
    color: var(--smoke);
}

/* Science/Culture cell accent borders */
.science-cell::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--celadon-blush);
    opacity: 0.6;
}

.culture-cell::before {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--kiln-rose);
    opacity: 0.6;
}

/* Pojagi borders for culture cells */
.pojagi-border {
    position: absolute;
    inset: 8px;
    border: 2px dashed var(--kiln-rose);
    border-radius: calc(var(--radius) - 8px);
    pointer-events: none;
    opacity: 0.25;
}

/* Molecule diagrams */
.molecule-diagram {
    width: 100px;
    height: 100px;
    margin: 8px auto 12px;
}

.molecule-diagram svg {
    width: 100%;
    height: 100%;
}

.bucky-diagram {
    width: 60px;
    height: 60px;
    margin: 4px auto 8px;
}

.bucky-diagram svg {
    width: 100%;
    height: 100%;
}

/* Feature backgrounds */
.feature-bg {
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    overflow: hidden;
}

.crystal-pattern {
    position: absolute;
    inset: 0;
    background:
        conic-gradient(from 0deg at 30% 40%, transparent 0deg, rgba(184,201,180,0.08) 60deg, transparent 120deg),
        conic-gradient(from 120deg at 70% 60%, transparent 0deg, rgba(184,201,180,0.06) 60deg, transparent 120deg),
        conic-gradient(from 240deg at 50% 30%, transparent 0deg, rgba(196,189,179,0.1) 60deg, transparent 120deg),
        repeating-linear-gradient(60deg, transparent, transparent 20px, rgba(184,201,180,0.04) 20px, rgba(184,201,180,0.04) 21px),
        repeating-linear-gradient(-60deg, transparent, transparent 20px, rgba(184,201,180,0.04) 20px, rgba(184,201,180,0.04) 21px);
}

.ink-wash-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 40% 40%, rgba(212,168,160,0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 70%, rgba(212,168,160,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(196,189,179,0.1) 0%, transparent 40%);
}

.cell-feature-1 .cell-content,
.cell-feature-2 .cell-content {
    position: relative;
    z-index: 2;
}

.comparison-tags {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Ceramic glaze cracks - decorative */
.cell-sidebar-1::after {
    content: '';
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    background:
        linear-gradient(45deg, transparent 49%, var(--ash) 49%, var(--ash) 50%, transparent 50%),
        linear-gradient(-30deg, transparent 49%, var(--ash) 49%, var(--ash) 50%, transparent 50%);
    opacity: 0.3;
}

.cell-feature-1::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    width: 30px;
    height: 30px;
    background:
        linear-gradient(135deg, transparent 49%, var(--ash) 49%, var(--ash) 50%, transparent 50%),
        linear-gradient(75deg, transparent 49%, var(--ash) 49%, var(--ash) 50%, transparent 50%);
    opacity: 0.2;
}

/* Footer */
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-text {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--smoke);
}

.footer-text.secondary {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--ash);
}

/* ========== Tablet ========== */
@media (max-width: 1024px) and (min-width: 769px) {
    .bento-container {
        grid-template-columns: repeat(4, 1fr);
        width: 94vw;
    }

    .cell-header { grid-column: 1 / -1; }
    .cell-hero { grid-column: 1 / 4; grid-row: span 2; }
    .cell-sidebar-1 { grid-column: 4 / 5; grid-row: span 2; }
    .cell-sidebar-2 { grid-column: 1 / 3; grid-row: span 1; }
    .cell-feature-1 { grid-column: 3 / 5; grid-row: span 2; }
    .cell-feature-2 { grid-column: 1 / 3; grid-row: span 2; }
    .cell-small-1 { grid-column: 1 / 3; grid-row: span 1; }
    .cell-small-2 { grid-column: 3 / 5; grid-row: span 1; }
    .cell-small-3 { grid-column: 1 / 3; grid-row: span 1; }
    .cell-feature-3 { grid-column: 3 / 5; grid-row: span 1; }
    .cell-footer { grid-column: 1 / -1; }
}

/* ========== Mobile ========== */
@media (max-width: 768px) {
    .bento-container {
        grid-template-columns: repeat(2, 1fr);
        width: 96vw;
    }

    .cell-header { grid-column: 1 / -1; }
    .cell-hero { grid-column: 1 / -1; grid-row: span 2; }
    .cell-sidebar-1 { grid-column: 1 / -1; grid-row: span 1; }
    .cell-sidebar-2 { grid-column: 1 / -1; grid-row: span 1; }
    .cell-feature-1 { grid-column: 1 / -1; grid-row: span 1; }
    .cell-feature-2 { grid-column: 1 / -1; grid-row: span 1; }
    .cell-small-1 { grid-column: 1 / 2; grid-row: span 1; }
    .cell-small-2 { grid-column: 2 / 3; grid-row: span 1; }
    .cell-small-3 { grid-column: 1 / -1; grid-row: span 1; }
    .cell-feature-3 { grid-column: 1 / -1; grid-row: span 1; }
    .cell-footer { grid-column: 1 / -1; }

    .header-content {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .header-nav {
        flex-wrap: wrap;
    }

    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .bento-cell {
        padding: 20px;
    }

    .hero-text {
        padding: 20px;
    }

    h1 {
        font-size: clamp(1.6rem, 5vw, 2.4rem);
    }

    .molecule-diagram {
        width: 80px;
        height: 80px;
    }
}
