/* Firzan Portfolio Design System — reusable foundations and components */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--type-md);
  font-weight: 460;
  letter-spacing: var(--tracking-body);
  line-height: var(--leading-md);
  transition: background-color var(--duration-theme) ease, color var(--duration-theme) ease;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.75;
  vertical-align: -0.125em;
}

.icon--sm {
  width: 13px;
  height: 13px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: var(--space-section-first) 0 0;
}

.theme-toggle-input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  width: 56px;
  height: 30px;
  align-items: center;
  justify-content: space-around;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: scale var(--duration-fast) cubic-bezier(0.2, 0, 0, 1);
}

.theme-toggle:active { scale: 0.96; }

.theme-toggle::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  transform: translateX(26px);
  transition: transform var(--duration-theme) ease;
}

.theme-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 18px;
}

.theme-icon [data-feather] {
  font-style: normal;
  font-size: var(--type-xs);
  line-height: 1;
}

.theme-icon--sun { color: var(--text-tertiary); }
.theme-icon--moon { color: var(--background); }
.theme-toggle-input:checked + .theme-toggle::before { transform: translateX(0); }
.theme-toggle-input:checked + .theme-toggle .theme-icon--sun { color: var(--background); }
.theme-toggle-input:checked + .theme-toggle .theme-icon--moon { color: var(--text-tertiary); }
.theme-toggle-input:focus-visible + .theme-toggle { outline: 2px solid var(--accent); outline-offset: 3px; }

.profile { margin-bottom: 40px; }
.profile-copy { display: grid; line-height: var(--leading-md); }
.profile-name { color: var(--text); font-weight: 500; }
.profile-role { color: var(--text-secondary); }

.hero-headline {
  min-height: 1em;
  margin: 0 0 var(--space-8);
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--type-display);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.typing-caret {
  display: inline-block;
  width: 2px;
  height: 0.62em;
  margin-left: 3px;
  background: currentColor;
  vertical-align: -0.02em;
}

.typing-caret--blink { animation: typing-blink 0.8s step-end infinite; }
@keyframes typing-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.intro {
  color: var(--text-secondary);
  font-size: var(--type-md);
  line-height: var(--leading-copy);
}

.intro p { margin: 0 0 var(--space-4); }
.intro p:last-child { margin-bottom: 0; }
.intro-emphasis,
.text-link {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--text-tertiary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.section { margin-top: var(--space-section); }
header + .section { margin-top: var(--space-section-first); }
.section-heading {
  margin: 0 0 var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--type-md);
  font-weight: 460;
  line-height: var(--leading-md);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.project-card {
  --project-surface: var(--surface);
  position: relative;
  display: flex;
  min-height: 308px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--project-surface);
  box-shadow: inset 0 0 0 3px var(--background);
  text-decoration: none;
  transition: transform var(--duration-base) ease, background var(--duration-base) ease, opacity var(--duration-theme) ease, filter var(--duration-theme) ease;
}

.project-card:hover { --project-surface: var(--surface-hover); transform: translateY(-3px); background: var(--project-surface); }
.project-card:focus-visible { z-index: 1; outline: 2px solid var(--accent); outline-offset: 3px; }
.project-card--coming-soon {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, var(--surface) 0, var(--surface) 20px, var(--surface-hover) 20px, var(--surface-hover) 21px);
}

@media (hover: hover) {
  .projects-grid:has(.project-card:hover) .project-card:not(:hover) { opacity: var(--dimmed-opacity); filter: saturate(0.35); }
}

.project-visual {
  position: relative;
  display: grid;
  min-height: 198px;
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-5);
  overflow: hidden;
  place-items: center;
  border-bottom: 1px solid var(--line);
}

.placeholder-visual {
  position: relative;
  width: min(calc(100% - 36px), 276px);
  height: 166px;
  overflow: hidden;
  background: transparent;
}

.placeholder-visual::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    radial-gradient(circle at 18px 18px, transparent 0 7px, var(--text-tertiary) 7.5px 8px, transparent 8.5px),
    radial-gradient(circle at calc(100% - 18px) 18px, transparent 0 7px, var(--text-tertiary) 7.5px 8px, transparent 8.5px),
    linear-gradient(var(--text-tertiary), var(--text-tertiary)) 0 18px / 100% 1px no-repeat,
    linear-gradient(var(--text-tertiary), var(--text-tertiary)) 18px 0 / 1px 100% no-repeat,
    linear-gradient(var(--text-tertiary), var(--text-tertiary)) calc(100% - 18px) 0 / 1px 100% no-repeat;
  opacity: 0.34;
  pointer-events: none;
  transition: opacity var(--duration-base) ease;
}

.placeholder-visual::after {
  content: "";
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  height: 30%;
  background: linear-gradient(to bottom, transparent, var(--project-surface) 96%);
  pointer-events: none;
  transition: height var(--duration-theme) ease, opacity var(--duration-base) ease;
}

.project-thumbnail-image { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.project-thumbnail-image:not([src]) { display: none; }
.placeholder-visual:has(.project-thumbnail-image[src]) .placeholder-browser { opacity: 0; }

.placeholder-browser {
  position: absolute;
  z-index: 2;
  top: 28px;
  right: 24px;
  bottom: -4px;
  left: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--background);
  transition: border-color var(--duration-base) ease;
}

.project-card:hover .placeholder-visual::after,
.project-card:focus-visible .placeholder-visual::after { height: 8%; opacity: 0; }
.project-card:hover .placeholder-visual::before,
.project-card:focus-visible .placeholder-visual::before { opacity: 0.48; }
.project-card:hover .placeholder-browser,
.project-card:focus-visible .placeholder-browser { border-color: var(--text-tertiary); }

.placeholder-visual--dash .placeholder-browser,
.placeholder-visual--dash .placeholder-line--field { border-style: dashed; }
.placeholder-visual--dash .placeholder-line:not(.placeholder-line--field) {
  background: repeating-linear-gradient(90deg, var(--line) 0 7px, transparent 7px 11px);
}

.placeholder-visual--pencil .placeholder-browser {
  border-radius: 11px 8px 12px 9px;
  box-shadow: 2px 1px 0 -1px var(--line-soft);
  transform: rotate(-0.45deg);
  transform-origin: center;
}
.placeholder-visual--pencil .placeholder-line {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 55%, transparent);
  transform: rotate(-0.7deg);
}
.placeholder-visual--pencil .placeholder-line--copy,
.placeholder-visual--pencil .placeholder-line--action { transform: rotate(0.8deg); }

.placeholder-toolbar { display: block; height: 18px; border-bottom: 1px solid var(--line-soft); }
.placeholder-toolbar::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-tertiary);
  box-shadow: 8px 0 0 var(--line), 16px 0 0 var(--text-secondary);
}

.placeholder-line { position: absolute; left: 18px; display: block; height: 5px; border-radius: 2px; background: var(--line-soft); }
.placeholder-line--title { top: 36px; width: 34%; height: 7px; background: var(--line); }
.placeholder-line--copy { top: 51px; width: 26%; }
.placeholder-line--field { top: 67px; width: 48%; height: 10px; border: 1px solid var(--line); background: transparent; }
.placeholder-line--action { top: 86px; width: 20%; height: 9px; background: var(--text-tertiary); }

.placeholder-browser::after {
  content: "";
  position: absolute;
  top: 19px;
  right: 0;
  bottom: 0;
  width: 42%;
  border-left: 1px solid var(--line-soft);
  background: var(--surface-hover);
  opacity: 0.45;
}

.project-title { margin: 0; font-size: var(--type-md); font-weight: 500; line-height: var(--leading-md); }
.project-description { margin: 2px 0 0; color: var(--text-secondary); font-size: var(--type-sm); line-height: var(--leading-sm); }

.project-sticker {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  padding: 4px 9px 5px;
  border: 2px solid #f7efe4;
  border-radius: var(--radius-pill);
  background: #ff9f43;
  color: #20170e;
  font-size: var(--type-xs);
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14), 0 1px 3px rgba(0, 0, 0, 0.12);
  transform: rotate(-5deg);
}

.project-sticker--ecosystem { background: #b8dfd0; color: #14332d; font-size: 10px; transform: rotate(2deg); }
.project-sticker--strategy { background: #d8c9ff; color: #251d3c; font-size: 10px; transform: rotate(-2deg); }
.project-sticker--incoming { border-color: var(--accent); border-style: dashed; background: var(--surface); color: var(--accent); font-size: 10px; transform: rotate(4deg); }

.writing-list { display: grid; }
.writing-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-7);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--line-soft);
  text-decoration: none;
  transition: opacity var(--duration-theme) ease, filter var(--duration-theme) ease;
}
.writing-item:first-child { border-top: 1px solid var(--line-soft); }
.writing-title { display: block; color: var(--text); font-size: var(--type-md); line-height: var(--leading-md); }
.writing-summary { display: block; margin-top: 3px; color: var(--text-secondary); font-size: var(--type-sm); line-height: var(--leading-sm); }
.writing-year { color: var(--text-tertiary); font-size: var(--type-sm); line-height: var(--leading-sm); }
@media (hover: hover) {
  .writing-list:has(.writing-item:hover) .writing-item:not(:hover) { opacity: var(--dimmed-opacity); filter: saturate(0.35); }
}

.notes-card {
  padding: var(--space-7);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: radial-gradient(ellipse at 88% 8%, var(--notes-glow), transparent 52%), radial-gradient(ellipse at 12% 100%, var(--notes-glow-soft), transparent 58%), var(--surface);
}
.notes-card h2 { margin: 0 0 var(--space-2); font-size: var(--type-md); font-weight: 500; }
.notes-card p { margin: 0; color: var(--text-secondary); font-size: var(--type-sm); line-height: var(--leading-sm); }
.signup { display: flex; gap: var(--space-2); margin-top: var(--space-6); }
.signup input { min-width: 0; flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--background); color: var(--text); font: inherit; }
.signup input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.signup button { padding: 0 16px; border: 0; border-radius: var(--radius-sm); background: var(--text); color: var(--background); font: inherit; font-weight: 500; cursor: pointer; }
.form-note { display: block; margin-top: 10px; color: var(--text-tertiary); font-size: var(--type-xs); }

/* ── Case study components ── */
/* Per case study, set the accent, border, surface, padding, or width variables below. */
.diagram-panel {
  --diagram-panel-accent: var(--accent);
  --diagram-panel-border: var(--line);
  --diagram-panel-surface: var(--surface);
  --diagram-panel-padding: var(--space-6);
  --diagram-panel-width: 100%;
  display: grid;
  width: min(100%, var(--diagram-panel-width));
  gap: var(--space-4);
  margin: var(--space-8) 0 34px;
  padding: var(--diagram-panel-padding);
  border: 1px solid var(--diagram-panel-border);
  border-radius: var(--radius-case-study);
  background: var(--diagram-panel-surface);
}

.dotted-grid-surface,
.diagram-panel--grid {
  --diagram-grid-dot: color-mix(in srgb, var(--text) 5%, transparent);
  background-color: var(--diagram-panel-surface, var(--surface));
  background-image: radial-gradient(circle, var(--diagram-grid-dot) 0 1px, transparent 1.2px);
  background-position: 0 0;
  background-size: 9px 9px;
}

.diagram-panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.diagram-panel__title {
  color: var(--text);
  font-size: var(--type-body);
  font-weight: 500;
  line-height: 1.35;
}

.diagram-panel__meta {
  color: var(--text-tertiary);
  font-family: var(--font-utility);
  font-size: var(--type-annotation);
  text-align: end;
}

.diagram-panel__body { min-width: 0; }

/* Card interface: override the four color variables; use --dashed for secondary branches. */
.diagram-card {
  --diagram-card-surface: color-mix(in srgb, var(--surface) 97%, var(--text));
  --diagram-card-border: color-mix(in srgb, var(--text) 5%, transparent);
  --diagram-card-text: var(--text);
  --diagram-card-label: var(--text-tertiary);
  display: grid;
  min-width: 0;
  min-height: 50px;
  align-content: center;
  justify-items: center;
  gap: 0;
  padding: 8px 16px;
  border: 1px solid var(--diagram-card-border);
  border-radius: var(--radius-sm);
  background: var(--diagram-card-surface);
  color: var(--diagram-card-text);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}

.diagram-card > span {
  color: var(--diagram-card-label);
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 500;
  line-height: 16px;
  text-transform: uppercase;
}

.diagram-card > strong {
  color: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
}

.diagram-card--dashed { border-style: dashed; }

/* Connector interface: set --diagram-connector-color on the containing SVG. */
.diagram-connectors {
  --diagram-connector-color: var(--accent);
  pointer-events: none;
}

.diagram-connectors use {
  fill: none;
  stroke: var(--diagram-connector-color);
  vector-effect: non-scaling-stroke;
}

.diagram-connectors__base use {
  stroke-width: 1;
  opacity: 0.52;
}

.diagram-connectors__motion use {
  stroke-width: 1.5;
  stroke-dasharray: 2 9;
  stroke-linecap: round;
  opacity: 0.95;
}

@media (prefers-reduced-motion: no-preference) {
  .diagram-connectors__motion use {
    animation: diagram-connector-flow 1.8s linear infinite;
  }
}

@keyframes diagram-connector-flow {
  to { stroke-dashoffset: -22px; }
}

.case-study-quote,
.case-study-highlight {
  padding: 20px 22px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--type-body);
  font-weight: 500;
  line-height: var(--leading-copy);
}

.case-decision-label {
  color: var(--accent);
  font-family: var(--font-body);
  font-size: var(--type-sm);
  font-weight: 500;
  line-height: var(--leading-sm);
}

.case-study-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-case-study);
  background: var(--surface);
}

.footer {
  position: relative;
  display: flex;
  min-height: 280px;
  justify-content: center;
  overflow: hidden;
  margin-top: 100px;
  padding-top: var(--space-8);
  border-top: 1px solid var(--line-soft);
  color: var(--text-tertiary);
  font-size: var(--type-sm);
  text-align: center;
}
.footer-javanese {
  position: absolute;
  bottom: -0.48em;
  left: 50%;
  color: transparent;
  font-family: var(--font-javanese);
  font-size: clamp(210px, 34vw, 270px);
  line-height: 1;
  opacity: 0.82;
  pointer-events: none;
  transform: translateX(-50%);
  white-space: nowrap;
  -webkit-text-stroke: 1px var(--line);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 28%, transparent 68%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 28%, transparent 68%);
}

@media (max-width: 560px) {
  .page { width: min(calc(100% - 32px), var(--content-width)); padding-top: 56px; }
  .theme-toggle { top: 16px; right: 16px; }
  .section { margin-top: 88px; }
  header + .section { margin-top: 72px; }
  .projects-grid { grid-template-columns: 1fr; }
  .signup { flex-direction: column; }
  .signup button { min-height: 44px; }
  .case-study-card { padding: var(--space-7); }
  .diagram-panel { --diagram-panel-padding: var(--space-4); }
  .diagram-panel__header { display: block; }
  .diagram-panel__meta { display: block; margin-top: var(--space-1); text-align: start; }
  .footer { min-height: 220px; }
  .footer-javanese { bottom: -0.5em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .typing-caret { display: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
