:root {
  --paper: #f7f2e8;
  --ink: #2d2a26;
  --ink-soft: #4b463f;
  --accent: #c7b9a9;
  --tape: #efe7d8;
  --shadow: rgba(0,0,0,0.08);
  --shadow-strong: rgba(0,0,0,0.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.03), rgba(0,0,0,0.03) 1px, transparent 1px, transparent 6px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.03), rgba(0,0,0,0.03) 1px, transparent 1px, transparent 6px),
    radial-gradient(1000px 400px at 50% -100px, rgba(0,0,0,0.06), transparent 60%),
    radial-gradient(600px 200px at 120% 20%, rgba(0,0,0,0.05), transparent 60%);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

.handwritten { font-family: Kalam, "Comic Sans MS", cursive; letter-spacing: 0.5px; }

.page { max-width: 1040px; margin: 0 auto; padding: 64px 24px 48px; }

.hero { text-align: center; padding-top: 24px; }
.name { font-size: clamp(48px, 9vw, 112px); margin: 0; color: var(--ink); transform: translateY(6px); transition: transform 700ms ease, opacity 700ms ease; opacity: 0.001; }
body.loaded .name { transform: translateY(0); opacity: 1; }
.about { max-width: 760px; margin: 18px auto 12px; font-size: clamp(16px, 2.6vw, 20px); color: var(--ink-soft); background: rgba(255,255,255,0.5); padding: 18px 20px; border: 1px solid rgba(0,0,0,0.06); box-shadow: 0 6px 22px var(--shadow); border-radius: 8px; backdrop-filter: blur(0.5px); }

.social { display: flex; justify-content: center; gap: 22px; margin-top: 16px; flex-wrap: wrap; }
.social-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; padding: 8px 12px; border: 1px solid rgba(0,0,0,0.06); border-radius: 10px; background: rgba(255,255,255,0.6); box-shadow: 0 4px 14px var(--shadow); transition: transform 160ms ease, box-shadow 160ms ease; }
.social-link:hover { transform: translateY(-2px); box-shadow: 0 10px 22px var(--shadow-strong); }
.social .icon svg { display: block; stroke: var(--ink); }
.social .label { font-size: 16px; }

.project { margin-top: 56px; }
.project-card { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; padding: 24px; background: #fffef8; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 18px 38px var(--shadow-strong); border-radius: 12px; position: relative; }
.project-card.polaroid::before, .project-card.polaroid::after { content: ""; position: absolute; width: 86px; height: 28px; background: var(--tape); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 4px 10px var(--shadow); opacity: 0.8; top: -14px; transform: rotate(-6deg); left: 24px; }
.project-card.polaroid::after { right: 24px; left: auto; transform: rotate(8deg); }
.project-image { height: 280px; background: linear-gradient(135deg, #d8d0c3, #efe7d8); border: 1px dashed rgba(0,0,0,0.25); border-radius: 12px; display: grid; place-items: center; color: rgba(0,0,0,0.55); font-weight: 600; letter-spacing: 0.8px; }
.project-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.project-info h2 { font-size: clamp(28px, 4vw, 42px); margin: 0 0 8px; }
.project-info p { margin: 0 0 16px; color: var(--ink-soft); }
.button { display: inline-block; padding: 10px 16px; border-radius: 10px; background: #f5ede0; border: 1px solid rgba(0,0,0,0.12); color: var(--ink); text-decoration: none; box-shadow: 0 6px 16px var(--shadow); transition: transform 160ms ease, box-shadow 160ms ease; }
.button:hover { transform: translateY(-2px); box-shadow: 0 12px 24px var(--shadow-strong); }

.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin-top: 48px; }
.column h3 { font-size: clamp(22px, 2.8vw, 30px); margin: 0 0 14px; }

.experiment-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
.experiment-card { display: grid; grid-template-columns: 100px 1fr; gap: 12px; align-items: center; padding: 12px; background: #fffef8; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 10px 22px var(--shadow); border-radius: 12px; position: relative; transition: transform 160ms ease, box-shadow 160ms ease; }
.experiment-card:hover { transform: translateY(-2px); box-shadow: 0 16px 26px var(--shadow-strong); }
.experiment-card.polaroid::before { content: ""; position: absolute; width: 64px; height: 22px; background: var(--tape); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 4px 10px var(--shadow); opacity: 0.85; top: -12px; left: 16px; transform: rotate(-5deg); }
.thumb { height: 80px; border-radius: 10px; background: linear-gradient(135deg, #e5dccf, #f1e8db); border: 1px dashed rgba(0,0,0,0.22); }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.details h4 { margin: 0 0 4px; font-size: 18px; }
.details p { margin: 0 0 6px; color: var(--ink-soft); }
.details .year { font-size: 12px; color: rgba(0,0,0,0.55); }

.writings-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.note { background: #fffef8; border-radius: 10px; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 8px 18px var(--shadow); position: relative; }
.note::before { content: ""; position: absolute; top: -10px; left: 20px; width: 60px; height: 20px; background: var(--tape); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 4px 10px var(--shadow); transform: rotate(-6deg); opacity: 0.85; }
.note a { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; padding: 14px 16px; text-decoration: none; color: var(--ink); }
.note .title { font-size: 18px; }
.note .meta { font-size: 13px; color: rgba(0,0,0,0.6); }
.note .arrow { font-size: 14px; color: rgba(0,0,0,0.7); }
.note:hover { transform: translateY(-2px); box-shadow: 0 14px 26px var(--shadow-strong); }

.footer { margin-top: 56px; text-align: center; color: rgba(0,0,0,0.7); }
.footer-line { display: inline-block; padding: 8px 12px; border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; background: rgba(255,255,255,0.55); box-shadow: 0 4px 12px var(--shadow); }
.footer-doodles { display: flex; justify-content: center; gap: 18px; margin-top: 12px; opacity: 0.6; }
.footer-doodles svg { stroke: var(--ink-soft); }

.tools { margin-top: 36px; }
.tools-card { width: 100%; max-width: none; margin: 0; background: #fffef8; border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 10px 22px var(--shadow); border-radius: 12px; padding: 18px 20px; text-align: left; position: relative; display: grid; grid-template-rows: auto 1fr; }
.tools-card.polaroid::before { content: ""; position: absolute; top: -12px; left: 24px; transform: rotate(-4deg); width: 86px; height: 26px; background: var(--tape); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 4px 10px var(--shadow); opacity: 0.9; }
.tools-card h3 { margin: 4px 0 6px; font-size: clamp(20px, 2.6vw, 28px); }
.tools-subtext { margin: 0; color: rgba(0,0,0,0.65); font-weight: 600; }
.tools-cut { margin: 12px 0; width: 100%; border: 1px dashed rgba(0,0,0,0.35); border-radius: 10px; padding: 8px 14px; display: flex; justify-content: center; align-items: center; position: relative; background: rgba(255,255,255,0.6); }
.tools-cut::before { content: '✂'; position: absolute; top: -14px; left: 12px; font-size: 16px; color: rgba(0,0,0,0.6); }
.tools-cut::after { content: 'cut here'; position: absolute; bottom: -18px; right: 12px; font-size: 12px; color: rgba(0,0,0,0.6); }

.polaroid { transform: rotate(-0.4deg); }
.experiment-card.polaroid { transform: none; }

@media (max-width: 980px) {
  .page { padding: 48px 18px 36px; }
  .project-card { grid-template-columns: 1fr; }
  .project-image { height: 220px; }
}

@media (max-width: 680px) {
  .two-columns { grid-template-columns: 1fr; }
  .experiment-grid { grid-template-columns: 1fr; }
  .social-link { padding: 8px 10px; }
}

.overlay[aria-hidden="true"] { display: none; }
.overlay { position: fixed; inset: 0; z-index: 1000; overflow-y: auto; }
.overlay-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.25); backdrop-filter: blur(2px); z-index: 0; }
.detail-card { position: relative; max-width: 940px; margin: 24px auto; background: #fffef8; border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 30px 60px rgba(0,0,0,0.25); border-radius: 14px; max-height: calc(100vh - 80px); display: flex; flex-direction: column; z-index: 1; padding-top: 32px; }
.detail-card.polaroid::before, .detail-card.polaroid::after { content: ""; position: absolute; width: 96px; height: 30px; background: var(--tape); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 6px 14px var(--shadow); opacity: 0.9; top: -16px; left: 32px; transform: rotate(-5deg); }
.detail-card.polaroid::after { right: 32px; left: auto; transform: rotate(7deg); }
.close { position: absolute; right: 10px; top: 6px; font-size: 22px; background: rgba(0,0,0,0.04); border: 1px solid rgba(0,0,0,0.1); color: var(--ink); cursor: pointer; border-radius: 999px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; z-index: 3; }
.close:hover { background: rgba(0,0,0,0.08); }
.detail-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.detail-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 0 4px; }
.detail-header .meta { color: rgba(0,0,0,0.6); }
.detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; align-items: start; }
.detail-image { border: 1px dashed rgba(0,0,0,0.22); border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, #e5dccf, #f1e8db); }
.detail-image img { display: block; width: 100%; height: auto; }
.detail-text p { margin: 0 0 10px; color: var(--ink-soft); }
.detail-text .button { margin-top: 16px; }
.writing-note { text-align: center; font-size: 14px; color: rgba(0,0,0,0.6); margin: 6px 0 10px; font-style: italic; }
.subscribe[aria-hidden="true"] { display: none; }
.subscribe { position: fixed; inset: 0; z-index: 1100; }
.subscribe-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.28); backdrop-filter: blur(2px); z-index: 0; }
.subscribe-card { position: relative; max-width: 560px; margin: 24px auto; background: #fffef8; border: 1px solid rgba(0,0,0,0.1); box-shadow: 0 30px 60px rgba(0,0,0,0.25); border-radius: 14px; padding: 48px 22px 22px; z-index: 1; }
.subscribe-card.polaroid::before, .subscribe-card.polaroid::after { content: ""; position: absolute; width: 86px; height: 28px; background: var(--tape); border: 1px solid rgba(0,0,0,0.08); box-shadow: 0 6px 14px var(--shadow); opacity: 0.9; top: -14px; left: 24px; transform: rotate(-5deg); }
.subscribe-card.polaroid::after { right: 24px; left: auto; transform: rotate(6deg); }
.subscribe-text { margin: 6px 0 12px; color: var(--ink-soft); }
.subscribe-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.subscribe-input { padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.12); background: rgba(255,255,255,0.7); font-size: 16px; }
.subscribe-input[aria-invalid="true"] { border-color: #c96; box-shadow: 0 0 0 3px rgba(201, 150, 96, 0.18); }
.subscribe-btn { padding: 12px 16px; }
.subscribe-note { text-align: center; font-size: 12px; color: rgba(0,0,0,0.55); margin-top: 10px; }

@media (max-width: 600px) {
  .subscribe-form { grid-template-columns: 1fr; }
}
.embed { margin: 10px 0 12px; }
.embed-substack { display: flex; justify-content: center; }
.embed-substack iframe { border: none; display: block; width: 100% !important; max-width: 100% !important; height: 470px; border-radius: 10px; box-shadow: 0 8px 18px var(--shadow); background: #fffef8; margin: 0 auto; }
.embed-substack .substack-post-embed { max-width: 680px !important; width: 100% !important; margin: 10px auto; display: flex !important; justify-content: center; }

.overlay.is-writing .detail-grid { grid-template-columns: 1fr; }
.overlay.is-writing .detail-text { max-width: 760px; margin: 0 auto; }
.detail-section { margin: 8px 0 12px; }
.detail-section h4 { margin: 0 0 6px; font-size: 16px; }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.tag { display: inline-block; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(0,0,0,0.1); background: #f6efe1; font-size: 13px; color: rgba(0,0,0,0.75); }
.bullets { margin: 6px 0 8px; padding-left: 20px; }
.bullets li { margin: 3px 0; }

@media (max-width: 980px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-card { margin: 16px auto; max-height: calc(100vh - 48px); }
}
