@font-face {
  font-family: IranSans;
  src: url("assets/iransans-regular.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: IranSans;
  src: url("assets/iransans-bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #231e24;
  --muted: #5f555d;
  --paper: #f6f3ef;
  --white: #fffdfa;
  --line: #ded7d2;
  --wine: #7c2438;
  --wine-dark: #612033;
  --mist: #f4e9ec;
  --model: #242529;
  font-family: IranSans, Tahoma, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; line-height: 1.85; }
img { display: block; max-inline-size: 100%; }
figure, p, h1, h2 { margin: 0; }
a { color: var(--wine-dark); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid #ad4260; outline-offset: 4px; }
.shell { width: min(1140px, calc(100% - 64px)); margin-inline: auto; }

.site-header {
  background: var(--white);
  border-block-start: 4px solid var(--wine);
  border-block-end: 1px solid var(--line);
}
.header-inner, .identity, nav { display: flex; align-items: center; }
.header-inner { justify-content: space-between; min-height: 73px; gap: 20px; }
.identity { gap: 15px; font-weight: 700; white-space: nowrap; }
.identity img { object-fit: contain; }
.identity span { padding-inline-start: 15px; border-inline-start: 1px solid var(--line); }
nav { gap: 7px; }
nav a {
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 6px;
  color: var(--muted);
  white-space: nowrap;
}
nav a:hover, nav [aria-current] { background: var(--mist); color: var(--wine-dark); }
nav [aria-current] { font-weight: 700; }

.intro {
  display: grid;
  grid-template-columns: 1fr 1.07fr;
  grid-template-areas: "copy photo";
  align-items: center;
  gap: 34px;
  padding-block: 36px 34px;
}
.intro-copy { grid-area: copy; }
.context { color: var(--wine); font-weight: 700; font-size: .94rem; }
h1 {
  font-size: clamp(2rem, 4.15vw, 3.75rem);
  line-height: 1.38;
  margin-block: 7px 13px;
  text-wrap: balance;
}
.intro-copy > p:last-of-type { color: var(--muted); max-inline-size: 34rem; }
.intro-link { display: inline-block; margin-block-start: 14px; font-weight: 700; text-underline-offset: 5px; }
.intro-links { display: flex; flex-wrap: wrap; gap: 0 17px; }
.cover { grid-area: photo; isolation: isolate; position: relative; overflow: hidden; border-radius: 9px; background: #393334; }
.cover::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(transparent, #151317c9); }
.cover img { width: 100%; height: auto; aspect-ratio: 1000 / 430; object-fit: cover; }
.cover figcaption { position: absolute; z-index: 1; inset-inline-start: 15px; bottom: 10px; color: #fff; font-size: .85rem; }

.challenge {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: 30px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--white);
  box-shadow: 0 6px 20px #49372708;
  scroll-margin-top: 16px;
}
.experiment { min-width: 0; align-self: center; }
fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
legend { padding: 0; font-weight: 700; font-size: clamp(1.1rem, 1.85vw, 1.44rem); line-height: 1.65; }
form p { margin-block: 7px 13px; color: var(--muted); font-size: .95rem; }
.option {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  min-height: 44px;
  margin-block: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
}
.option:hover, .option:has(:checked) { border-color: var(--wine); background: var(--mist); }
.option input { margin: 0; width: 17px; height: 17px; accent-color: var(--wine); flex: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-block-start: 15px; }
.primary, .secondary { min-height: 44px; padding: 7px 15px; border: 1px solid transparent; border-radius: 6px; font-weight: 700; }
.primary { background: var(--wine); color: white; }
.primary:hover { background: var(--wine-dark); }
.secondary { border-color: var(--line); background: transparent; color: var(--wine-dark); }
.secondary:hover { background: var(--mist); }
.feedback[data-result] { margin-block-start: 12px; background: var(--mist); color: var(--wine-dark); border-inline-start: 3px solid var(--wine); border-radius: 5px; padding: 10px 12px; }
.feedback[data-result="correct"] { background: #eaf0e9; border-color: #4b7359; color: #284b37; }
.feedback p { margin-top: 4px; font-size: .94rem; }

.model { align-self: start; min-width: 0; padding: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; border-radius: 8px; background: var(--model); color: #fcf7f3; }
.model-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.model h2 { font-size: 1rem; }
.model-note { font-size: .87rem; color: #d1c8c6; }
.model-note a { color: inherit; }
.model-caption { font-size: .94rem; color: #efe8e6; }
.weld-key { display: flex; flex-wrap: wrap; gap: 4px 15px; margin: 0; padding: 0; list-style: none; color: #dbd2cf; font-size: .84rem; }
.weld-key li { display: flex; align-items: center; gap: 6px; }
.weld-key li::before { content: ""; display: inline-block; width: 1.15rem; height: .7rem; border-radius: 2px; background: var(--key-color); }
.key-weld { --key-color: #38a6da; }
.key-plate { --key-color: #a6aeb5; }
.key-heat { --key-color: linear-gradient(90deg, #cd2d27, #fc8b21, #ffe881); }
.model .pass-note { padding-inline: 10px; border: 1px solid #595154; border-radius: 5px; }
.pass-note summary { color: #ffe3be; font-size: .94rem; }
.model .pass-note p { color: #f0e6e0; font-size: .92rem; }
.pass-sources a { color: #ffe3be; text-underline-offset: 3px; }
.speed-control { color: #fbefea; }
.speed-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.speed-heading label { font-weight: 700; }
.speed-heading output, .speed-ends { font-size: .86rem; color: #e0d6d2; }
.speed-ends { display: grid; grid-template-columns: repeat(3, 1fr); direction: ltr; align-items: start; }
.speed-ends > :last-child { text-align: right; }
.speed-reference { position: relative; justify-self: center; color: #ffdbab; }
.speed-reference::before { content: ""; position: absolute; left: 50%; top: -4px; height: 5px; border-inline-start: 1px solid currentColor; }
.speed-control input { display: block; width: 100%; min-height: 34px; margin: 1px 0 0; accent-color: #f5ae65; cursor: ew-resize; }

.scene {
  position: relative;
  inline-size: 100%;
  overflow: hidden;
  aspect-ratio: 2.38;
  min-height: 155px;
  border: 1px solid #514b50;
  border-radius: 5px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, #ffffff12 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, #ffffff12 23px 24px),
    #2d2e32;
  direction: ltr;
}
.scene > div { position: absolute; }
.weld-arc {
  left: 50%; top: 18%; height: 25%; width: clamp(5px, 2.1%, 12px);
  transform: translateX(-50%);
  background: linear-gradient(#acb5bb, #f1f4f5 67%, #ffd076);
  border-radius: 2px 2px 50% 50%;
  box-shadow: 0 4px 15px #fac7818c;
}
.weld-steel {
  inset: 43% 8% 20%;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid #aab3bb;
  background: linear-gradient(#b6bfc7, #818c98 30%, #5c6670);
}
.weld-inset {
  position: absolute;
  z-index: 1;
  isolation: isolate;
  inset: 0 auto 0 50%;
  width: 22%;
  height: 100%;
  transform: translateX(-50%);
  background: #197eaf;
  clip-path: polygon(0 0, 100% 0, 87% 35%, 65% 82%, 57% 100%, 43% 100%, 35% 82%, 13% 35%);
}
.weld-inset img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: luminosity; filter: grayscale(1) brightness(.78) contrast(1.1); }
.heat {
  position: absolute;
  left: 50%;
  top: 27%;
  width: var(--heat-width, 54%);
  height: var(--heat-depth, 76%);
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse closest-side, #fff3a8df 3%, #ffce47cf 23%, #fc8623ce 46%, #dc3528ad 65%, #bb241f55 84%, transparent 100%);
  opacity: var(--heat-strength, .74);
  pointer-events: none;
  transition: width .16s ease-out, height .16s ease-out, opacity .16s ease-out;
}

.chuck {
  left: 37%; top: 10%; width: 10%; height: 16%; border: 1px solid #c4c7cd; border-radius: 3px;
  background: repeating-linear-gradient(90deg, #89929d 0 4px, #a5afb7 4px 7px);
}
.drill {
  left: 40%; top: 24%; width: 4%; height: 48%;
  background: repeating-linear-gradient(145deg, #c7d3dc 0 4px, #525963 5px 8px, #949da6 9px 12px);
  clip-path: polygon(0 0,100% 0,100% 87%,50% 100%,0 87%);
  z-index: 3;
}
.plate { left: 9%; top: 57%; width: 66%; height: 10%; z-index: 2; }
.plate i { display: block; position: absolute; top: 0; width: 50%; height: 100%; background: linear-gradient(#a8bac7, #6d7a87); border-block-start: 1px solid #d1e1e8; }
.plate i:first-child { left: 0; transform: skewY(8deg); transform-origin: left; }
.plate i:last-child { right: 0; transform: skewY(-8deg); transform-origin: right; }
.model[data-state="changed"] .plate i { transform: none; }
.stand, .backing::before, .backing::after {
  top: 64%; width: 10%; height: 13%; border: 1px solid #889198; background: repeating-linear-gradient(135deg, #565f69 0 5px, #707c84 5px 8px);
}
.stand.left { left: 9%; }
.stand.right { left: 65%; }
.backing { inset: 64% auto auto 32%; width: 20%; height: 13%; opacity: 0; }
.backing::before, .backing::after { content: ""; position: absolute; top: 0; width: 42%; height: 100%; border-color: #9ed6c8; background: #587e73; }
.backing::before { left: 0; }
.backing::after { right: 0; }
.model[data-state="changed"] .backing { opacity: 1; }
.hole-inset { display: grid; place-items: center; top: 34%; left: 79%; width: 16%; aspect-ratio: 1; border-radius: 8px; border: 1px solid #666b71; background: #89939b; }
.hole-inset i { width: 42%; aspect-ratio: 1.6; background: #303238; border-radius: 50%; transform: rotate(-18deg); border: 1px solid #dae0de; }
.model[data-state="changed"] .hole-inset i { aspect-ratio: 1; transform: none; }

.compare { display: flex; flex-wrap: wrap; gap: 6px; }
.compare label { display: grid; position: relative; cursor: pointer; }
.compare label span { font-size: .88rem; padding: 6px 10px; border: 1px solid #787075; border-radius: 5px; }
.compare input, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.compare input:checked + span { border-color: #fff7ed; background: #fff7ed; color: #302035; font-weight: 700; }
.compare input:focus-visible + span { outline: 2px solid #f2bd8c; outline-offset: 3px; }

.learn { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 30px; align-items: center; margin-block: 39px 32px; }
.learn h2, .takeaway h2 { font-size: 1.25rem; margin-block-end: 8px; }
details { border-block-end: 1px solid var(--line); }
summary { min-height: 45px; padding-block: 7px; cursor: pointer; color: var(--wine-dark); font-weight: 700; }
details p { padding: 0 15px 12px; color: var(--muted); }
.reference-photo { overflow: hidden; border-radius: 7px; background: #eae4e1; }
.reference-photo img { width: 100%; height: auto; aspect-ratio: 840 / 450; object-fit: cover; }
.reference-photo figcaption { padding: 7px 11px; color: #42343a; font-size: .87rem; }
.takeaway { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: 8px; border: 1px solid #e2d4d8; background: var(--mist); padding: 19px 23px; }
.takeaway p { color: var(--muted); }
.takeaway ul { margin: 0; padding-inline-start: 18px; color: var(--muted); }
.takeaway a { font-weight: 700; text-underline-offset: 5px; }
.footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); padding-block: 21px; font-size: .88rem; }

.weld-guide { margin-block: 42px; scroll-margin-top: 18px; }
.section-head { margin-block-end: 19px; }
.section-head h2 { font-size: clamp(1.4rem, 2.5vw, 1.95rem); margin-block-end: 4px; }
.section-head p { max-inline-size: 51rem; color: var(--muted); }
.joint-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; align-items: start; }
.joint-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.joint-card img { width: 100%; height: auto; aspect-ratio: 680 / 350; object-fit: cover; border-block-end: 1px solid var(--line); }
.joint-copy { padding: 13px 15px 15px; }
.joint-copy h3, .preheat-form h3 { margin: 0 0 5px; font-size: 1.08rem; }
.joint-copy h3 bdi { margin-inline-start: .3rem; color: var(--muted); font-size: .87rem; font-weight: 400; }
.joint-copy > p { color: var(--muted); }
.joint-copy summary { font-size: .93rem; }
.joint-photo img { aspect-ratio: 4 / 3; border: 0; border-radius: 5px; }
.joint-photo figcaption { padding-block: 5px 9px; color: var(--muted); font-size: .83rem; }
.joint-copy > a { display: inline-block; margin-block-start: 10px; font-size: .88rem; text-underline-offset: 3px; }
.source-note, .small-note { margin-block: 10px 0; font-size: .9rem; color: var(--muted); }
.source-note:empty { display: none; }
.preheat-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.preheat-form, .preheat-table { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); min-width: 0; }
.preheat-form label { display: block; color: var(--muted); font-size: .93rem; margin-block: 10px 4px; }
.preheat-form input, .preheat-form select { width: 100%; min-height: 44px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 5px; padding: 6px 9px; font: inherit; }
.preheat-form .primary { margin-block-start: 13px; }
.thickness-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: 0 9px; }
.preheat-result:not(:empty) { margin-block-start: 15px; padding: 9px 12px; border-inline-start: 3px solid var(--wine); border-radius: 5px; background: var(--mist); color: var(--wine-dark); }
.preheat-result p { font-size: .92rem; }
.preheat-table table { width: 100%; border-collapse: collapse; text-align: start; }
.preheat-table caption { text-align: start; font-weight: 700; margin-block-end: 8px; }
.preheat-table th, .preheat-table td { text-align: start; padding: 7px 9px; border-block-end: 1px solid var(--line); }
.preheat-table thead { background: var(--paper); }
.preheat-table tr.matched { background: var(--mist); }
.preheat-table tbody th { font-weight: 400; }
.preheat-table details { margin-block-start: 8px; }
.electrode-examples { margin-block-start: 20px; padding-block-start: 13px; border-block-start: 1px solid var(--line); scroll-margin-top: 16px; }

@media (max-width: 780px) {
  .shell { width: calc(100% - 36px); }
  .intro { gap: 16px; padding-block: 25px; }
  .challenge { gap: 17px; padding: 16px; }
  .model { padding: 11px; }
  .joint-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; gap: 4px 10px; padding-block: 9px; }
  .identity { gap: 9px; font-size: .88rem; }
  .identity img { width: 62px; height: auto; }
  .identity span { padding-inline-start: 9px; }
  nav { width: 100%; }
  nav a { flex: 1; text-align: center; padding: 8px 10px; }
  .intro { grid-template-columns: 1fr; grid-template-areas: "copy" "photo"; }
  .cover img { max-height: 190px; }
  .challenge, .learn, .preheat-grid { grid-template-columns: 1fr; }
  .learn { margin-block: 26px; gap: 17px; }
  .takeaway { align-items: flex-start; flex-direction: column; padding: 15px; }
}

@media (max-width: 520px) {
  .joint-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.drilling-scene .drill { height: 59%; }
.model[data-state="changed"] .drill { height: 48%; }
.stand, .backing { top: 67%; }
.clamp { top: 42%; width: 5%; height: 17%; border: solid #aab8bf; border-width: 4px 0 0 3px; z-index: 4; }
.clamp.left { left: 12%; }
.clamp.right { left: 68%; transform: scaleX(-1); }
